2011-02-08 92 views
0

我有一個包含以下內容的XSD文件...嘗試一個額外的元素添加到XSD文件

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" id="OTA2003A" targetNamespace="http://www.opentravel.org/OTA/2003/05" version="1.000" xmlns="http://www.opentravel.org/OTA/2003/05"> 

    <xs:element name="OTA_VehAvailRateRQ"> 
    <xs:annotation> 
     <xs:documentation>The root tag of OTA_VehAvailRateRQ contains standard payload attributes found in all OTA payload documents. Because the results of the search message could be quite numerous, the request also has an attribute, MaxResponses, indicating the number of replies requested. The attribute ReqRespVersion is a positive integer value that indicates the version number requested for the response message.</xs:documentation> 
    </xs:annotation> 
    <xs:complexType> 
     <xs:sequence> 
     <xs:element name="POS" type="POS_Type"> 
      <xs:annotation> 
      <xs:documentation>Point of Sale Identification. Identification number of the vendor that has made the vehicle availability request and agency number assigned by IATA, ARC, ESRP or TID.</xs:documentation> 
      </xs:annotation> 
     </xs:element> 
     <xs:element name="VehAvailRQCore" type="VehicleAvailRQCoreType"> 
      <xs:annotation> 
      <xs:documentation>Identifies the common, or core, information associated with the request for availability of a rental vehicle.</xs:documentation> 
      </xs:annotation> 
     </xs:element> 
     <xs:element minOccurs="0" name="VehAvailRQInfo" type="VehicleAvailRQAdditionalInfoType"> 
      <xs:annotation> 
      <xs:documentation>Identifies the supplemental information associated with the request for availability of a rental vehicle.</xs:documentation> 
      </xs:annotation> 
     </xs:element> 
     </xs:sequence> 
     <xs:attributeGroup ref="OTA_PayloadStdAttributes"/> 
     <xs:attributeGroup ref="ReqRespVersion"/> 
     <xs:attributeGroup ref="MaxResponsesGroup"/> 
    </xs:complexType> 
    </xs:element> 

我則在WSDL文件中引用此。當我通過類似了SoapUI運行WSDL文件我得到以下輸出爲SOAP請求......

<soap:Body> 
    <OTA_VehAvailRateRQ EchoToken="XXX1234" Version="1.0" ReqRespVersion="medium" MaxResponses="16" xmlns="http://www.opentravel.org/OTA/2003/05">  
     ... 
     ... 
     ... 
    </OTA_VehAvailRateRQ> 
</soap:Body> 

...到目前爲止,一切都很好。現在我需要添加一個元素到XSD文件,以便它會產生以下輸出...

<soap:Body> 
    <ns:Request xmlns:ns="http://someurl"> 
     <OTA_VehAvailRateRQ EchoToken="XXX1234" Version="1.0" ReqRespVersion="medium" MaxResponses="16" xmlns="http://www.opentravel.org/OTA/2003/05"> 
      ... 
      ... 
      ... 
     </OTA_VehAvailRateRQ> 
    </ns:Request> 
</soap:Body> 

...注意那裏的額外標記。這是我掙扎的地方。有誰知道我應該如何修改原始的XSD來生成額外的標籤?當我嘗試出現的輸出

回答

1

像這樣的事情會在外面OTA_VehAvailRateRQ創建請求標籤

<xs:schema xmlns:xs=...> 

<xs:element name="Request"> 
<xs:complexType><xs:sequence> 
    <xs:element name="OTA_VehAvailRateRQ"> 
    ... 
    </xs:element> 
</xs:sequence></xs:complexType> 
</xs:element> 
+0

感謝您的答覆,因爲... 2011-02-08 10:13:33

相關問題