Udostępnij za pośrednictwem


Standard SOAP Message Formats Specified Using WSDL

This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation.

The industry-standard Web Services Description Language (WSDL), which defines a schema for XML documents that in turn define Web services, offers two central SOAP formatting options. Both options are specified in XML elements not in the primary WSDL namespace, https://schemas.xmlsoap.org/wsdl/, but rather in the namespace https://schemas.xmlsoap.org/wsdl/soap/. This secondary namespace commits a Web service to the SOAP protocol.

SOAP Formatting Options

The two formatting options are:

  • Style: For the child element, and possibly the grandchildren, of the Body element in a SOAP message. This is specified as the style attribute of a binding WSDL element (typically) or an operation element.

  • Use: For the Web service method parameters, or a return value, that appear at the next level down. This is specified as the use attribute of a body element.

For details on the SOAP specification, see the W3C Web site (http://www.w3.org/TR/SOAP). Details on the WSDL specification can also be found at the W3C Web site ().

Allowed Values of the Style Attribute

WSDL allows two values for the style attribute that controls overall SOAP body formatting:

  • RPC: Parameters, or a return value, are automatically placed in a parent element whose own parent is the SOAP Body element. The parameters or return value appear without namespace qualification. This scheme is described in Section 7 of the SOAP 1.1 specification. Specified style="rpc".

    For a SOAP request, the element below the SOAP Body is named after a WSDL operation element, which corresponds to Web service method. Each element within that element represents a parameter and is named after its respective parameter.

    For a SOAP response, the name of the element below the SOAP Body is the operation name with Response appended. The name of the element underneath, representing the return value, is the operation name but with the suffix Return.

  • Document: The contents of the SOAP Body element are fully specified in the WSDL as XML elements defined in an XML Schema definition. The XML schema is specified in, or imported into, the WSDL document. The WSDL is oblivious to parameters and return values; it only deals with XML documents. The developer, or preferably the Web services infrastructure, takes care of how parameters and return values translate into XML Schema elements and types. Specified style="document".

    The top-level XML elements are specified as message parts -- part elements that are defined in a message element and point to XSD element declarations. Normally, there is no more than one part, so that the SOAP Body contents are truly an XML document, although WSDL itself doesn't prohibit multiple elements.

WSDL allows two values for the use attribute that controls parameter, and return value, formatting:

  • Encoded: Data is formatted according to a scheme is described in Section 5 of the SOAP 1.1 specification. SOAP encoding uses a subset of the XML Schema for binding between XML documents and the data they represent. SOAP encoding also employs references for elements that appear multiple times in a document. Specified use="encoded".

  • Literal: Data is formatted literally according to XML Schema definitions specified in, or imported into, the WSDL document. Specified use="literal".

See Also

Other Resources

Customizing SOAP Message Formatting