Skip to main content

Creating Custom SOAP Messages

In special cases, you may want a web client to send a custom SOAP message. The essential requirements are as follows:

  1. Create a subclass of %SOAP.WebRequestOpens in a new tab and set its LOCATION parameter or Location property.

  2. In this subclass, create a method to send a SOAP message. This method must create an instance of %Library.CharacterStreamOpens in a new tab and place into it the SOAP message you want to send. It is your responsibility to ensure that the message is correctly formed.

  3. The method must next invoke the SendSOAPBody() method:

    method SendSOAPBody(Action As %String, 
                        OneWay As %Boolean = 0, 
                        Request As %CharacterStream, 
                        ByRef Response) as %Status
    
    • Action is a string that gives the name of SOAP action to perform.

    • OneWay is a true/false flag that controls whether the message is one way.

    • Request is an instance of %Library.CharacterStreamOpens in a new tab that contains the body of the SOAP request in the character set of the current locale.

    • Response is the response, returned by reference either as a character stream or an instance of %XML.NodeOpens in a new tab.

      If Response is null when you invoke SendSOAPBody(), then the method sets Response equal to an instance of %Library.CharacterStreamOpens in a new tab. This stream contains the body of the SOAP response in the character set of the current locale.

      If Response is an instance of %Library.CharacterStreamOpens in a new tab when you invoke SendSOAPBody(), then the method updates Response to contain the body of the SOAP response in the character set of the current locale.

      If Response is an instance of %XML.NodeOpens in a new tab when you invoke SendSOAPBody(), then the method updates Response to point to the body DOM.

%SOAP.WebRequestOpens in a new tab is a subclass of %SOAP.WebClientOpens in a new tab, so you may want to set other parameters and properties. You can also add SOAP headers as described elsewhere. See the class documentation for %SOAP.WebRequestOpens in a new tab for further notes.

FeedbackOpens in a new tab