We are connecting to a third party using Jersey. We then want to extract the returned xml into our class. This is actually working fine except for one node in the xml that is in a subnode.
Here is the xml returned:
<response>
...
<langISO>en</langISO>
<acquirerAmount>1000</acquirerAmount>
<acquirerCurrency>GBP</acquirerCurrency>
<subXml>
<authCode>122958</authCode>
</subXml>
</response>
Note that the authCode node is in a subnode (called subXml).
OurResponse myriadResponse = response.getEntity(OurResponse.class);
Here is our class, but it is not parsing out the authCode
package com.xxx;
import javax.ws.rs.Consumes;
import javax.ws.rs.Path;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@Consumes("application/xml")
public class OurResponse {
private String authCode;
@XmlElement(name = "subXml/authCode")
public String getAuthCode() {
return authCode;
}
@XmlElement(name = "subXml/authCode")
public void setAuthCode(String authCode) {
this.authCode = authCode;
}
}