Hi there,
Using a SOAP connector i’m able to get this this string converted to SPIN XML:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/" xmlns:cal="http://www.calculator.com/CalculateNetAmount" >
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<cal:CalculateNetAmountResponse>
<cal:field>stringField</cal:field>
<cal:error>stringError</cal:error>
</cal:CalculateNetAmountResponse>
</soapenv:Body>
</soapenv:Envelope>
Using this construct i’m able to select my CalculateNetAmountResponse element:
SpinXmlElement responseXML=responseBodyXML.xPath("//cal:CalculateNetAmountResponse").ns("cal","http://www.calculator.com/CalculateNetAmount").element();
Resulting in:
<?xml version="1.0" encoding="UTF-8"?>
<cal:CalculateNetAmountResponse xmlns:cal="http://www.calculator.com/CalculateNetAmount">
<cal:field>stringField</cal:field>
<cal:error>stringError</cal:error>
</cal:CalculateNetAmountResponse>
However, when I try to map it to a POJO, it comes out null.
CalculateNetAmountResponse responseObj = responseXML.mapTo(CalculateNetAmountResponse.class)
I JAXB-generate my POJO class by way of a provided XSD and this is the result:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"field",
"error"
})
@XmlRootElement(name = "CalculateNetAmountResponse")
public class CalculateNetAmountResponse {
@XmlElement(required = true)
protected String field;
@XmlElement(required = true)
protected String error;
public String getField() {
return field;
}
public void setField(String value) {
this.field = value;
}
public String getError() {
return error;
}
public void setError(String value) {
this.error = value;
}
}
Can anyone give me a pointer as why this won’t work?