A binding has operations that are not unique

A recent WSDL warning encountered:
            WS-I: (BP2120) A binding has operations that are not unique.
 
This warning comes up when two or more messages point are similar and point to the same element definition. For example take following example –

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="c" targetNamespace="http://www.myservice.com"
xmlns:tns="http://www.myservice.com"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
            <wsdl:types>
                        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" targetNamespace="http://www.myservice.com">
 
                                    <xsd:element name="element1" type="xsd:string">
                                    </xsd:element>
                                    <xsd:element name="element2"
                                    type="xsd:string"></xsd:element>
                                    <xsd:element name="element3"
                                    type="xsd:string"></xsd:element>
                                    <xsd:element name="element4"
                                    type="xsd:string"></xsd:element>
                        </xsd:schema>
            </wsdl:types>
 
            <wsdl:message name="message1">
                        <wsdl:part name="in" element="tns:element1"></wsdl:part>
            </wsdl:message>
            <wsdl:message name="message2">
                        <wsdl:part name="out" element="tns:element1"></wsdl:part>
            </wsdl:message>
            <wsdl:message name="message3">
                        <wsdl:part name="in" element="tns:element3"></wsdl:part>
            </wsdl:message>
            <wsdl:message name="message4">
                        <wsdl:part name="out" element="tns:element4"></wsdl:part>
            </wsdl:message>
           
            <wsdl:portType name="MyPortType">
                        <wsdl:operation name="op1">
                                    <wsdl:input message="tns:message1"></wsdl:input>
                                    <wsdl:output message="tns:message2"></wsdl:output>
                        </wsdl:operation>
                        <wsdl:operation name="op2">
                                    <wsdl:input message="tns:message3"></wsdl:input>
                                    <wsdl:output message="tns:message4"></wsdl:output>
                        </wsdl:operation>
            </wsdl:portType>
           
            <wsdl:binding name="MyBinding" type="tns:MyPortType">
                        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
                        <wsdl:operation name="op1">
                                    <soap:operation />
                                    <wsdl:input>
                                                <soap:body use="literal" />
                                    </wsdl:input>
                                    <wsdl:output>
                                                <soap:body use="literal" />
                                    </wsdl:output>
                        </wsdl:operation>
                        <wsdl:operation name="op2">
                                    <soap:operation />
                                    <wsdl:input>
                                                <soap:body use="literal"/>
                                    </wsdl:input>
                                    <wsdl:output>
                                                <soap:body use="literal"/>
                                    </wsdl:output>
                        </wsdl:operation>
            </wsdl:binding>
            <wsdl:service name="MyService">
                        <wsdl:port name="MyPort" binding="tns:MyBinding">
                                    <soap:address location="http://www.myservice.com" />
                        </wsdl:port>
            </wsdl:service>
</wsdl:definitions>

 

WSDL looks perfectly alright. Though there is a small glitch – message1 and message2 are using the same element type. And warning comes at line:

<wsdl:binding name="MyBinding" type="tns:MyPortType">

Though our example is perfectly aligned with code-reusability principal and for very large projects, it is the best approach to follow but the WSDL conventions expect you to have distinct element declared corresponding to every message in WSDL.

Yea, I agree with you that it is a debatable topic!

 

Another common warning is –

WS-I: A problem occured while running the WS-I WSDL conformance check: org.eclipse.wst.wsi.internal.analyzer.WSIAnalyzerException: The WS-I Test Assertion Document (TAD)document was either not found or could not be processed.The WSDLAnalyzer was unable to validate the given WSDL File.

It comes when Eclipse is unable to download TAD libraries because of various reasons.

Leave a Reply

Your email address will not be published.