1

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

未为端口类型“DictionaryService”定义为“DictionaryServiceServiceSoapBinding”绑定指定的操作。此绑定中指定的所有操作都必须在端口类型“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>

我尝试了自己,但找不到答案。

4

1 回答 1

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>
于 2013-06-25T00:40:35.343 回答