web-serviceswsdlws-i

What does the WS-I BP2012 assertion mean?


Can somebody explain what this actually means? An example would be really helpful.

WS-I: (BP2012) A document-literal binding contains soapbind:body elements that refer to message part elements that do not have the element attribute.


Solution

  • This message is related to the WS-I Basic Profile, which attempts to clarify the subset of WSDL and other specifications that are generally interoperable.

    In this case, BP2012 is associated with the following:

    A document-literal binding in a DESCRIPTION MUST refer, in each of its wsoap12:body element(s), only to wsdl:part element(s) that have been defined using the element attribute.

    You would typically see this if one of the messages used in your web service is defined in terms of a type instead of an element, for example:

    <wsdl:message name="MyMessage">
        <wsdl:part name="MyPart" type="xsd:string"/>
    </wsdl:message>
    

    To fix this, you will need to change your message so that the part is defined in terms of an element, something like:

    <wsdl:types>
        <xsd:schema targetNamespace="http://www.example.com/"
            xmlns:xsd="http://www.w3.org/1999/XMLSchema">
            <xsd:element name="MyElement" type="xsd:string"/>
        </xsd:schema>
    </wsdl:types>
    
    <wsdl:message name="MyMessage">
        <wsdl:part name="MyPart" element="tns:MyElement" xmlns:tns="http://www.example.com/"/>
    </wsdl:message>
    

    Alternatively, you may want to switch your web service from using a document/literal binding to using an rpc/literal binding. With an rpc/literal binding, parts are defined in terms of a type instead of an element.