Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE9/8 issues - Soap call not initiating to a cross-domain url #80

Closed
arunmenon1975 opened this issue Jul 4, 2015 · 5 comments
Closed

Comments

@arunmenon1975
Copy link
Contributor

At the outset, i am not sure if it is an issue with the script - i am mostly looking for some pointers to an issue that appears only for IE9 and IE8

I have this script running perfectly fine in IE10+, Chrome, Firefox and Safari and the stock Android browser. An example implementation is thus:

A link on my page (say, the homepage) makes an AJAX request and pulls in a form. The user enters data and submits the form to a PHP file. This PHP file returns data (echos) in the form of a <script> chunk that has the $.soap object with all the required params filled in. The URL to send the soap data is a cross-domain request. All my cross-domain requests are handled via x-domain.

In browsers other than IE9/8 the complete flow works perfectly fine. The $.soap call to the external domain is intercepted by x-domain, which returns back the data and i can go ahead using the response.

In IE8/8, the $.soap call is not initiated at all. I am logging the data in beforeSend which shows correct information, so the buildup is fine. The next logged error is the xhr error

console.log('jquery.soap - error:', jqXHR)

which returns(using IE's inspector):

description: "Unable to get property 'addEventListener' of undefined or null reference"
message: "Unable to get property 'addEventListener' of undefined or null reference"
name: "TypeError"
number: -2146823281

And the script subsequently fails at Line: 477 which reads:

throw new Error("Unexpected Content: " + $.type(this.content));

I guess the error is because the response is null or undefined.

My $.soap call looks like:

$.soap({
        url: "http://url_to_external_web_service",
        enableLogging: true,
        method: "myMethodNameHere",
        namespaceQualifier: "someData",
        appendMethodToURL: false,
        namespaceURL: "urn:someData",
        envAttributes: {
            "xmlns:s0": "urn:SomeData",
            "xmlns:SOAP-ENV": "http://schemas.xmlsoap.org/soap/envelope/",
            "xmlns:soapenc": "http://schemas.xmlsoap.org/soap/encoding/",
            "xmlns:wsdl": "http://schemas.xmlsoap.org/wsdl/"
        },
        beforeSend: function(SOAPEnvelope) {
            console.log("Information being sent: "+SOAPEnvelope.toString());
        },
        data: {
            "someKey1": "someValue1",
            "someKey2": "someValue1"
        },
         SOAPHeader: {
            AuthenticationInfo : {
                "someKey1": "someValue1",
            "someKey2": "someValue1"
            }
        },
        success: function (soapResponse) {
            //do something with success

        },
        error: function (SOAPResponse) {
            console.log("error in ..."+SOAPResponse);
        }
    });

I noticed the script has a commented out line

//crossDomain: true,

I tried removing the comment but the error remains.

I am not sure if this is a Stack Exchange sort of question, but i thought id ask here since there is a possibility that users with similar issues may attempt to search through the issue lists here.

Edit:

jquery version: 1.11.2
jquery.soap version: 1.6.4

Another Edit:

Opened an issue at the xdomain repository as well as i am currently not sure what could be issue.

@jpillora
Copy link

jpillora commented Jul 6, 2015

Hey @arunmenon1975 run through these https://github.com/jpillora/xdomain#faq--troubleshooting and report back

@doedje
Copy link
Owner

doedje commented Jul 6, 2015

When the issue is indeed a problem with jquery.soap please let me know! =]

@jpillora: xdomain looks nice! I'll have to look into that! ;)

@arunmenon1975
Copy link
Contributor Author

After some tinkering, reading through the issues in both the repos and the FAQs mentioned by @jpillora in the comment above, i did manage to get it fixed. It did require a change in jquery.soap(as well as changes discussed at x-domain).

A round-up of the changes:

  • Made changes described at issue #21 . This is mentioned in the FAQs as well. I still have not tested with having this change reversed.
  • Commented out some lines (around 20, including comments) in the non-minified jquery.soap script that referenced xhr for enabling progress info in the AJAX request (in the send function):
// second attempt to get some progres info (but still a no go)
// I still keep this in tho, we might see it working one day when browsers mature...
                xhr: function() {
                    var xhr = new window.XMLHttpRequest();
......
......
  • added a catch-all console object script as IE sometimes returned errors that console wasn't defined. This may not be related to the fix, but i did get the error despite having it already defined in a short snippet. This error appeared off and on and was unpredictable.

Thanks for this fantastic script - it did work for all my requirements until this issue surfaced.

Closing this issue for now. I have already closed the issue opened at the xdomain reppo.

Please note: The fix was noticed only during early testing. May re-open if issue persists while i test a little more intensively.

@doedje
Copy link
Owner

doedje commented Jul 6, 2015

Thanx for the information, could you sent me a pull request when you have done further testing?

arunmenon1975 added a commit to arunmenon1975/jquery.soap that referenced this issue Jul 6, 2015
WRT issue doedje#80 (doedje#80)
commenting out the xhr function below for IE8 and IE9 compatability.
Issue exists when used alongside any script that modifies the
XMLHttpRequest object like, for example, the xdomain or xhook libraries.
This could be explicitly enabled by users on a per-case basis if it is
mentioned somewhere in the readme.md file.
@arunmenon1975
Copy link
Contributor Author

I just sent in the pull request. Please view it at #82

doedje added a commit that referenced this issue Aug 24, 2016
- fix for #80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants