2011-02-08 2 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. Когда я запускаю файл WSDL через что-то вроде SoapUI я получаю следующий результат как запрос мыльный ...

<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

Спасибо за ответ, когда я пытаюсь что появляется на выходе, как ... <нс: OTA_VehAvailRateRQ />

+0

Действительно? Это не должно быть так. Он должен добавить вокруг него тег «Запрос». – Vanwaril

+0

Фактически, это действительно сработало, я просто не обновил файл WSDL, чтобы указать на элемент запроса, а не на элемент OTA_VehAvailRateRQ. Благодарю. –

Смежные вопросы