0

I have below XML response from third party webservice.

How can I populate XML values into Java POJO ? Please help me!

Thanks!

user755806
  • 6,565
  • 27
  • 106
  • 153

2 Answers2

0

When you are generating the web service's client side from a given WSDL it should generate for you the POJO classes defined in the WSDL (in your case, you should have "TrafficHistoryResponse" which wraps "OperationRequest" and "TrafficHistoryResult" which wraps "Alexa" which wraps "TrafficHistory" which wraps "Range", "Site", "Start" and "HistoricalData" that holds "Data" array).

Please, refer to the following link for additional information about importing a WSDL: How to generate java classes from WSDL file

Community
  • 1
  • 1
  • Thanks for your reply. I dont have wsdl.It is a REST call. – user755806 Oct 20 '14 at 05:44
  • Try checking this one (it explains how to generate a client side for RESTFUL web services): http://stackoverflow.com/questions/2689122/how-to-generate-restful-client-in-java-for-rest-defined-in-wsdl – Yakir Magriso Oct 20 '14 at 05:53
0

I think you need to create a stub class which is a pojo class in which all the xml tags will be turned into instance variables and the nesting of xml tags will be defined as nested pojo classes.

Then by applying proper mapping from webservice's response to this stub class your response data will be automatically populated in Java POJO class.

Fas
  • 51
  • 6