Hi Deepak
Looking at the schema, it uses different namespaces for the wrapper
element (defined in the WSDL) and the imported elements (defined in the
XSD). Your binding definition only includes the one namespace.
The recommended approach is to use codegen to create the bindings and
code. Here is how to extract the schema from the WSDL and generate the
bindings and code using codegen. You can then use these bindings and
code for your JiBX/WS web service.
* Download the WSDL from
http://webservices.ticketvala.com/axis2/services/WSTicketvala?wsdl. Name
this file WSTicketvalaWSDL.xsd (the name doesn't matter).
* Extract just the <xsd:schema> element from this WSDL (by deleting
everything before <xsd:schema>, and everything after </xsd:schema>).
* Download the referenced imported XSD from
http://webservices.ticketvala.com/axis2/services/WSTicketvala?xsd=webservices.xsd.
Name this file WSTicketvala.xsd.
* Change the import statement in WSTicketvalaWSDL.xsd to reference
the downloaded XSD file:
<xsd:import namespace="http://travis.com/webservices"
schemaLocation="WSTicketvala.xsd"/>
* Follow the instructions at
http://jibx.sourceforge.net/fromschema/codegen.html to generate
the binding and code from the schema, for example:
java -cp ..\..\lib\jibx-tools.jar org.jibx.schema.codegen.CodeGen -t
target WSTicketvalaWSDL.xsd
* This will generate Java classes and binding files in the target
folder. You can copy these to your project folder (or setup an
Ant or Maven build to generate and build the code for you).
* If required, see the codegen reference documentation for how to
customise the generated code (eg. to only include wsGetCityRequest
and wsGetCityResponse)
cheers
Nigel
On 04/04/11 08:08, Deepak Singh wrote:
Hi Nigel,
i added the namespace as follows
<?xml version="1.0" encoding="UTF-8"?>
<binding direction="input" trac-source="true" add-constructors="true"
xmlns:ns1="http://travis.com/webservices" name="binding"
trim-whitespace="true">
<namespace uri="http://travis.com/webservices" default="elements" />
<mapping name="wsGetCityResponse"
class="com.jibx.gwt.shared.GetCityResponse">
<structure name="wsGetCityRS">
<collection field="listOfCities"
factory="com.jibx.gwt.shared.GetCityResponse.getArrayList">
<structure name="city" type="com.jibx.gwt.shared.CityResponse">
<value name="cityId" field="cityId" usage="optional"></value>
<value name="cityName" field="cityName" usage="optional"></value>
<value name="stateId" field="stateId" usage="optional"></value>
<value name="stateName" field="stateName" usage="optional"></value>
<value name="countryId" field="countryId" usage="optional"></value>
<value name="countryName" field="countryName" usage="optional"></value>
</structure>
</collection>
</structure>
</mapping>
</binding>
But still the same error i am getting. I checked that in isolation,
unmarshalling is happening properly.
I could not sort out the problem. Kindly help on this. If you want i
would post the entire code again.
Thanks
Deepak
----------------------------------------------------------------------
Message: 1
Date: Thu, 17 Mar 2011 16:17:52 +1300
From: Nigel Charman <nigel.charman.nz
<http://nigel.charman.nz>@gmail.com <http://gmail.com>>
Subject: Re: [jibx-users] No handlers could be found for unmarshalling
the SOAP body payload
To: JiBX users <jibx-users@lists.sourceforge.net
<mailto:jibx-users@lists.sourceforge.net>>
Message-ID: <4d817d60.1080...@gmail.com
<mailto:4d817d60.1080...@gmail.com>>
Content-Type: text/plain; charset="utf-8"
Hi Deepak
You'll need to add namespace definitions to the binding file for the
SOAP response, as well as the SOAP request.
Calling SoapClient.setInBodyBindingFactory(..) sets up a handler
for the
SOAP body using the supplied binding factory. The message is
indicating
that the SOAP body can not be parsed using this binding - presumably
since there is no namespace defined in your binding. If you still
have
problems, please check that JiBX can unmarshall the payload of the
SOAP
body in isolation.
This exercise would have been simpler using Dennis' initial
recommendation to extract the schemas from the WSDL yourself, then to
use codegen to create the data model code and bindings. Having a tool
to automate the generation directly from WSDL is on our backlog..
cheers
Nigel
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users