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

TypeError: $.soap(...).done is not a function #134

Closed karres-illinois closed 3 years ago

karres-illinois commented 4 years ago

Hi, I have just started using jquery.soap. I have: "jquery": "^3.4.1" and "jquery.soap": "^1.7.3"

The Readme says that it honors the "promise" model. I have the following:

function getLists() { $.soap({ url: "https://lists.mycompany.com/listssoap", method: "lists", }).done(function(data, textStatus, jqXHR) { console.log("DONE"); }).fail(function(jqXHR, textStatus, errorThrown) { console.log("FAIL"); }); }

but when run i get the error in the subject. Am I doing something wrong?

doedje commented 4 years ago

Hi, I must say I haven't tested the code with jQeury3.x yet (will have to in the coming months...) As far as I understand from the jQuery website the underlying call, $.ajax, is still returning the jqXHR object that implements the Promise interface. So your code should be okay. OR your call to $.soap doesn't return the jqXHR object?

You can check that like so:

function getLists() {
  var tmp = $.soap({
    url: "https://lists.mycompany.com/listssoap",
    method: "lists"
  });
  console.r(tmp);
}

(are you sure you don't run into Same-origin policy restrictions?)

karres-illinois commented 4 years ago

Hi

Thank you for the sample code. I am getting an object returned. Since reporting the issue I reverted back to the success/error methodes. It seems like neither of those is being called. A really strange thing is that this actually worked a lot earlier today – the success/error methods.

  1. Object
  2. appendMethodToURL: true
  3. async: true
  4. enableLogging: false
  5. noPrefix: false
  6. soap12: false
  7. withCredentials: false
  8. timeout: 5000
  9. url: "https://lists.mycompany.com/soap"
  10. namespaceURL: "https://lists. mycompany.com /lists/wsdl"
  11. method: "lists"
  12. success: ƒ (soapResponse)
  13. length: 1
  14. name: "success"
  15. arguments: null
  16. caller: null
  17. prototype: {constructor: ƒ}
  18. proto: ƒ ()
  19. error: ƒ (soapResponse)
  20. length: 1
  21. name: "error"
  22. arguments: null
  23. caller: null
  24. prototype: {constructor: ƒ}
  25. proto: ƒ ()
  26. proto: Object Thanks, I’ll keep poking at it.

Cheers