java - How to map XML to POJO -
i have following result:
<result xmlns="urn:buscape" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" totalresultsavailable="1" totalresultsreturned="1" totalpages="1" page="1" totallooseoffers="0" xsi:schemalocation="http://developer.buscape.com/admin/lomadee.xsd"> <details> <applicationid>999999999999999</applicationid> <applicationversion>1.0</applicationversion> <applicationpath/> <date>2016-09-12t23:50:19.722-03:00</date> <elapsedtime>19</elapsedtime> <status>success</status> <code>0</code> <message>success</message> </details> <lomadeelinks> <lomadeelink> <id>1</id> <originallink>link</originallink> <redirectlink>link2</redirectlink> <code>0</code> </lomadeelink> </lomadeelinks> </result>
looking @ "2.7.4 retrieving xml data via http get", have map xml pojo-like object in java, here question, can't find @root , @element annotation , i'm not sure how correctly map xml java object.
if using spring/springboot can use (yourpojo)getwebservicetemplate().marshalsendandreceive(yoursoapservice);
pojo :-
@xmlaccessortype(xmlaccesstype.field) @xmltype(name = "", proporder = { "getordersresponse" }) @xmlrootelement(name = "nameoftag", namespace = "http://example.org/yourresource") public class getordersbydateresult {
@xmlelement(name = "getordersresponse") protected getordersresponsetype getordersresponse; getter(); setter();
}
Comments
Post a Comment