简单的WSDL错误“部分”为其元素定义了无效值”。元素声明必须引用架构中定义的有效值”

时间:2018-07-06 07:52:15

标签: soap xsd wsdl

我正在尝试编写一个具有内联xsd的简单wsdl文件。但是我在wsdl文件中收到以下标记为“ *”的错误。我提到了另一个Stack Overflow问题,但是在这个问题上没有任何帮助。我刚刚编辑了xsd和wsdl文件,以在每个文件中包含名称空间以获取有关文件的更多详细信息。您可能需要注意,这是我在本地计算机上创建的文件。以下是我的代码。

        xsd file:


         <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/bookService" xmlns:tns="http://www.example.org/bookService" elementFormDefault="qualified">
     <element name="BookServiceRequest"
     type="tns:BookServiceRequestType">
     </element>

     <complexType name="BookServiceRequestType">
     <sequence>
     <element name="limit" type="int"></element>
     </sequence>
     </complexType>

     <complexType name="BookServiceResponseType">
     <sequence>
     <element name="book" type="tns:BookType" maxOccurs="unbounded" minOccurs="0"></element>
     </sequence>
     </complexType>

     <element name="BookServiceResponse"
     type="tns:BookServiceResponseType">
     </element>

     <complexType name="BookType">
     <sequence>
     <element name="title" type="string" maxOccurs="1" minOccurs="1"></element>
     <element name="author" type="string" maxOccurs="1" minOccurs="1"></element>
     <element name="published" type="date" maxOccurs="1" minOccurs="1"></element>
     </sequence>
     </complexType>
    </schema>

          wsdl file:        
            <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions name="bookService"
     targetNamespace="http://www.example.org/bookService/" xmlns:tns="http://www.example.org/bookService/"
     xmlns:wsdl="http://www.example.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
     <wsdl:types>
     <xsd:schema targetNamespace="http://www.example.org/bookService/">
     <xsd:import schemaLocation="../schema/bookService.xsd"
     namespace="http://www.example.org/bookService/" />
     </xsd:schema>
     </wsdl:types>
     <wsdl:message name="BookServiceRequest">
     **<wsdl:part name="BookServiceRequest" element="tns:BookServiceRequest" />
     </wsdl:message>**
     <wsdl:message name="BookServiceResponse">
     **<wsdl:part name="BookServiceResponse" element="tns:BookServiceResponse" />**
     </wsdl:message>
     <wsdl:portType name="BookServicePortType">
     <wsdl:operation name="fetchBooks">
     <wsdl:input name="BookServiceRequest" message="tns:BookServiceRequest" />
     <wsdl:output name="BookServiceResponse" message="tns:BookServiceResponse" />
     </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="BookServiceBinding" type="tns:BookServicePortType">
     <soap:binding style="document"
     transport="http://schemas.xmlsoap.org/soap/http" />
     <wsdl:operation name="fetchBooks">
     <soap:operation style="document"
     soapAction="http://www.example.org/bookService/fetchBooks" />
     <wsdl:input name="BookServiceRequest">
     <soap:body use="literal" />
     </wsdl:input>
     <wsdl:output name="BookServiceResponse">
     <soap:body use="literal" />
     </wsdl:output>
     </wsdl:operation>
     </wsdl:binding>
     <wsdl:service name="BookService">
     <wsdl:port name="BookServicePort" binding="tns:BookServiceBinding">
     <soap:address location="/service/bookService" />
     </wsdl:port>
     </wsdl:service>

0 个答案:

没有答案