locked
WinJS.xhr failing with no error text for a POST to test server RRS feed

  • Question

  • I have a call to WinJS.xhr in my application where I do a POST to a server with some XML. It works fine when posting to the network servers that my administrator maintains but not when I post to my own test server.  My own test server is listed in the hosts file so that it resolves to my server address.  My test server's certificate is issued to a test CA and I made sure that I imported the test CA certificate to my test machine's Trusted Root Certificate Issuers group and the server is loaded without certificate problems in the Desktop Mode web browsers.  I also verified that my application has the capabilities "Home or Work Networking" and "Internet (Client)".  Is there some checklist online that can help me figure out why IE doesn't want to post to my test server?

    Here is some example code:

             WinJS.xhr({
                url: "https://broker.grossag.int/broker/xml",
                type: "POST",
                data: "<?xml version='1.0' encoding='UTF-8'?><broker version='7.0'><set-locale><locale>en_US</locale></set-locale><get-configuration></get-configuration></broker>"
             }).then(
                function (request) {
                   // Do success stuff.
                },
                function (request) {
                   // Do error stuff.
                }
             );


    Friday, July 6, 2012 6:32 PM

Answers

  • There ended up being two possible causes for this issue:

    1. The certificate is not verifiable.  xhr doesn't return an error message.
    2. Our server code's certificate authentication code (Java-based) issued a reset in the middle of the connection which confused IE.

    I worked with Jeff to identify the issue and find a workaround (issue a GET or a HEAD to any address on the server first) but it is unlikely that there will be a fix in IE for the issue.  Try the workaround instead.

    • Marked as answer by Adam Gross Friday, November 16, 2012 7:17 PM
    Friday, November 16, 2012 7:17 PM

All replies

  • Are you doing this in IE or a Metro style app?

    " Is there some checklist online that can help me figure out why IE doesn't want to post to my test server?"

    What error messages are you getting?

    Fiddler is great to debug http scenarios and see the traffic: http://fiddler2.com

    use the .NET 4.0 version of Fiddler.


    Jeff Sanders (MSFT)

    Friday, July 6, 2012 6:37 PM
    Moderator
  • I got no error message and no status.  The response object's readyState member is 4 but everything else is either 0 or "".
    Friday, July 6, 2012 6:41 PM
  • Go with Fiddler next!

    Jeff Sanders (MSFT)

    Friday, July 6, 2012 6:43 PM
    Moderator
  • I tried Wireshark (installing WinPCAP in compatibility mode to get it to work) and verified that my existing application connects fine from Desktop Mode and wireshark logs the traffic to the test server.  I think tried the WinJS.xhr call in my test app and verified that no traffic was sent over the wire to this test server.  So it seems that the IE-based app container is blocking the call for some reason, but I don't know why that would be.
    Friday, July 6, 2012 6:51 PM
  • Try fiddler.

    Turn on all exeptions in the debugger, also if the server is on the same box it will fail (by design) but I assume this is not the case.


    Jeff Sanders (MSFT)

    Friday, July 6, 2012 6:53 PM
    Moderator
  • It turned out Autoproxy was screwing my connection up but removing that option still didn't fix the issue.  I got Wireshark to work and it is telling me that there is a SSL handshake failure.  I found out that if my server has certificate authentication (part of the SSL handshake) set as optional my WinJS.xhr call fails.  If I disable certificate authentication on the server side I no longer get an SSL handshake failure.  I also found that xhr GETs don't show a SSL handshake failure with certificate authentication set to optional...only POSTs.  It seems like a bug in Windows.  Would you still like me to provide more information from fiddler or would you like me to give you more extensive Wireshark traces?
    Friday, July 6, 2012 7:09 PM
  • Hi Adam,

    If I understand you correctly there is not not an SSL Handshake failure for a GET when your server is set to 'optional' for validation, but does fail for a POST.  If that is the case, the server is the issue.  The server should not fail validation for one VERB vs the other.  Is this a Microsoft IIS server?

    -Jeff


    Jeff Sanders (MSFT)

    Monday, July 9, 2012 12:50 PM
    Moderator
  • Thanks for the help, Jeff.  You are probably right, so I am going to check with some coworkers to have them test the same action in a different browser to the same server to make sure it's not just an IE10 issue.  I will update this thread with my results in the next couple of days.  It's a custom server for our product but I'm not sure what technologies it's built off of.
    Monday, July 9, 2012 8:40 PM
  • As an update, I found that the issue is not with the web server, as the exact same Javascript networking library used to do the posts works fine from Google Chrome to the exact same web server but fails as part of a Metro style application.  Next week I am hoping to compare Wireshark traces to see if I can tell you exactly what the Metro IE10 wrapper is doing wrong, but so far I am fairly confident that this is a bug in IE10.  And regardless, it's fairly annoying that XmlHttpRequest failures like this SSL handshake failure or a certificate validation failure don't return any error messages.  That alone will probably end up forcing me to call into a C# WinRT component library to replace my calls to XmlHttpRequest.
    Thursday, July 12, 2012 2:40 PM
  • I have investigated this further and I am sure that this is a bug in XmlHttpRequest in IE10.  I sent the exact same POST request to the same address using IXmlHttpRequest2 in a C++ Metro app and found that it succeeds, like all other browsers and all other platform-based clients.  I also sent the POST request directly using StreamSocket and found that the SSL handshake succeeded.  XmlHttpRequest running on IE10 is the only platform that fails with a SSL handshake error.  What kind of information can I provide you to help you debug this?  I guess I have a workaround (call into a C++ module that uses IXmlHttpRequest2 instead of using XmlHttpRequest directly in Javascript) but I would like to help you guys fix the bug if possible.
    Thursday, July 19, 2012 4:02 PM
  • Hi Adam,

    Detailed netmon and other traces will help.  Also if there is anyway to repro this, that would be the ideal solution.  Can you contact me here?  http://blogs.msdn.com/jpsanders/contact.aspx

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, July 19, 2012 4:08 PM
    Moderator
  • I also encounter this problem, the https site can be visited in IE and I already export and add the certification into app manifest. It will still sometimes fail with empty response.
    Friday, November 16, 2012 4:57 AM
  • There ended up being two possible causes for this issue:

    1. The certificate is not verifiable.  xhr doesn't return an error message.
    2. Our server code's certificate authentication code (Java-based) issued a reset in the middle of the connection which confused IE.

    I worked with Jeff to identify the issue and find a workaround (issue a GET or a HEAD to any address on the server first) but it is unlikely that there will be a fix in IE for the issue.  Try the workaround instead.

    • Marked as answer by Adam Gross Friday, November 16, 2012 7:17 PM
    Friday, November 16, 2012 7:17 PM