在WSDL中包含XSD

时间:2016-10-19 09:37:05

标签: xml web-services soap xsd wsdl

我正在编写一个wsdl文件来在futur(SoapUI)中部署模拟服务但是我有一个问题要包含我的xsd文件。

XSD档案

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1">
    <!--Déclaration des types complexes -->
    <xs:complexType name="TSujet">
        <xs:sequence>
            <xs:element name="identifiant" type="xs:string"/>
            <xs:element name="libelleCourt" type="xs:string"/>
            <xs:element name="libelleLong" type="xs:string"/>
            <xs:element name="incidents">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="incident" type="TRefIncident" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TRefIncident">
        <xs:sequence>
            <xs:element name="identifiant" type="xs:string"/>
            <xs:element name="libelle" type="xs:string"/>
            <xs:element name="erreursConnues">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="erreurConnue" type="TErreurConnue" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TErreurConnue">
        <xs:sequence>
            <xs:element name="identifiant" type="xs:string"/>
            <xs:element name="texte" type="xs:string"/>
            <xs:element name="documents">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="document" type="TDocument" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TDocument">
        <xs:sequence>
            <xs:element name="identifiant" type="xs:string"/>
            <xs:element name="type" type="xs:string"/>
            <xs:element name="contenu" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TUtilisateur">
        <xs:sequence>
            <xs:element name="login" type="xs:string"/>
            <xs:element name="nom" type="xs:string"/>
            <xs:element name="prenom" type="xs:string"/>
            <xs:element name="codePoste" type="xs:string"/>
            <xs:element name="telephone" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <!-- Déclaration des éléments -->
    <xs:complexType name="TTheme">
        <xs:sequence>
            <xs:element name="identifiant" type="xs:string"/>
            <xs:element name="libelleCourt" type="xs:string"/>
            <xs:element name="libelleLong" type="xs:string"/>
            <xs:element name="top" type="xs:string" minOccurs="0" maxOccurs="5"/>
            <xs:element name="sujets">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="sujet" type="TSujet" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TTicket">
        <xs:sequence>
            <xs:element name="identifiant" type="xs:string"/>
            <xs:element name="libelle" type="xs:string"/>
            <xs:element name="date" type="xs:string"/>
            <xs:element name="document" type="xs:string"/>
            <xs:element name="objet" type="xs:string"/>
            <xs:element name="description" type="xs:string"/>
            <xs:element name="destinataire" type="xs:string"/>
            <xs:element name="statut" type="xs:string"/>
            <xs:element name="commentaire" type="xs:string"/>
            <xs:element name="refIncident" type="TRefIncident"/>
            <xs:element name="utilisateur" type="TUtilisateur"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TNews">
        <xs:sequence>
            <xs:element name="identifiant" type="xs:string"/>
            <xs:element name="libelle" type="xs:string"/>
            <xs:element name="description" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TIncidentDeMasse">
        <xs:sequence>
            <xs:element name="identifiant" type="xs:string"/>
            <xs:element name="libelle" type="xs:string"/>
            <xs:element name="description" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

WSDL文件

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/passerelle/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="passerelle" targetNamespace="http://www.example.org/passerelle/">

  <wsdl:types>
    <xsd:schema targetNamespace="http://www.example.org/passerelle/">
      <include schemaLocation="schema.xsd"/>
    </xsd:schema>
  </wsdl:types>

  <wsdl:message name="getAllCatalogueResponse">
    <wsdl:part name="catalogue" type="tns:TTheme"/>
  </wsdl:message>
  <wsdl:message name="createTicketRequest">
    <wsdl:part name="data" type="tns:TTicket"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="createTicketResponse">
    <wsdl:part name="return" type="xsd:string"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="getTicketsRequest">
    <wsdl:part name="idUser" type="xsd:string"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="getTicketsResponse">
    <wsdl:part name="tickets" type="tns:TTicket"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="getMessagesResponse">
    <wsdl:part name="incidents" type="tns:TIncidentDeMasse"></wsdl:part>
    <wsdl:part name="news" type="tns:TNews"></wsdl:part>
  </wsdl:message>

  <wsdl:portType name="passerelle">
    <wsdl:operation name="getAllCatalogue">
      <wsdl:output message="tns:getAllCatalogueResponse"/>
    </wsdl:operation>
    <wsdl:operation name="createTicket">
        <wsdl:input message="tns:createTicketRequest"></wsdl:input>
        <wsdl:output message="tns:createTicketResponse"></wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getTickets">
        <wsdl:input message="tns:getTicketsRequest"></wsdl:input>
        <wsdl:output message="tns:getTicketsResponse"></wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getMessages">
        <wsdl:output message="tns:getMessagesResponse"></wsdl:output>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="passerelleSOAP" type="tns:passerelle">
    <soap:binding style="document"
        transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="getAllCatalogue">
        <soap:operation
            soapAction="http://www.example.org/passerelle/getAllCatalogue" />
        <wsdl:input>
            <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal" />
        </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="createTicket">
        <soap:operation
            soapAction="http://www.example.org/passerelle/createTicket" />
        <wsdl:input>
            <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal" />
        </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getTickets">
        <soap:operation
            soapAction="http://www.example.org/passerelle/getTickets" />
        <wsdl:input>
            <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal" />
        </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getMessages">
        <soap:operation
            soapAction="http://www.example.org/passerelle/getMessages" />
        <wsdl:output>
            <soap:body use="literal" />
        </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="passerelle">
    <wsdl:port binding="tns:passerelleSOAP" name="passerelleSOAP">
      <soap:address location="http://www.example.org/"/>
    </wsdl:port>
  </wsdl:service>

</wsdl:definitions>

你有什么建议吗?如何知道文件是否包含在内?我使用Eclipse编辑它们。

0 个答案:

没有答案