locked
Web Services and ASP.Net RRS feed

  • Question

  • User1096124774 posted

    Hi There,

    I need some assistance and advise on how to make use of the methods.

    I have the following WSDL, https://soap.isdsl.net/api/api.php?wsdl

    which i need to use in ASP.Net. I have added in a service reference successfully.

    I can see all the classes and methods.

    I'm trying to create a session and get a response back.

    This is my code under a button (just for testing as i will do this from page load),

    SR1_ISDSL.startSessionRequest client = new SR1_ISDSL.startSessionRequest();

    string username = client.strUserName = "myusername;
    string password = (client.strPassword = "mypassword");
    bool sessionstatus = (client.blnContinue = false);


    SR1_ISDSL.startSessionResponse response = ((SR1_ISDSL.ISDSLPortType)(this)).startSession(client);
    string sessionid = response.strSessionID;
    int responsecode = Convert.ToInt32(response.intReturnCode);

    Response.Write(sessionid);

    ==============

    Please can someone guide me or perhaps give me an example to use.

    I will greatly appreciate it.

    Friday, August 4, 2017 11:41 AM

All replies

  • User1120430333 posted

    maybe, you should be posting to the ASP.NET Web services and other services forum.

    Friday, August 4, 2017 12:43 PM
  • User475983607 posted

    Hi There,

    I need some assistance and advise on how to make use of the methods.

    I have the following WSDL, https://soap.isdsl.net/api/api.php?wsdl

    which i need to use in ASP.Net. I have added in a service reference successfully.

    I can see all the classes and methods.

    I'm trying to create a session and get a response back.

    This is my code under a button (just for testing as i will do this from page load),

    SR1_ISDSL.startSessionRequest client = new SR1_ISDSL.startSessionRequest();

    string username = client.strUserName = "myusername;
    string password = (client.strPassword = "mypassword");
    bool sessionstatus = (client.blnContinue = false);


    SR1_ISDSL.startSessionResponse response = ((SR1_ISDSL.ISDSLPortType)(this)).startSession(client);
    string sessionid = response.strSessionID;
    int responsecode = Convert.ToInt32(response.intReturnCode);

    Response.Write(sessionid);

    ==============

    Please can someone guide me or perhaps give me an example to use.

    I will greatly appreciate it.

    You're instantiating an output type not the service proxy.   Your code should look similar to this...

    SDSLPortTypeClient client = new SDSLPortTypeClient();
    string returnCode = string.Empty;
    string result = client.startSession("username", "password", true, out returnCode);

    The startSessionRequest type is used for in the startSessionAsync method like so...  Keep in mind this is demo code to show how the async method works.

            async static Task<startSessionResponse> startSessionAsync()
            {
                SDSLPortTypeClient client = new SDSLPortTypeClient();
                startSessionRequest request = new startSessionRequest("username", "password", true);
                return await client.startSessionAsync(request);
            }

    You'll need to consult the service documentation to understand generally how to the service works and what bits are types passed between the client and method.

    Friday, August 4, 2017 2:28 PM