Specifying Custom Transport for a Web Service
By default, an InterSystems IRIS® data platform web service responds to transport in a specific way, described here. You can customize this behavior.
When an InterSystems IRIS web service receives a SOAP message, it executes its OnSOAPRequest() class method. By default, this method does the following:
Initializes the web service instance by calling its Initialize() method. This method parses the inbound SOAP message, returns several pieces of information by reference, and processes the security header. See the documentation for the %SOAP.WebServiceOpens in a new tab class.
Sets properties of the web service instance, such as SoapFault and others.
Initializes the response stream.
Invokes the Process() method of the web service, passing to it the SOAP action and the method to invoke.
Resets the web service instance by calling its Reset() method.
Copies the result into the response stream.
Defining Custom Transport for a Web Service
To implement a web service using your own transport, get the SOAP message as a stream using your transport, instantiate the web service class and call its OnSOAPRequest() class method.
The OnSOAPRequest() method must transport the request to the web service and obtain the response. To indicate an error, it must return a SOAP fault in the response stream. The signature of this method must be as follows:
Method OnSOAPRequest(action,requestStream, responseStream)
action is a %StringOpens in a new tab that specifies the SOAP action. The piece of the action string after the last "." is used as the method name for using the correct descriptor class. If action is null, then the element name from the first element (the wrapping element) in the SOAP body is used as the method name.
requestStream is a stream that contains the SOAP request message encoded according to the encoding attribute of the XML directive.
responseStream is a character stream produced as the SOAP response that contains the response SOAP message encoded in UTF-8. You can create this argument before calling OnSOAPRequest() and passed it in with the method call. Or this argument can be a variable passed by reference. In this case, OnSOAPRequest() must set it equal to an instance of %FileCharacterStreamOpens in a new tab that contains the response.