The service program designated in the {{StartService}} tag is activated when that tag is processed. However, the contents of the request may not yet be available in the exchange file. It is for this reason that the service program calls B_ReadRequest to wait for the request to be made available.
When the request becomes available, B_ReadRequest returns control to the service program. At that point, the request XML document that is in the exchange file may be imported, using XML Extensions, into the service program's working-storage data area. A provided XSLT style sheet transformation is applied when the only expected request is a SOAP web service request. (Note that a more flexible service program might import the request XML document more than once, in order to determine what kind of request was being presented.)
After the request document is imported, the service program acts upon the request and produces a response, which is placed in the exchange file. Note that this response does not have to be an XML document (for some examples see below) but in the case of a SOAP response, it is the entire SOAP response envelope.
After the response is in the exchange file, the service program signals this fact by calling B_WriteResponse. In a stateless web service environment, the call should include the option that indicates that the session should be terminated. The service program then terminates in a normal, orderly manner.