0

I have the 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 at "2.7.4 Retrieving XML data via HTTP GET", I have to map this XML to POJO-like object in Java, here is the question, I can't find the @Root and @Element annotation and I'm not sure how to correctly map the XML into a Java object.

shmosel
  • 49,289
  • 6
  • 73
  • 138
Vitor Vezani
  • 846
  • 2
  • 8
  • 24
  • 2.2.4 Object to XML Marshaling: Object to XML marshaling in Spring for Android RestTemplate requires the use of a third party XML mapping library. The Simple XML serializer is used to provide this marshaling functionality. – keshlam Sep 13 '16 at 03:43
  • It already answered. Please find the below [link](http://stackoverflow.com/questions/15881876/mapping-xml-entities-to-java-objects) – Vinod Bokare Sep 13 '16 at 05:59

1 Answers1

0

If you are using spring/springboot then simply you 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();

}

Ravi Wadje
  • 1,145
  • 1
  • 10
  • 15