0
我正在嘗試編寫一個簡單的帶有內聯xsd的wsdl文件。 我與下面的錯誤顯示。我引用其他stackoverflow問題,但沒有幫助在這個問題上。任何幫助表示讚賞。 下面是代碼簡單的WSDL顯示錯誤「此綁定中指定的所有操作必須在端口類型中定義」
<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.零件的「參數」中爲其元素定義了一個無效值'Employee'。元素聲明必須引用架構中定義的有效值。
零件'參數'的元素定義了無效值'EmployeeResponse'。元素聲明必須引用架構中定義的有效值。
- 未爲端口類型'addEmployeePortType'定義爲'addEmp_Binding'綁定指定的操作。在此綁定中指定的所有操作必須是在端口類型'addEmployeePortType'中定義的 。