Simple Object Access Protocol (SOAP)
The Simple Object Access Protocol (SOAP) grew out of XML-RPC and has eclipsed XML-RPC in terms of media coverage due to its use throughout Microsoft's .NET architecture. On the surface, SOAP and XML-RPC look very much alike, as both are XML-based RPC mechanisms that make use of HTTP as a communications transport. While XML-RPC is extremely simple, this simplicity can also be limiting. SOAP goes several steps further by allowing support for XML namespaces, interface discovery, and custom data types. All SOAP messages are contained within an envelope, which is used to describe the message being sent as well as the sender. Depending on your application, XML-RPC may very well meet all your needs. However, if you're required to send complex data types over the wire or need to control how your message is processed on the server-side, SOAP fits the bill. The following code snippet demonstrates a SOAP message and response, using our informIT.getUserAddress RPC call from earlier in this article.
Message: <?xml version='1.0'?> <SOAP:Envelope xmlns:SOAP='urn:schemas-xmlsoap-org:soap.v1'> <SOAP:Body> <i:getUserAddress xmlns:i='someInterface'> <userID>198172</userID> </i:getUserAddress> </SOAP:Body> </SOAP:Envelope> Response: <SOAP:Envelope xmlns:SOAP='urn:schemas-xmlsoap-org:soap.v1'> <SOAP:Body> <i:fResponse xmlns:i='someInterface'> <address>123 N. Elm Street Fargo, North Dakota </address> </i:fResponse> </SOAP:Body> </SOAP:Envelope>