docs.intersystems.com
Home  /  Application Development: Using Adapters and Gateways in Productions  /  Adding SOAP Services and Web Clients to Productions  /  Older Web Service Variation


Adding SOAP Services and Web Clients to Productions
Older Web Service Variation
[Back]  [Next] 
InterSystems: The power behind what matters   
Search:  


In previous releases, an InterSystems IRIS™ web method could not directly call SendRequestSync(), SendRequestAsync(), or SendDeferredResponse(). An alternative approach was needed. This appendix provides the details, for the benefit of anyone who is maintaining code that uses this alternative approach.
Overview
In previous releases, an InterSystems IRIS web method could not directly call SendRequestSync(), SendRequestAsync(), or SendDeferredResponse(). Instead, there were two requirements for a production web service, in addition to the requirements discussed earlier in this book:
The following figure shows the overall flow of request messages in this scenario:
Implementing the OnProcessInput() Method
The OnProcessInput() method has the following signature:
Method OnProcessInput(pInput As %RegisteredObject,
                      ByRef pOutput As %RegisteredObject,
                      ByRef pHint As %String) As %Status
Here:
  1. pInput is the request message that you are sending.
  2. pOutput is the response message that is sent in return.
  3. pHint is an optional string that you can use to decide how to handle the InterSystems IRIS request; see the subsection Using the pHint Argument.”
The following shows an example:
Method OnProcessInput(pInput As %RegisteredObject, ByRef pOutput As %RegisteredObject) As %Status
{
    set sc= ..SendRequestSync("Lookup",pInput,.pOutput)
    Quit sc
}
Using the pHint Argument
If a web service defined multiple methods, and you wanted to send them to different destinations within the production, you used the optional hint argument of the ProcessInput() and OnProcessInput() methods, as follows:
  1. When you invoke ProcessInput(), you used a value for the hint argument to indicate which web method is making this call. For example:
    Method GetCustomerInfo(ID As %Numeric) As ESOAP.SOAPResponse [ WebMethod ]
    {
        //create request message with given ID
        set request=##class(ESOAP.CustomerRequest).%New()
        set request.CustomerID=ID
    
        //send request message
        //ProcessInput() calls OnProcessInput(), which actually
        //sends the message
        set sc=..ProcessInput(request,.response,"GetCustomerInfo")
    ...
    
        quit soapresponse
    }
    
  2. Within OnProcessInput(), you used the hint argument to determine the flow. For example:
    Method OnProcessInputAlt(pInput As %RegisteredObject,
    ByRef pOutput As %RegisteredObject, pHint As %String) As %Status
    {
        if pHint="GetCustomerInfo"{
            set sc= ..SendRequestSync("GetCustomerInfoBO",pInput,.pOutput)
            }
        elseif pHint="GetStoreInfo" {
                set sc= ..SendRequestSync("GetStoreInfoBO",pInput,.pOutput)
        }
        Quit sc
    }