Using ajax and SAOP - AJAX

To use SOAP with Ajax, you need to perform a number of separate steps:

  1. Create the SOAP envelope.
  2. Serialize the application-specific information into XML.
  3. Create the SOAP body containing a serialized version of your application-specific code.
  4. Send an HTTP request via the XMLHTTPRequest object, containing the SOAP message as a payload.

The callback function then needs to be responsible for unpacking the SOAP response and parsing the XML contained inside it.

Code Example
How might the resulting code look? Let’s see an example using the fictitious SOAP web service of the previous example:

Here we have constructed the entire SOAP envelope in a JavaScript string variable, before passing it to the send() function of the XMLHTTPRequest object.

The value returned from the server needs to be parsed first to remove the SOAP response wrapper and then to recover the application data from the body section of the SOAP message.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

AJAX Topics