A SOAP request will involve creating and populating a request envelope, which contains all the required information (as specified by the WSDL document), transmitting that envelope to the API server, and handling the response. A SOAP request generally contains all of the following elements:
With that information in mind, a SOAP request can be generated. <?xmlversion="1.0" encoding=" UTF-8" standalone="no"?> The parameters included in the request are easy to pick out, and though the variable typing isn't of great importance for PHP development, it does come in handy for more strongly typed languages. The missing item here is the endpoint, made clear in the REST example because it was the URL to which the request was posted. SOAP requests, of course, are run against specified URIs, which do not need to be re-specified within the request itself. The SOAP response would look like this: <?xmlversion='1.0' encoding='UTF-8'?> The SOAP response isn't too different from the REST response shown earlier. In fact, much of the name spacing could actually be omitted (though it is rare to see a SOAP response without it), at which point, with the exception of the additional encapsulation, the two documents would be very similar. As you should be able to discern from the response shown, it declares itself to be XML 1.0 and uses UTF-8 for encoding. The SOAP-ENV:Envelope element is the root element for the document, and has threenamespaces, including the SOAP-ENV namespace. The Body then contains the LibrarySearchResponse element among other things, which also defines its own namespace. The RequestInfo parent follows after, and this contains the request parameters that generated the response that follows on from there. Returning request parameters with the response is a common occurrence in SOAP. Finally, the response itself is returned. Notice that the ResultCount element sits as a direct child of ResponseInfo, and the result items themselves are again stored under a repeating element, Item.
|
|||||||||||||
Disclaimer
1) E-articles is not responsible for the information contained by this article as well for any and all copyright infringements by authors and writers. E-articles is a free information resource. If you suspect this article for any copyright infringement, please read the terms of service and contact us or use the "Report this article" button on this page to investigate the problem.
2) E-articles is not responsible for inaccuracies, falsehoods, or any other types of misinformation this article may contain and will not be liable for any loss or damage suffered by a user through the user's reliance on the information gained here. |
|||||||||||||