doedje / jquery.soap

This script uses $.ajax to send a SOAP:Envelope. It can take XML DOM, XML string or JSON as input and the response can be returned as either XML DOM, XML string or JSON too.
352 stars 148 forks source link

Account for null response #123

Closed oneton closed 5 years ago

oneton commented 6 years ago

Some webservices only allow a request and do not provide a response (or possibly just a specific HTTP 2xx success code). I noticed that (in Chrome and Safari) the script runs into an error in such cases, because the xhr.responseXML property is null.

Uncaught Error: Unexpected Content: null at SOAPResponse.toString (VM166 jquery.soap.js?_=1507333726234:478)

See this jsFiddle. It calls a static (non SOAP) PHP script that simulates the behaviour by just returning HTTP status code 202. When using the fiddle as-is (jquery.soap version 1.7.1), the JS browser console shows an error when running the fiddle. Replace the included script as indicated (add -patched) and the call succeeds.

doedje commented 6 years ago

Nice one! I'll merge this next monday, bump the versions and stuff..... Thanx!

doedje commented 5 years ago

Wow, totally forgot about this one.... Sorry about that. Merging now......