Hi Javier,

The problem here is that the generated xsd doesn't match the binding. 
The binding <namespace> element has default="all", which is rarely what 
you want to use in practice. Change to using default="elements" and your 
binding should match the schema definition.

XMLSpy does a pretty simple-minded job on generating the skeleton XML, 
incidentally. It should at least put in valid values for each of the 
elements and attributes based on the schema definition, rather than 
leaving them empty (which is not valid for numeric values, or date 
values, or basically anything other than xsd:string).

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Javier Diaz wrote:
> Hi Varghese
>
> Thanks a lot for your response. We've been always using XMLSpy as a
> quick client to test our web services. Below is the SOAP request XMLSpy
> is generating:
>
> ------------------------------------------------------------------------
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> xmlns:m0="http://dcgws.lastminute.com/dcgws";>
>       <SOAP-ENV:Body>
>               <m:Availability
> xmlns:m="http://dcgws.lastminute.com/DirectConnectGatewayWS/dcgws.xsd";>
>                       <m0:AVRQ SAGT="" CLID="" ADTS="" CHDS="" INFS=""
> DIRO="" MAXF="" BSPC="">
>                               <m0:ROTS>
>                                       <m0:ROUT DEPT="" DEST="" CARR=""
> CABC="" DATE="" TIME=""/>
>                               </m0:ROTS>
>                               <m0:INCS>
>                                       <m0:SUPL>String</m0:SUPL>
>                               </m0:INCS>
>                       </m0:AVRQ>
>               </m:Availability>
>       </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> ------------------------------------------------------------------------
>
> And this is the error, I got for this request:
>
> ------------------------------------------------------------------------
> <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 77, in
> AVRQ)</faultstring>
>               </soap:Fault>
>       </soap:Body>
> </soap:Envelope>
> ------------------------------------------------------------------------
>
>
> If I add m0: to each of the attributes, then I got this 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: Empty number value (line 4,
> col 101, in AVRQ)</faultstring>
>               </soap:Fault>
>       </soap:Body>
> </soap:Envelope>
> ------------------------------------------------------------------------
>
> I also tried changing the default value to "elements" as you suggested
> but the wsdl being generated is the same, so same errors.
>
> Thanks a lot for your help
>
> Javier
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Varghese
> C V
> Sent: 13 April 2007 07:09
> To: JiBX users
> Subject: Re: [jibx-users] Problems with "attribute" style
>
> Could you post a sample xml that you use to test the binding?
>
> The namespace element at the binding level is configured to be attached 
> to both elements as well as attributes. Could it be that the input xml 
> does not have namespaces specified at the attribute level? Jibx is 
> expecting an attribute of the form dcgws:SAGT="foo". Try setting the 
> namespace elements default value to 'elements'.
>
> Hope this helps.
> Varghese C V
>
> Javier Diaz wrote:
>   
>> 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=DEVDE
> V
>   
> ------------------------------------------------------------------------
>   
>> _______________________________________________
>> jibx-users mailing list
>> jibx-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>   
>>     
>
>
> ------------------------------------------------------------------------
> -
> 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=DEVDE
> V
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
> -------------------------------------------------------------------------
> 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
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to