camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atg roxx <atgr...@gmail.com>
Subject Re: Camel Jaxb- Not able to unmarshall a xml
Date Mon, 16 Apr 2012 10:58:22 GMT
Hi Arnaud Deprez,

The auto generated files have the structure as you suggested. except the
child element does not have the
@XmlType(..., namespace = "ns3") //or use @XmlRootElement(namespace =
"ns3")  as suggested by you.

But I tried adding those things as suggest by you still I am not able to
marshall or unmarshall properly.


--Cheers,
atg roxx




On Mon, Apr 16, 2012 at 8:20 AM, DEPREZ Arnaud AWL-IT <
arnaud.deprez@atos.net> wrote:

> Hi !
>
> In your class GetProductPriceOffers, you should have your variable partner
> and request declared with the matching namespace :
>
> @...
> @XmlRootElement(namespace = "ns1")
> Public class GetProductPriceOffers
> {
>        @...
>        @XmlElement(namespace = "ns2")
>        Partner partner;
>        @XmlElement(namespace = "ns3")
>        Request request;
> }
>
> @XmlType(..., namespace = "ns2") //or use @XmlRootElement(namespace =
> "ns2")
> Public class Partner { ... }
>
> @XmlType(..., namespace = "ns3") //or use @XmlRootElement(namespace =
> "ns3")
> Public class Request { ... }
>
> I'm pretty sure that your problem comes from a wrong configuration of your
> model.
> Can you check if you have this kind of configuration ?
>
> KR,
>
> Arnaud Deprez
>
>  please don't print unless you really need to
>
> -----Original Message-----
> From: atg roxx [mailto:atgroxx@gmail.com]
> Sent: vendredi 13 avril 2012 17:11
> To: users@camel.apache.org
> Subject: Re: Camel Jaxb- Not able to unmarshall a xml
>
> Hi Arnaud,
>
> Yes we have different namespace   for GetProductPriceOffers and
> partner/request element also the classes corresponding to them have their
> respective namespace.
>
> Still I am not able unmarshall.
>
> My Camel Version is 2.8.2
> I am doing marshalling and unmarshalling in the following way:
> from(Constants.ROUTE_GETPRODUCTPRICEOFFERS)
> .to(Constants.LOG_IN_INFO_WITH_HEADERS)
> .convertBodyTo(String.class)
> .unmarshal(jaxbGetProductPriceOffersRequest)
>                        .to(Constants.LOG_IN_INFO_WITH_HEADERS)
> .marshal(jaxbGetProductPriceOffersRequest)
> .log("after marshalling")
> .to(Constants.LOG_IN_INFO_WITH_HEADERS)
>  .process(new MondialRequestProcessor(userId, password))
>  .log("Finished processing
> "+MondialConstants.GETPRODUCTPRICEOFFERS+Constants.LOG_CORRELATIONID);
>
>
> --cheers,
> atg roxx
> On Fri, Apr 13, 2012 at 12:20 PM, DEPREZ Arnaud AWL-IT <
> arnaud.deprez@atos.net> wrote:
>
> > Maybe it's a problem of namespaces.
> >
> > Can you tell me if you use different namespaces for GetProductPriceOffers
> > and partner/request element ?
> > If they are different, it must be specified in your JAXB java class
> model.
> >
> > KR,
> >
> > Arnaud Deprez
> >
> >
> > -----Original Message-----
> > From: Christian Müller [mailto:christian.mueller@gmail.com]
> > Sent: vendredi 13 avril 2012 12:58
> > To: users@camel.apache.org
> > Subject: Re: Camel Jaxb- Not able to unmarshall a xml
> >
> > Which version of Camel do you use?
> > How do you use the JAXB Marschaller/Unmarschaller (explicitly or via the
> > FallbackTypeConverter)?
> > Could you share your code?
> >
> > Best,
> > Christian
> >
> > Sent from a mobile device
> > Am 13.04.2012 12:45 schrieb "atg roxx" <atgroxx@gmail.com>:
> >
> > > Hi Guys,
> > >
> > > I am facing a problem.
> > >
> > > I am using camel jaxb to marshall and unmarshall java objects which is
> > > working fine for me till now.
> > > But now I got a special case where I am not able to properly unmarshall
> > an
> > > xml whose class have mulitple namespace (different for root element and
> > sub
> > > elements).
> > >
> > > sample xml :
> > >
> > > Class corresponding to each <element> is having different namespace.
> > >
> > > I am using JaxbDataFormat for this unmarshalling and setting the
> > partclass
> > > name to the root element.
> > >
> > > <GetProductPriceOffers>
> > >  <partner>
> > >            <Password>abc</Password>
> > >            <UserID>xyz</UserID>
> > >         </partner>
> > >
> > > <request>
> > >  <HotelDetails>
> > > <HotelAddress>
> > > <City />
> > > <Country>GB</Country>
> > > <PostalCode />
> > > <Region>GB</Region>
> > > </HotelAddress>
> > > <HotelChain>Sample Hotel Chain</HotelChain>
> > > <HotelCheckinDate>2011-08-19T04:55:02-04:00</HotelCheckinDate>
> > > <HotelCheckoutDate>2011-08-24T04:55:02-04:00</HotelCheckoutDate>
> > > <HotelName>Mariott</HotelName>
> > > <HotelRating>5</HotelRating>
> > > <NumberOfAdultTravelers>1</NumberOfAdultTravelers>
> > > <NumberOfInfantTravelers>0</NumberOfInfantTravelers>
> > > <NumberOfKidTravelers>0</NumberOfKidTravelers>
> > > <NumberOfRooms>1</NumberOfRooms>
> > > <NumberOfSeniorTravelers>0</NumberOfSeniorTravelers>
> > > <NumberOfYouthTravelers>2</NumberOfYouthTravelers>
> > > </HotelDetails>
> > >  </request>
> > > </GetProductPriceOffers>
> > >
> > >
> > >
> > > I am able to unmarshall it but when i check the object created, I found
> > > that the <request> and <partner> object are not set to values in
the
> xml
> > > but are set to null.
> > >
> > >
> > > Could anyone let me know what can be the issue or how to resolve this .
> > >
> > >
> > > --cheers,
> > > atg roxx
> > >
> >
> >
> > Atos Worldline SA/NV - Chaussee de Haecht 1442 Haachtsesteenweg
> > - 1130 Brussels - Belgium
> > RPM-RPR Bruxelles-Brussel - TVA-BTW BE 0418.547.872
> > Bankrekening-Compte Bancaire-Bank Account 310-0269424-44
> > BIC BBRUBEBB - IBAN BE55 3100 2694 2444
> >
> > "The information contained in this e-mail and any attachment thereto is
> > confidential and may contain information which is protected by
> intellectual
> > property rights.
> > This information is intended for the exclusive use of the recipient(s)
> > named above.
> > This e-mail does not constitute any binding relationship or offer toward
> > any of the addressees.
> > If you are not one of the addressees , one of their employees or a proxy
> > holder entitled to hand over this message to the addressee(s), any use of
> > the information contained herein (e.g. reproduction, divulgation,
> > communication or distribution,...) is prohibited.
> > If you have received this message in error, please notify the sender and
> > destroy it immediately after.
> > The integrity and security of this message cannot be guaranteed and it
> may
> > be subject to data corruption, interception and unauthorized amendment,
> for
> > which we accept no liability."
> >
> >
>
>
> Atos Worldline SA/NV - Chaussee de Haecht 1442 Haachtsesteenweg
> - 1130 Brussels - Belgium
> RPM-RPR Bruxelles-Brussel - TVA-BTW BE 0418.547.872
> Bankrekening-Compte Bancaire-Bank Account 310-0269424-44
> BIC BBRUBEBB - IBAN BE55 3100 2694 2444
>
> "The information contained in this e-mail and any attachment thereto is
> confidential and may contain information which is protected by intellectual
> property rights.
> This information is intended for the exclusive use of the recipient(s)
> named above.
> This e-mail does not constitute any binding relationship or offer toward
> any of the addressees.
> If you are not one of the addressees , one of their employees or a proxy
> holder entitled to hand over this message to the addressee(s), any use of
> the information contained herein (e.g. reproduction, divulgation,
> communication or distribution,...) is prohibited.
> If you have received this message in error, please notify the sender and
> destroy it immediately after.
> The integrity and security of this message cannot be guaranteed and it may
> be subject to data corruption, interception and unauthorized amendment, for
> which we accept no liability."
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message