2013-06-24 44 views
1

我是WSDL的新手,嘗試驗證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> 

我想我自己也沒有找到答案。

回答

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>