Jquery – Weird JQuery Error


I'm getting the following error when trying to use JQuery with the JqSOAPClient plugin:

Error: uncaught exception: [Exception… "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://localhost:1320/jquery-1.3.2.min.js :: anonymous :: line 19" data: no]

please advise.

I'm calling a local .net webservice using Javascript:

var soapBody = new SOAPObject("FindCountryAsString");
soapBody.ns = "http://localhost:1320";
soapBody.appendChild(new SOAPObject("V4IPAddress")).val(a); 
var sr = new SOAPRequest("http://localhost:1320/Service1.asmx/FindCountryAsString", soapBody);
SOAPClient.SOAPServer = "http://localhost:1320/Service1.asmx/"; 
SOAPClient.SendRequest(sr, processResponse); 

both this page and the .net webservice run on the same domain (localhost in this case).

Best Solution

Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]

That's what you get when you try to XMLHttpRequest.open() a URL consisting of an empty string.

jqSOAPClient appears to expect you to set SOAPClient.Proxy to the local URL you want to access, not .SOAPServer. If you don't set SOAPClient.Proxy, it ends up trying to send a request to an empty string.

(In the code, it's checking for Proxy==null, but if not set Proxy actually defaults to an empty string, not null, so that fails. And anyway even if that worked, it would simply silently fail to do anything if no Proxy is set, which isn't really any more helpful either.)