locked
Not getting values, only wsdl schema in asmx service using SOAP envelope RRS feed

  • Question

  • User-1089250552 posted

    I need to get data from asmx service using SOAP envelope.

    I'm getting wsdl schema only not value.

    Since two days i am trying to find ,what may be the issue.

    var productServiceUrl = 'http://xxxxxx/Testing/Test.asmx?WSDL'; 

    eq_params = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

    req_params = req_params + "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://www.w3.org/2003/05/soap-envelope\">"
    req_params = req_params + "<soap:Body>";
    req_params = req_params + "<RetrievePayrollAccounts xmlns=\"http://xxxx/xxxxxx/PayrollAccountServices\">";
    req_params = req_params + "<request xmlns=\"http://xxxxx/Trust\">";
    req_params = req_params + "<Series>" + Series + "</Series>";
    req_params = req_params + "<PayrollNumber>" + PayrollNumber + "</PayrollNumber>";
    req_params = req_params + "<StartDate>" + StartDate + "</StartDate>";
    req_params = req_params + "<RecordCount>" + RecordCount + "</RecordCount>";
    //req_params = req_params + "<symbol>" + symbol + "</symbol>";
    req_params = req_params + "</request>";
    req_params = req_params + "</RetrievePayrollAccounts>";
    req_params = req_params + "</soap:Body>";
    req_params = req_params + "</soap:Envelope>";

    $.support.cors = true;
    $.ajax({
    type: "GET",
    url: productServiceUrl,
    data: req_params,
    dataType: "xml",
    processData: false,
    username: AuthUserId,
    password: AuthPwd,
    headers: {
    SOAPAction: 'http://ceridian.ca/xxxx/xxxx/RetrievePayrollAccounts'
    },
    contentType: "application/json; charset=\"utf-8\"",
    success: function (data, textStatus, XmlHttpRequest) {
    Result(data);
    },
    error: function (msg) {
    alert("Failed: " + msg.status + ": " + msg.statusText);
    }

    });

    Thursday, March 13, 2014 9:13 AM

Answers

  • User-417640953 posted

    $.ajax({
    type: "GET",
    url: productServiceUrl,
    data: req_params,
    dataType: "xml",
    processData: false,
    username: AuthUserId,
    password: AuthPwd,
    headers: {
    SOAPAction: 'http://ceridian.ca/xxxx/xxxx/RetrievePayrollAccounts'
    },
    contentType: "application/json; charset=\"utf-8\"",
    success: function (data, textStatus, XmlHttpRequest) {
    Result(data);
    },
    error: function (msg) {
    alert("Failed: " + msg.status + ": " + msg.statusText);
    }

    });

    Hi john,

    Thank you post the issue to asp.net forum.

    Based on your description and code provided, I see you want to call the web service with the soap message by jquery ajax.

    For this issue only getting the wsdl schema, I think it caused by you set the type as 'GET'.

    Please try to set it as "Post". And the contentType should be "text/xml; charset=\"utf-8\"",

    $.ajax({
     type: "Post",
     url: productServiceUrl,
     data: req_params,
     dataType: "xml",
     processData: false,
     username: AuthUserId,
     password: AuthPwd,
     headers: {
     SOAPAction: 'http://ceridian.ca/xxxx/xxxx/RetrievePayrollAccounts'
     },
     contentType:"text/xml; charset=\"utf-8\"",
     success: function (data, textStatus, XmlHttpRequest) {
     Result(data);
     },
     error: function (msg) {
     alert("Failed: " + msg.status + ": " + msg.statusText);
     }
     
    });
    

    For more information, please check below.

    http://stackoverflow.com/questions/7013111/jquery-ajax-consume-soap-web-service

    http://openlandscape.net/2009/09/25/call-soap-xm-web-services-with-jquery-ajax/

    Hope that helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 15, 2014 11:10 PM

All replies

  • User-417640953 posted

    $.ajax({
    type: "GET",
    url: productServiceUrl,
    data: req_params,
    dataType: "xml",
    processData: false,
    username: AuthUserId,
    password: AuthPwd,
    headers: {
    SOAPAction: 'http://ceridian.ca/xxxx/xxxx/RetrievePayrollAccounts'
    },
    contentType: "application/json; charset=\"utf-8\"",
    success: function (data, textStatus, XmlHttpRequest) {
    Result(data);
    },
    error: function (msg) {
    alert("Failed: " + msg.status + ": " + msg.statusText);
    }

    });

    Hi john,

    Thank you post the issue to asp.net forum.

    Based on your description and code provided, I see you want to call the web service with the soap message by jquery ajax.

    For this issue only getting the wsdl schema, I think it caused by you set the type as 'GET'.

    Please try to set it as "Post". And the contentType should be "text/xml; charset=\"utf-8\"",

    $.ajax({
     type: "Post",
     url: productServiceUrl,
     data: req_params,
     dataType: "xml",
     processData: false,
     username: AuthUserId,
     password: AuthPwd,
     headers: {
     SOAPAction: 'http://ceridian.ca/xxxx/xxxx/RetrievePayrollAccounts'
     },
     contentType:"text/xml; charset=\"utf-8\"",
     success: function (data, textStatus, XmlHttpRequest) {
     Result(data);
     },
     error: function (msg) {
     alert("Failed: " + msg.status + ": " + msg.statusText);
     }
     
    });
    

    For more information, please check below.

    http://stackoverflow.com/questions/7013111/jquery-ajax-consume-soap-web-service

    http://openlandscape.net/2009/09/25/call-soap-xm-web-services-with-jquery-ajax/

    Hope that helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 15, 2014 11:10 PM
  • User-1089250552 posted

    Thanks dude..it's working now..

    I changed the type to POST.

    and namespace also. 

    "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
    "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";

    Monday, March 17, 2014 3:01 AM