How to convert web service response in XML format to POJO with RestTempate in Spring 3 -


a web service returns following xml data:

<balance>   <balance>-123.50</balance>   <name>     joe smith   </name> </balance> 

how convert plain old java object spring 3's resttemplate?

java class corresponding xml data:

@xmlrootelement(name="balance")  // name corresponds name of xml root element public class mybalance {     private bigdecimal balance;     private string name;      // getters / setters omitted clarity } 

calling web service:

resttemplate resttemplate = new resttemplate(); mybalance result = resttemplate.getforobject("http://127.0.0.1:8080/myservice/balance/{code}", mybalance.class, "valueforcode"); log.info("result: " + result); 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -