wsdl绑定未定义

时间:2013-06-24 23:56:20

标签: java wsdl wsdl2java

我是WSDL的新手,并尝试验证WSDL。我必须从WSDL生成代码。我收到以下错误

  

为'DictionaryServiceServiceSoapBinding'指定的操作   没有为端口类型'DictionaryService'定义绑定。所有   必须在端口类型中定义此绑定中指定的操作   'DictionaryService'。

以下是我的WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="DictionaryService" targetNamespace="http://dictionaryservice.example.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://dictionaryservice.example.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://dictionaryservice.example.com/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://dictionaryservice.example.com/">
            <xs:element name="addDataToDict" type="tns:addDataToDict"/>
            <xs:element name="addDataToDictResponse" type="tns:addDataToDictResponse"/>
            <xs:complexType name="addDataToDict">
                    <xs:sequence>
                        <xs:element name="identifier" type="xs:string"/>
                        <xs:element name="description" type="xs:string"/>
                        <xs:element name="uri" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
                <xs:complexType name="addDataToDictResponse">
                    <xs:sequence>
                        <xs:element name="status" type="xs:boolean"/>
                    </xs:sequence>
                </xs:complexType>


                <xs:element name="listOfAllIndexes" type="tns:listOfAllIndexes"/>
                <xs:element name="listOfAllIndexesResponse" type="tns:listOfAllIndexesResponse"/>
                <xs:complexType name="listOfAllIndexes">
                    <xs:sequence>                       
                    </xs:sequence>
                </xs:complexType>
                <xs:complexType name="listOfAllIndexesResponse">
                    <xs:sequence>
                        <xs:element name="list" type="tns:listData"/>
                    </xs:sequence>
                </xs:complexType>



                <xs:element name="getDictByIndex" type="tns:getDictByIndex"/>
                <xs:element name="getDictByIndexResponse" type="tns:getDictByIndexResponse"/>
                <xs:complexType name="getDictByIndex">
                    <xs:sequence>
                        <xs:element name="index" type="xs:integer"/>                        
                    </xs:sequence>
                </xs:complexType>
                <xs:complexType name="getDictByIndexResponse">
                    <xs:sequence>
                            <xs:element name="data" type="tns:dictData"/>
                    </xs:sequence>
                </xs:complexType>



                <xs:complexType name="listData">
                    <xs:sequence>
                        <xs:element name="identifier" type="xs:integer"/>
                        <xs:element name="index" type="xs:integer"/>                        
                    </xs:sequence>
                </xs:complexType>


                <xs:complexType name="dictData">
                    <xs:sequence>
                        <xs:element name="identifier" type="xs:string"/>
                        <xs:element name="description" type="xs:string"/>
                        <xs:element name="uri" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>

        </xs:schema>
    </wsdl:types>


    <wsdl:message name="addDataToDict">
        <wsdl:part name="NewPart" type="tns:addDataToDict"></wsdl:part>
    </wsdl:message>

    <wsdl:message name="addDataToDictResponse">
        <wsdl:part name="NewPart" type="tns:addDataToDictResponse"></wsdl:part>
    </wsdl:message>

    <wsdl:message name="listOfAllIndexes">
        <wsdl:part name="NewPart" type="tns:listOfAllIndexes"></wsdl:part>
    </wsdl:message>

    <wsdl:message name="listOfAllIndexesResponse">
        <wsdl:part name="NewPart" type="tns:listOfAllIndexesResponse"></wsdl:part>
    </wsdl:message>

    <wsdl:message name="getDictByIndex">
        <wsdl:part name="NewPart" type="tns:getDictByIndex"></wsdl:part>
    </wsdl:message>

    <wsdl:message name="getDictByIndexResponse">
        <wsdl:part name="NewPart" type="tns:getDictByIndexResponse"></wsdl:part>
    </wsdl:message>



    <wsdl:portType name="DictionaryService">
        <wsdl:operation name="addDataToDict">
            <wsdl:input  message="tns:addDataToDict"></wsdl:input>
            <wsdl:output message="tns:addDataToDictResponse"></wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="listOfAllIndexes">
            <wsdl:input message="tns:listOfAllIndexes"></wsdl:input>
            <wsdl:output message="tns:listOfAllIndexesResponse"></wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getDictByIndex">
            <wsdl:input message="tns:getDictByIndex"></wsdl:input>
            <wsdl:output message="tns:getDictByIndexResponse"></wsdl:output>
        </wsdl:operation>   
    </wsdl:portType>

    <wsdl:binding name="DictionaryServiceServiceSoapBinding" type="tns:DictionaryService">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
            <wsdl:operation name="addDataToDict">
              <soap:operation soapAction="" style="document"/>
                  <wsdl:input name="addDataToDict">
                    <soap:body use="literal"/>
                  </wsdl:input>
                <wsdl:output name="addDataToDictResponse">
                    <soap:body use="literal"/>
                </wsdl:output>      
            </wsdl:operation>

            <wsdl:operation name="listOfAllIndexes">
              <soap:operation soapAction="" style="document"/>
                  <wsdl:input name="listOfAllIndexes">
                    <soap:body use="literal"/>
                  </wsdl:input>
                <wsdl:output name="listOfAllIndexesResponse">
                    <soap:body use="literal"/>
                </wsdl:output>      
            </wsdl:operation>

            <wsdl:operation name="getDictByIndex">
              <soap:operation soapAction="" style="document"/>
                  <wsdl:input name="getDictByIndex">
                    <soap:body use="literal"/>
                  </wsdl:input>
                <wsdl:output name="getDictByIndexResponse">
                    <soap:body use="literal"/>
                </wsdl:output>      
            </wsdl:operation>

    </wsdl:binding>


    <wsdl:service name="DictionaryService">
        <wsdl:port name="DictionaryServicePort" binding="tns:DictionaryServiceServiceSoapBinding">
            <soap:address location="http://localhost:9090/DictionaryServicePort"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

我试过自己,却找不到答案。

1 个答案:

答案 0 :(得分:0)

尝试为每条消息/部分<wsdl:part name="NewPart" .....>提供不同的名称,例如

<wsdl:message name="addDataToDict">
    <wsdl:part name="AddDataToDictRequestPart" type="tns:addDataToDict"></wsdl:part>
</wsdl:message>

<wsdl:message name="addDataToDictResponse">
    <wsdl:part name="addDataToDictResponsePart" type="tns:addDataToDictResponse"></wsdl:part>
</wsdl:message>