Anatomy of an XML Web Service Lifetime
The process that occurs when you make an XML Web service call is similar to the process that occurs when making a regular method call. The main difference is that instead of calling a method that is located in the client application, you generate a request message over the specified transport, such as HTTP. Because the XML Web service method can be located on a different computer, the information that the XML Web service needs to process the request must be passed across the network to the server that hosts the XML Web service. The XML Web service processes the information and sends the result back, over the network, to the client application.
The following illustration shows the process of communication between a client and an XML Web service.
XML Web service lifetime
The following describes the sequence of events that occur when an XML Web service is called:
- The client creates a new instance of an XML Web service proxy class. This object resides on the same computer as the client.
- The client invokes a method on the proxy class.
- The infrastructure on the client computer serializes the arguments of the XML Web service method into a SOAP message and sends it over the network to the XML Web service.
- The infrastructure receives the SOAP message and deserializes the XML. It creates an instance of the class implementing the XML Web service and invokes the XML Web service method, passing in the deserialized XML as arguments.
- The XML Web service method executes its code, eventually setting the return value and any out parameters.
- The infrastructure on the Web server serializes the return value and out parameters into a SOAP message and sends it over the network back to the client.
- The XML Web service infrastructure, on the client computer, receives the SOAP message, deserializes the XML into the return value and any out parameters, and passes them to the instance of the proxy class.
- The client receives the return value and any out parameters.