Hi Marko,

Thanks for the help, but I am doing this unmarshalling in webservice client 
created using JAXRSClientFactoryBean.

How can I add providers in the webservice client.

Thanks,
Abhishek

-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]] 
Sent: Wednesday, April 04, 2012 4:50 PM
To: [email protected]
Subject: Re: Unmarshalling interceptor

Hi Marko,

thanks for this tip, it could be an issue to deal with in scope of WS 
requests, and CXF JAXB DataBinding used by JAX-WS may already offer such 
an option,
however, it's definitely worth updating JAXBElementProvider with the 
Listener property :-). it is possibele to set a ValidationEventHandler 
on it, but not the Listener

Thanks, Sergey
On 04/04/12 14:12, Voß, Marko wrote:
> Hello Abhishek Sharma,
>
> I think this is a JAXB issue. You can register a Listener to the Unmarshaller.
>
> http://docs.oracle.com/javase/6/docs/api/javax/xml/bind/Unmarshaller.html
> http://docs.oracle.com/javase/6/docs/api/javax/xml/bind/Unmarshaller.Listener.html
>
> There are also some examples in the Javadoc of the possibilities.
>
> In order to get this working with CXF, you need to extend the 
> JAXBElementProvider:
>
> (org.apache.cxf.jaxrs.provider.JAXBElementProvider)
>
> Example:
>
> public class MyJAXBElementProvider extends JAXBElementProvider {
>
>     // override the methods here like:
>     protected Unmarshaller createUnmarshaller(Class<?>  cls, Type 
> genericType, boolean isCollection) {
>       Unmarshaller u = super.createUnmarshaller(cls, genericType, 
> isCollection);
>       u.setListener(MY_LISTENER);
>       return u;
>     }
> }
>
> Now, register the provider:
>
> <jaxrs:server id="RestServices" address="">
>       <jaxrs:providers>
>         <ref bean="MyJaxbProvider"/>
>       </jaxrs:providers>
> </jaxrs:server>
>
>
> Best regards,
>
> Marko
>
> Am 04.04.2012 12:56, schrieb Abhishek Sharma:
>> Hi,
>>
>> I've a requirement when writing a CXF client. In my webservice response I am 
>> getting a list of myData object.
>>
>> Now I want some group data by iterating over the entire list. The problem is 
>> size of the list is high so I don't want to
>> iterate again.
>>
>> I know the unmarshaller used by the client is doig the same when converting 
>> XML to object. If somehow I can intercept
>> while unmarshal and calculate group data then I don't have to iterate.
>>
>> I want to see some example code using Unmarshal or Pre_Logical or 
>> Post_Logical filter.
>>
>> Thanks,
>>
>> *Abhishek Sharma**|* -
>>
>> | MakeMyTrip.com, 243 SP Infocity, Udyog Vihar Phase 1, Gurgaon, Haryana - 
>> 122 016, India
>>
>> http://www.mailmktg.makemytrip.com/signature/images/bulb.gif*What's new?*My 
>> Trip Rewards - An exclusive loyalty program
>> for MakeMyTrip customers.<https://rewards.makemytrip.com/MTR>
>>
>> http://www.mailmktg.makemytrip.com/signature/images/MMT-signature-footer-V4.gif<http://www.makemytrip.com/>
>>
>> http://www.mailmktg.makemytrip.com/signature/images/map-icon.gif
>> <http://www.makemytrip.com/support/gurgaon-travel-agent-office.php>
>> *Office Map*
>>
>>      
>>
>> http://www.mailmktg.makemytrip.com/signature/images/facebook-icon.gif
>> <http://www.facebook.com/pages/MakeMyTrip-Deals/120740541030?ref=search&sid=100000077980239.1422657277..1>
>> *Facebook*
>>
>>      
>>
>> http://www.mailmktg.makemytrip.com/signature/images/twitter-icon.gif<http://twitter.com/makemytripdeals>
>> *Twitter*
>>
>
>
> -------------------------------------------------------
>
> Fachinformationszentrum Karlsruhe, Gesellschaft für 
> wissenschaftlich-technische Information mbH.
> Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim HRB 
> 101892.
> Geschäftsführerin: Sabine Brünger-Weilandt.
> Vorsitzender des Aufsichtsrats: MinDirig Dr. Thomas Greiner.
>
>


Reply via email to