How to use one proxy in javascript AJAX using SOAP the same as WCF Test Client use

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 use only one proxy the same as I do it in the WCF Test Client by unchecking the "Start a new proxy" .

And this is my SOAP AJAX call:

DoSoapAjax: function (soapMethodName, data, successHandler, errorHandler, isAsync, currentInstance) {
    var service = this;
    var soapResult    = soapMethodName + "Result";
    var soap12WithWsHttpBindRequest ='<s:Envelope xmlns:a="" xmlns:s="">' +
                      '<s:Header>' +
                      '<a:Action s:mustUnderstand="1">' + this.serviceContractNamespace + '/' + this.interfaceName + '/' + soapMethodName + '</a:Action>' +
                      '<a:MessageID>urn:uuid:605ea0c6-d09b-46bf-b61d-e61b377a135b</a:MessageID>' +
                      '<a:ReplyTo>' +
                      '<a:Address></a:Address>' +
                      '</a:ReplyTo>' +
                      '<a:To s:mustUnderstand="1">' + this.tenantAdminService + '</a:To>' +
                      '</s:Header>' +
                      if (data == emptyString)
                        soap12WithWsHttpBindRequest +=
                      '<' + soapMethodName + ' xmlns="' + this.serviceContractNamespace + '" />';
                        soap12WithWsHttpBindRequest +=
                      '<' + soapMethodName + ' xmlns="' + this.serviceContractNamespace + '">' +
                      data +
                      '</' + soapMethodName + '>';
                       soap12WithWsHttpBindRequest +=
                      '</s:Body>' +
    // in order for ajax to work on jQuery 1.8.2 we need to enable the following.
    // found this answer on the link :
    $.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);


        if (!isAsync)
            return service.ParseResponse(soapMethodName, response.responseXML);


I'll start off by saying I do not know the specific answer to this, but my approach would be to sniff the traffic from your WFC Test Client to see if it is adding any parameters to the call which you could add to your request header on your AJAX call.

Fiddler might do the job though I'm not sure it will catch all http traffic - mostly it's geared to browsers. There are other tools with more or less capability and ease of use, like wire shark, ether, and so on.

I would guess there is some other request parameter outside the SOAP envelope body being transmitted from the test client that you should be able to see. It's the only way I can imagine the test client would be able to communicate this without modifying your SOAP message.

If you can find the name and value, you can add it to your data: parameter as another name-value JSON entity.

liorafar: I assume you are running Javascript from a browser as it host. If so it is not possible unless you allow the javascript change some behavoiur of your host which is with clients aproval for every excecution that the browser identifies as security risk. Consider that: 1) Javascript doesnt take control over the connection configuration, it only use the envirionment provided by the host where it is running, in this case the browser but can be on the server side too. 2) In case you say "ok, lets force this", the only way it come to my mind is to make an instance of your host or any object of the client host and force to change the connection... and by that moment the browser will detect your javascript as a security risk and cerntanly you should create a script for every browser in the market, because every one has it way to handle this... the only good news on this is that with IE you can change the configuration for Chrome too!!

What I will do to solve this issue is to ask to the IT people to config the browsers with some exceptino rule over the proxy in the browsers (if you are into a company).

I hope this can help in a way or another!!


You can put your soap request in Fiddler and then execute you will get the response. For that response type. When you get response view it in mode you want.

Need Your Help

Weird Chrome prototype/jQuery conflict

jquery google-chrome prototypejs conflict

We have an application with legacy code that relies on prototype, but we've found it to be too 'heavy' for most of the places we want to use it and and have found jQuery to be a better fit for how we

Why does the H2 console in Spring Boot show a blank screen after logging in?

java spring-boot h2

I'm using Spring Boot 1.4.1 with the H2 database. I have enabled the H2 console as described in the reference guide by adding the following lines to my file: