Caché Class Definition Reference
SoapBindingStyle
|
|
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.
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
}
-
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.
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, Caché sets this keyword as appropriate for that WSDL; if you modify the value, your web client or service may no longer work.
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).
This keyword is not inherited.
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>
<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>
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.