Workshop SOAP:style Semantics

Workshop SOAP:style Semantics

For FeaturedNPOQueryService, we employed SOAP:style="document"; this is illustrated in the following WSDL fragment. The corresponding SOAP request and response messages were shown in Figure 8-12.

<operation name="getCampaigns">
    <soap:operation style="document"
        <soap:body use="literal"/>
        <soap:body use="literal"/>

Recall that the request-response operation is an abstract notion; therefore the vendor implementation will dictate whether messages are sent within a single HTTP request-response, or as two independent HTTP requests. WebLogic Web service deployment descriptor allows you to specify an operation:invocation-style attribute that can take the values "one-way" or "request-response"; for FeaturedNPOQueryService, we use invocation-style="request-response". Note that the XML document "getCampaignsResponse" in the SOAP body in Figure 8-12 is converted to its Java equivalent by the deserialization mechanisms generated by the vendor tool; please refer to section "Creating Serialization Classes" for the type-mapping construct created by the tool. Document-oriented Web service operations use literal encoding, which implies that the message elements described in WSDL reference a concrete schema using the type attribute.

If we had employed SOAP:style="rpc", the resulting SOAP messages will follow the representation stated in section 7.1 of the SOAP specification; the data types marshalled across the wire follow a set of encoding rules described in Section 5 of the SOAP specification, which has the namespace identifier "" (also called SOAP encoding). Changing SOAP:style to "rpc" will yield the following response:

<SOAP-ENV:Envelope xmlns:SOAP-ENC=""
      <m:getCampaignsResponse xmlns:m=""
         <getCampaignsResult SOAP-ENC:arrayType="types:FeaturedNPODTO[2]"
               <startDate xsi:type="xsd:string">2004-12-01</startDate>
               <regionCode xsi:type="xsd:string">NORCAL</regionCode>
               <ein xsi:type="xsd:string">94-0385620</ein>
               <endDate xsi:type="xsd:string">2004-12-26</endDate>
               xsi:type="xsd:string">California Historical Society</npoName>
               <startDate xsi:type="xsd:string">2004-01-01</startDate>
               <regionCode xsi:type="xsd:string">NORCAL</regionCode>
               <ein xsi:type="xsd:string">94-3045430</ein>
               <endDate xsi:type="xsd:string">2004-04-30</endDate>
               xsi:type="xsd:string">American Red Cross Bay Area</npoName>

Because other encoding schemes are possible for representing data types, the SOAP ‘encodingStyle’ attribute can be used to indicate the encoding style of the method call and the response. Using SOAP for RPC is orthogonal to the SOAP protocol binding (please refer to the Sample WSDL discussed previously for FeaturedNPOQueryService). When using HTTP as the protocol binding, an RPC call maps to an HTTP request and an RPC response maps to an HTTP response.