我正在尝试编写一个具有内联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。部分参数&#39;有一个无效的值&#39;员工&#39;为其元素定义。元素声明必须引用模式中定义的有效值。
部分&#39;参数&#39;具有无效值&#39; EmployeeResponse&#39;为其元素定义。元素声明必须引用模式中定义的有效值。
答案 0 :(得分:0)
回答我的问题是命名空间存在问题。一旦我更正了名称空间,就解决了以下错误:
&#34;部分&#39;参数&#39;有一个无效的值&#39;员工&#39;为其元素定义。元素声明必须引用模式中定义的有效值。&#34;
&#34;部分&#39;参数&#39;具有无效值&#39; EmployeeResponse&#39;为其元素定义。元素声明必须引用模式中定义的有效值。&#34;