Hi everyone

 

We are having problems using the style "attribute". Basically when we
use "element" style, everything works perfect, but when we change to use
attribute we got the following error. 

 

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

      <soap:Body>

            <soap:Fault>

                  <faultcode>soap:Server</faultcode>

                  <faultstring>Could not read Jibx type.. Nested
exception is org.jibx.runtime.JiBXException: Missing required attribute
"{http://dcgws.lastminute.com/dcgws}SAGT"; (line 4, col 53, in
AVRQ)</faultstring>

            </soap:Fault>

      </soap:Body>

</soap:Envelope>

 

Below I'm including the binding file and the .xsd file which is being
generated using the jibx generator. We are using Jibx-Xfire

 

We really want to use attribute instead of element to reduce the size of
our messages.  

 

Are we missing something in the binding? Any help will be really
appreciated.

 

 

Binding file

<?xml version="1.0" encoding="UTF-8"?>

 

<binding forwards="false" value-style="attribute">

    <namespace uri="http://dcgws.lastminute.com/dcgws"; prefix="dcgws"
default="all"/>

 

    <mapping
class="com.lastminute.dcg.api.messaging.availability.AvailabilityRequest
" name="AVRQ">

        <value style="attribute" name="SAGT" set-method="setSubagent"
get-method="getSubagent"/>

        <value style="attribute" name="CLID" set-method="setClientId"
get-method="getClientId"/>

        <value style="attribute" " name="ADTS" set-method="setAdults"
get-method="getAdults"/>

        <value style="attribute" name="CHDS" set-method="setChildren"
get-method="getChildren"/>

        <value style="attribute" name="INFS" set-method="setInfants"
get-method="getInfants"/>

        <value style="attribute" name="DIRO" set-method="setDirectOnly"
get-method="getDirectOnly" usage="optional" default="0"/>

        <value style="attribute" name="MAXF" set-method="setMaxNumFares"
get-method="getMaxNumFares" usage="optional"/>

        <value style="attribute" name="BSPC" set-method="setBestPrice"
get-method="getBestPrice" usage="optional"/>

        <structure field="routing" name="ROTS">

            <collection field="routes">

                <structure name="ROUT"
type="com.lastminute.dcg.api.messaging.common.Route">

                    <value style="attribute" name="DEPT"
get-method="getOrigin" set-method="setOrigin"/>

                    <value style="attribute" name="DEST"
get-method="getDestination" set-method="setDestination"/>

                    <value style="attribute" name="CARR"
get-method="getCarrier" set-method="setCarrier"/>

                    <value style="attribute" name="CABC"
get-method="getCabinClass" set-method="setCabinClass"/>

                    <value style="attribute" name="DATE"
get-method="getDate" set-method="setDate"/>

                    <value style="attribute" name="TIME"
get-method="getTime" set-method="setTime"/>

                </structure>

            </collection>

        </structure>

        <structure field="includeSuppliers" name="INCS">

            <collection field="suppliers" item-type="java.lang.String"
type="java.util.ArrayList">

                <value style="element" name="SUPL"/> 

            </collection>

        </structure>

    </mapping>

 

    <mapping
class="com.lastminute.dcg.api.messaging.availability.AvailabilityRespons
e" name="AVRS">

        <value style="element" name="RES" set-method="setResult"
get-method="getResult" usage="optional"/>

    </mapping>

</binding>

 

The .xsd file

<?xml version="1.0" encoding="UTF-8"?><schema
xmlns="http://www.w3.org/2001/XMLSchema";
xmlns:tns="http://dcgws.lastminute.com/dcgws";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified"
targetNamespace="http://dcgws.lastminute.com/dcgws";>

 

  <!-- Created from mapping for class
com.lastminute.dcg.api.messaging.availability.AvailabilityRequest -->

  <element name="AVRQ">

    <complexType>

      <sequence>

        <element name="ROTS">

          <complexType>

            <sequence>

              <element maxOccurs="unbounded" minOccurs="0" name="ROUT">

                <complexType>

                  <sequence/>

                  <attribute name="DEPT" type="xsd:string"
use="required"/>

                  <attribute name="DEST" type="xsd:string"
use="required"/>

                  <attribute name="CARR" type="xsd:string"
use="required"/>

                  <attribute name="CABC" type="xsd:string"
use="required"/>

                  <attribute name="DATE" type="xsd:string"
use="required"/>

                  <attribute name="TIME" type="xsd:string"
use="required"/>

                </complexType>

              </element>

            </sequence>

          </complexType>

        </element>

        <element name="INCS">

          <complexType>

            <sequence>

              <element maxOccurs="unbounded" minOccurs="0" name="SUPL"
type="xsd:string"/>

            </sequence>

          </complexType>

        </element>

      </sequence>

      <attribute name="SAGT" type="xsd:string" use="required"/>

      <attribute name="CLID" type="xsd:string" use="required"/>

      <attribute name="ADTS" type="xsd:int" use="required"/>

      <attribute name="CHDS" type="xsd:int" use="required"/>

      <attribute name="INFS" type="xsd:int" use="required"/>

      <attribute name="DIRO" type="xsd:int"/>

      <attribute name="MAXF" type="xsd:int"/>

      <attribute name="BSPC" type="xsd:int"/>

    </complexType>

  </element>

 

  <!-- Created from mapping for class
com.lastminute.dcg.api.messaging.availability.AvailabilityResponse -->

  <element name="AVRS">

    <complexType>

      <sequence>

        <element minOccurs="0" name="RES" type="xsd:string"/>

      </sequence>

    </complexType>

  </element>

</schema>

 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to