2015-05-04 5 views
0

Я столкнулся с проблемой с созданным JAXWS XML, содержащим нежелательные xsi: type и xsi: schema tags.I прочитал другие темы, но ни один из них мне не помог , В моем случае, у меня есть только WSDL и XSDs и я использую JAXWS-Maven-плагин для генерации кода из WSDL (который включает в себя XSDs)JAXWS-maven-plugin генерирует xsi: type и xmlns: xsi в сгенерированном xml

конфигурация 1) JAXWS-Maven-плагин:

  <plugin> 
       <groupId>org.jvnet.jax-ws-commons</groupId> 
       <artifactId>jaxws-maven-plugin</artifactId> 
       <executions> 
        <execution> 
         <goals> 
          <goal>wsimport</goal> 
         </goals> 
         <configuration> 
          <bindingDirectory>${basedir}/src/main/wsdl</bindingDirectory> 
          <bindingFiles><bindingFile>Booking_normalized/Booking_1.0.1.0.xjb</bindingFile> 
       </bindingFiles> 
          <wsdlDirectory>${basedir}/src/main/wsdl</wsdlDirectory> 
          <wsdlFiles> 
           <wsdlFile>Booking_normalized/Booking_1.0.1.0.wsdl</wsdlFile> 
          </wsdlFiles> 
          <target>2.1</target> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 

2) XSD (внедренная в WSDL):

<xs:complexType name="ScheduleQueryType"> 
     <xs:annotation> 
      <xs:documentation>Describes a Schedule</xs:documentation> 
     </xs:annotation> 
     <xs:sequence> 
      <xs:element name="start" type="ScheduleQueryTypestart"/> 
      <xs:element name="end" type="ScheduleQueryTypeend"/> 
     </xs:sequence> 
    </xs:complexType> 

    <xs:complexType name="ScheduleQueryTypestart"> 
     <xs:annotation> 
      <xs:documentation xml:lang="en"> 
        The start element contains the origin locationCode and departure dateTime 
       </xs:documentation> 
     </xs:annotation> 
     <xs:complexContent> 
      <xs:extension base="DateTimeLocationType"> 
       <xs:attribute name="windowBefore" type="xs:duration" use="optional"> 
        <xs:annotation> 
         <xs:documentation xml:lang="en">A period of time that can be applied to another time resulting in an earlier range of time.</xs:documentation> 
        </xs:annotation> 
       </xs:attribute> 
       <xs:attribute name="windowAfter" type="xs:duration" use="optional"> 
        <xs:annotation> 
         <xs:documentation xml:lang="en">A period of time that can be applied to another time resulting in a later range of time.</xs:documentation> 
        </xs:annotation> 
       </xs:attribute> 
      </xs:extension> 
     </xs:complexContent> 
    </xs:complexType> 
    <xs:complexType name="ScheduleQueryTypeend"> 
     <xs:annotation> 
      <xs:documentation xml:lang="en"> 
        The end element contains the destination locationCode and arrival dateTime. 
       </xs:documentation> 
     </xs:annotation> 
     <xs:complexContent> 
      <xs:extension base="DateTimeLocationType"> 
       <xs:attribute name="windowBefore" type="xs:duration" use="optional"> 
        <xs:annotation> 
         <xs:documentation xml:lang="en">A period of time that can be applied to another time resulting in an earlier range of time.</xs:documentation> 
        </xs:annotation> 
       </xs:attribute> 
       <xs:attribute name="windowAfter" type="xs:duration" use="optional"> 
        <xs:annotation> 
         <xs:documentation xml:lang="en">A period of time that can be applied to another time resulting in a later range of time.</xs:documentation> 
        </xs:annotation> 
       </xs:attribute> 
      </xs:extension> 
     </xs:complexContent> 
    </xs:complexType> 
    <xs:complexType name="DateTimeLocationType"> 
     <xs:annotation> 
      <xs:documentation xml:lang="en">Describes DateTime and Location</xs:documentation> 
     </xs:annotation> 
     <xs:sequence> 
      <xs:element name="locationCode" minOccurs="0"> 
       <xs:annotation> 
        <xs:documentation xml:lang="en">Code used to identify a location</xs:documentation> 
       </xs:annotation> 
       <xs:complexType> 
        <xs:simpleContent> 
         <xs:extension base="ota:StringLength1to16"> 
          <xs:attribute name="type" type="ota:AlphaNumericStringLength1to8" use="optional"> 
           <xs:annotation> 
            <xs:documentation>Type of location code</xs:documentation> 
           </xs:annotation> 
          </xs:attribute> 
         </xs:extension> 
        </xs:simpleContent> 
       </xs:complexType> 
      </xs:element> 
     </xs:sequence> 
     <xs:attribute name="dateTime" type="ota:DateOrDateTimeType"> 
      <xs:annotation> 
       <xs:documentation>Date and optional time</xs:documentation> 
      </xs:annotation> 
     </xs:attribute> 
     <xs:attribute name="locationName" type="ota:StringLength1to64" use="optional"> 
      <xs:annotation> 
       <xs:documentation xml:lang="en">Name of the location</xs:documentation> 
      </xs:annotation> 
     </xs:attribute> 
    </xs:complexType> 

3) Сгенерированный XML:

<ns5:Schedule> 
      <ns5:Segment TID="SEG_1" Inventory="FRR"> 
       <ns2:start xsi:type="ns2:ScheduleQueryTypestart" dateTime="2015-05-06" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
        <ns2:locationCode type="NLS">FRPLY</ns2:locationCode> 
       </ns2:start> 
       <ns2:end xsi:type="ns2:ScheduleQueryTypeend" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
        <ns2:locationCode type="NLS">FRLPD</ns2:locationCode> 
       </ns2:end> 
       <ns2:serviceProvider Code="SNF"/> 
       <ns2:identifier>6609</ns2:identifier> 
      </ns5:Segment> 
     </ns5:Schedule> 

Как вы можете видеть выше, в Generated XML начало и конец тегов содержит теги xmlns: xsi и xsi: type. Я хочу избавиться от них. Какие-либо предложения?

Обратите внимание: другие элементы в созданном XML в порядке (они не содержат префикса xsi).

Вот это не просто преобразование типа (который был бы решен с помощью связывания javaType. Это больше, используя сложный тип. Может быть действительно проблемой плагина или есть что-то не так с моей XSD?

Спасибо.

ответ

0

По-видимому, начальный и конечный типы были использованы более чем для одного типа. Извините, что я не мог упомянуть весь XSD здесь, это было бы найдено раньше. [Мы также отметили, что строитель, который мы использовали было несколько вопросов]. Поэтому JAXB пришлось поместить атрибут типа, чтобы сделать различие.

Проблема найдена d разрешено.

Спасибо всем.

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

  • Нет связанных вопросов^_^