Skip to main content

SoapBindingStyle (Class Keyword)

Specifies the binding style or SOAP invocation mechanism used by any web methods defined in this class. Applies only in a class that is defined as a web service or web client.

Usage

To specify the binding style used by any web methods defined in this class, use the following syntax:

Class MyApp.MyClass [ SoapBindingStyle = soapbindingstyle ]  { //class members }

Where soapbindingstyle is one of the following:

  • document (default) — Web methods in this class use document-style binding by default.

    With this binding style, the SOAP messages are formatted as documents and typically have only one part.

    In the SOAP messages, the <Body> element typically contains a single child element. Each child of the <Body> element corresponds to a message part.

  • rpc — Web methods in this class use RPC (remote procedure call)-style binding by default.

    With this binding style, the SOAP messages are formatted as messages with multiple parts.

    In the SOAP messages, the <Body> element contains a single child element whose name is taken from the corresponding operation name. This element is a generated wrapper element, and it contains one child element for each argument in the argument list of the method.

If SoapBindingStyle is document and if ARGUMENTSTYLE is message, then the message style is very similar to RPC; see Creating Web Services and Web Clients.

Important:

For a web service that you create manually, the default value of this keyword is usually suitable. When you generate a web client or service from a WSDL with the SOAP Wizard, InterSystems IRIS sets this keyword as appropriate for that WSDL; if you modify the value, your web client or service may no longer work.

Details

This keyword lets you specify the default binding style used by any web methods defined in this class. It affects the format of the SOAP body (but not any SOAP headers).

You can override the binding style for individual methods, by using the SoapBindingStyle method keyword or the SoapBindingStyle query keyword.

Effect on Subclasses

This keyword is not inherited.

Default

The default value is document. (Chapter 7 of the SOAP standard v1.1Opens in a new tab, Using SOAP for RPC, specifies that web methods should use RPC-style binding. However, most SOAP clients, including .NET, use document-style binding.)

Relationship to WSDL

The SoapBindingStyle class keyword specifies the value of the style attribute of <soap:binding> element within the <binding> section of the WSDL. For example, if SoapBindingStyle is document, the WSDL could look as follows:

...
<binding ...>
    <soap:binding ... style="document"/>
    <operation ...>
        <soap:operation ... style="document"/>
...

As shown here, the SoapBindingStyle class keyword also specifies the default value of the style attribute of the <soap:operation> element, within the <binding> section of the WSDL; this attribute is further controlled by the SoapBindingStyle method keyword.

In contrast, if SoapBindingStyle is rpc, the WSDL could instead be as follows:

...
<binding ...>
    <soap:binding ... style="rpc"/>
    <operation ...>
        <soap:operation ... style="rpc"/>
...

The binding style also affects the <message> elements, as follows:

  • If the binding style is document, a message has only one part by default. For example:

    <message name="AddSoapIn">
        <part name="parameters" .../>
    </message>
    

    If the ARGUMENTSTYLE parameter is message, then a message can have multiple parts. For example:

    <message name="AddSoapIn">
       <part name="a" .../>
       <part name="b" .../>
    </message>
    
    
  • If the binding style is rpc, a message can have multiple parts. For example:

    <message name="AddSoapIn">
        <part name="a" .../>
        <part name="b" .../>
    </message>
    

Effect on SOAP Messages

The primary effect on SOAP messages is to control whether the SOAP body can contain multiple subelements.

For a web method that uses a RPC-style binding and encoded-style messages, the following shows an example of the body of a possible request message:

<SOAP-ENV:Body SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
   <types:Add>
      <a href="#id1" /><b href="#id2" />
   </types:Add>
   <types:ComplexNumber id="id1" xsi:type="types:ComplexNumber">
      <Real xsi:type="s:double">10</Real>
      <Imaginary xsi:type="s:double">5</Imaginary>
   </types:ComplexNumber>
   <types:ComplexNumber id="id2" xsi:type="types:ComplexNumber">
      <Real xsi:type="s:double">17</Real>
      <Imaginary xsi:type="s:double">2</Imaginary>
   </types:ComplexNumber>
</SOAP-ENV:Body>

In contrast, the following shows an example of the body of a possible request message for a web method that uses literal binding and encoded-style messages:

<SOAP-ENV:Body>
   <tns:Add>
      <tns:a xsi:type="tns:ComplexNumber">
         <Real xsi:type="s:double">10</Real>
         <Imaginary xsi:type="s:double">5</Imaginary>
      </tns:a>
      <tns:b xsi:type="tns:ComplexNumber">
         <Real xsi:type="s:double">17</Real>
         <Imaginary xsi:type="s:double">2</Imaginary>
      </tns:b>
      </tns:Add>
</SOAP-ENV:Body>

In this case, the SOAP body has a single subelement.

Use With %XML.DataSet

For objects of type %XML.DataSetOpens in a new tab, not all permutations of the SoapBindingStyle and SoapBodyUse keywords are permitted, as the following table summarizes:

  SoapBodyUse=literal (default) SoapBodyUse=encoded
SoapBindingStyle=document(default) supported not supported
SoapBindingStyle=rpc supported supported

See Also

FeedbackOpens in a new tab