SOAP (Simple Object Access Protocol) is a platform-independent protocol that uses XML to facilitate remote procedure calls, typically over HTTP. SOAP is one common protocol for passing information between web service clients and web services. The protocol that transmits request-and-response messages is also known as the web service’s wire format or wire protocol, because it defines how information is sent “along the wire.”
Each request and response is packaged in a SOAP message (also known as a SOAP envelope)—an XML “wrapper” containing the information that a web service requires to process the message. SOAP messages are written in XML so that they are platform inde-pendent. Many firewalls—security barriers that restrict communication among net-works—are configured to allow HTTP traffic to pass through so that clients can browse websites on web servers behind firewalls. Thus, XML and HTTP enable computers on dif-ferent platforms to send and receive SOAP messages with few limitations.
The wire format used to transmit requests and responses must support all data types passed between the applications. Web services also use SOAP for the many data types it supports. SOAP supports primitive types (e.g., int) and their wrapper types (e.g., Integer), as well as Date, Time and others. SOAP can also transmit arrays and objects of user-defined types (as you’ll see in Section 28.8). For more SOAP information, visit www.w3.org/TR/soap/.
When a program invokes a web method, the request and all relevant information are packaged in a SOAP message and sent to the server on which the web service resides. The web service processes the SOAP message’s contents (contained in a SOAP envelope), which specify the method that the client wishes to invoke and the method’s arguments. This process of interpreting a SOAP message’s contents is known as parsing a SOAP mes-sage. After the web service receives and parses a request, the proper method is called with any specified arguments, and the response is sent back to the client in another SOAP mes-sage. The client-side proxy parses the response, which contains the result of the method call, and returns the result to the client application.
Figure 28.5 used the HugeInteger web service’s Tester web page to show the result of invoking HugeInteger’s add method with the values 99999999999999999 and 1. The Tester web page also shows the SOAP request and response messages (which were not previously shown). Figure 28.12 shows the SOAP messages in the Tester web page from Fig. 28.5 after the calculation. In the request message from Fig. 28.12, the text
specifies the method to call (add), the method’s arguments (first and second) and the arguments’ values (99999999999999999 and 1). Similarly, the text
from the response message in Fig. 28.12 specifies the return value of method add.
As with the WSDL for a web service, the SOAP messages are generated for you auto-matically, so you don’t need to understand the details of SOAP or XML to take advantage of it when publishing and consuming web services.
Fig. 28.12 | SOAP messages for the HugeInteger web service’s add method as shown by the Sun Java System Application Server’s Tester web page.
Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.