【问题标题】:Simple WSDL showing error "All operations specified in this binding must be defined in port type "显示错误“此绑定中指定的所有操作必须在端口类型中定义”的简单 WSDL
【发布时间】:2016-08-27 02:48:59
【问题描述】:

我正在尝试编写一个具有内联 xsd 的简单 wsdl 文件。 我显示以下错误。我提到了其他 stackoverflow 问题,但没有人帮助解决这个问题。感谢任何帮助。 下面是代码

<wsdl:types>
    <!-- <xsd:schema targetNamespace="http://www.example.org/createEmployee/">
        <xsd:import schemaLocation="..\schema\Employee.xsd"/>
    </xsd:schema> -->
    <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
                targetNamespace="http://www.example.org/Employee" 
                xmlns:tns="http://www.example.org/Employee" elementFormDefault="qualified"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="Employee" type="tns:EmployeeRequestType"></xsd:element>

<xsd:complexType name="EmployeeRequestType">
    <xsd:all>
        <xsd:element name="fname" type="string" maxOccurs="1" minOccurs="1"></xsd:element>
        <xsd:element name="lname" type="string" maxOccurs="1" minOccurs="1"></xsd:element>
        <xsd:element name="salary" type="double" maxOccurs="1" minOccurs="1"></xsd:element>
        <xsd:element name="type" type="string" maxOccurs="1" minOccurs="1"></xsd:element>
    </xsd:all>
</xsd:complexType>

<xsd:element name="EmployeeResponse" type="tns:EmployeeResponseType"></xsd:element>

<xsd:complexType name="EmployeeResponseType">
    <xsd:all>
        <xsd:element name="EmpId" type="string" maxOccurs="1" minOccurs="1">
        </xsd:element>
        <xsd:element name="type" type="string" maxOccurs="1" minOccurs="1"></xsd:element>
    </xsd:all>
</xsd:complexType>

<wsdl:message name="addEmployeeRequest">
    **<wsdl:part name="parameters" element="tns:Employee"/>**
</wsdl:message>
<wsdl:message name="addEmployeeResponse">
    **<wsdl:part name="parameters" element="tns:EmployeeResponse"/>**
</wsdl:message>

<wsdl:portType name="addEmployeePortType">
    <wsdl:operation name="addEmployee">
        <wsdl:input message="tns:addEmployeeRequest"/>
        <wsdl:output message="tns:addEmployeeResponse"/>
    </wsdl:operation>
</wsdl:portType>

<wsdl:binding name="addEmp_Binding" type="tns:addEmployeePortType">
    <soap:binding style="document"
        transport="http://schemas.xmlsoap.org/soap/http" />

    <wsdl:operation name="addEmployee">
        **<soap:operation style="document" soapAction="http://www.example.org/createEmployee/addEmployee" />**
        <wsdl:input name="addEmployeeRequest">
            <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output name="addEmployeeResponse">
            <soap:body use="literal" />
        </wsdl:output>
    </wsdl:operation>

    </wsdl:binding>

<wsdl:service name="addEmployeeService">
    <wsdl:port name="addEmployeePort" binding="tns:addEmp_Binding">
        <soap:address
            location="http://localhost:8080/service/addEmployee" />
    </wsdl:port>
</wsdl:service>

错误:

Below are the errors at highlighted 

1。 “参数”部分为其元素定义了无效值“员工”。元素声明必须引用架构中定义的有效值。

  1. “参数”部分为其元素定义的“员工响应”值无效。元素声明必须引用架构中定义的有效值。

    1. 为“addEmp_Binding”绑定指定的操作没有为端口类型“addEmployeePortType”定义。此绑定中指定的所有操作都必须是 在端口类型“addEmployeePortType”中定义。

【问题讨论】:

    标签: java web-services soap xsd wsdl


    【解决方案1】:

    我的问题的答案是命名空间存在问题。更正命名空间后,以下错误得到解决:

    1. ““参数”部分为其元素定义了无效值“员工”。元素声明必须引用架构中定义的有效值。”

    2. “'parameters' 部分为其元素定义了无效值 'EmployeeResponse'。元素声明必须引用架构中定义的有效值。”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-30
      • 2015-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多