java - wsdl 绑定(bind)未定义

标签 java wsdl wsdl2java

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

The operation specified for the 'DictionaryServiceServiceSoapBinding' binding is not defined for port type 'DictionaryService'. All operations specified in this binding must be defined in port type '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>

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

最佳答案

尝试为每个消息/部分指定不同的名称 <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>

关于java - wsdl 绑定(bind)未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17287048/

相关文章:

java - Java从文件中读取数据

java - 15个java益智游戏

java - CXF 2.7 给出 common.ToolException : Non unique body parts error

java - SOAP 故障异常 : WSS1601: Security Requirements not met

authentication - 在gradle中设置任务以从经过身份验证的WSDL下载并生成Java类

java - cxf:cxf-codegen-plugin:2.1.2:wsdl2java 失败:索引 2 处不透明部分中的非法字符

java - Guice:在默认构造函数中使用注入(inject)的类作为局部变量

java - spring JPA查询与spel表达式随机

c# - Asp.NET Web API 中的 Controller 和类列表

java - 多种 AlgorithmSuite 策略 WS-SecurityPolicy CXF