Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use one proxy in javascript AJAX using SOAP the same as WCF Test Client use
    text
    copied!<p>I have WCF web Service and javascript client which connects to this service via AJAX using SOAP 1.2 . What i wanna do is to pass some parameter to tell the AJAX SOAP call to <strong>use only one proxy</strong> the same as I do it in the WCF Test Client by unchecking the "Start a new proxy" . <img src="https://i.stack.imgur.com/RXYLX.png" alt="image"></p> <p>And this is my SOAP AJAX call:</p> <pre><code>DoSoapAjax: function (soapMethodName, data, successHandler, errorHandler, isAsync, currentInstance) { var service = this; var soapResult = soapMethodName + "Result"; var soap12WithWsHttpBindRequest ='&lt;s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope"&gt;' + '&lt;s:Header&gt;' + '&lt;a:Action s:mustUnderstand="1"&gt;' + this.serviceContractNamespace + '/' + this.interfaceName + '/' + soapMethodName + '&lt;/a:Action&gt;' + '&lt;a:MessageID&gt;urn:uuid:605ea0c6-d09b-46bf-b61d-e61b377a135b&lt;/a:MessageID&gt;' + '&lt;a:ReplyTo&gt;' + '&lt;a:Address&gt;http://www.w3.org/2005/08/addressing/anonymous&lt;/a:Address&gt;' + '&lt;/a:ReplyTo&gt;' + '&lt;a:To s:mustUnderstand="1"&gt;' + this.tenantAdminService + '&lt;/a:To&gt;' + '&lt;/s:Header&gt;' + '&lt;s:Body&gt;'; if (data == emptyString) { soap12WithWsHttpBindRequest += '&lt;' + soapMethodName + ' xmlns="' + this.serviceContractNamespace + '" /&gt;'; } else { soap12WithWsHttpBindRequest += '&lt;' + soapMethodName + ' xmlns="' + this.serviceContractNamespace + '"&gt;' + data + '&lt;/' + soapMethodName + '&gt;'; } soap12WithWsHttpBindRequest += '&lt;/s:Body&gt;' + '&lt;/s:Envelope&gt;'; // in order for ajax to work on jQuery 1.8.2 we need to enable the following. // found this answer on the link : http://stackoverflow.com/questions/9160123/no-transport-error-w-jquery-ajax-call-in-ie $.support.cors = true; // variable to save successData var responseData = null; // SOAP 1.2 query var response = $.ajax({ type: "POST", url: this.tenantAdminService, data: soap12WithWsHttpBindRequest, contentType: "application/soap+xml", dataType: "xml", processData: false, async: isAsync, success: function (data, status, xmlHttpRequest) { responseData = data; // inserting all data results into dictionary var responseResults = {}; // delegating success function if (successHandler != null) { responseResults = service.ParseResponse(soapMethodName, data); successHandler(responseResults, currentInstance); } }, error: function (xmlHttpRequest, textStatus, errorThrown) { if (errorHandler != null) { errorHandler(xmlHttpRequest, textStatus, errorThrown, currentInstance); } else if (!isAsync) { alert("Error : " + errorThrown); alert("Error Description : " + xmlHttpRequest.responseText); } return; } }); if (!isAsync) { return service.ParseResponse(soapMethodName, response.responseXML); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload