I have consumed a web service via the XFire project wizard and am not
getting all the data to deserialize into the class. The problem is that the
xml data
is a sub classed obejct and is being returned as the base class data member.
Below is snippets of the code generated and the XML data.
Any help is appreciated.
Dave
================
Snippet of actual XML SOAP message body
<Movement>
<Direction xsi:type="CompassDirection">
< other data removed >
</Direction>
</Movement>
Code generated by the XFire project wizard (1.0.2.xfire124).
private void create0() {
TransportManager tm =
(org.codehaus.xfire.XFireFactory.newInstance().getXFire().getTransportManager());
HashMap props = new HashMap();
props.put("annotations.allow.interface", true);
AnnotationServiceFactory asf = new AnnotationServiceFactory(new
Jsr181WebAnnotations(), tm, new AegisBindingProvider(new JaxbTypeRegistry()));
asf.setBindingCreationEnabled(false);
service0 = asf.create((services.IReport.class), props);
{
AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0, new
QName("urn:services", "IReportLocalBinding"), "urn:xfire:transport:local");
}
{
AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0, new
QName("urn:services", "IReport"), "http://schemas.xmlsoap.org/soap/http");
}
}
public class Movement {
@XmlElement(name = "Direction")
protected AbstractDirection direction;
< other definitions removed >
public AbstractDirection getDirection() {
return direction;
}
< other methods removed >
}
public class AbstractDirection {
< definitions removed >
< methods removed >
}
public class CompassDirection
extends AbstractDirection
{
@XmlElement(name = "Direction")
protected DirectionCode direction;
< other definitions removed >
public DirectionCode getDirection() {
return direction;
}
< other methods removed >
}
I noticed when writing this that there were duplicate XmlElement names
"Direction".
I changed CompassDirection in the Web Service to the following and then
consumed the
service again via the wizard but it made no difference.
public class CompassDirection
extends AbstractDirection
{
@XmlElement(name = "Hello2")
protected DirectionCode hello2;
< other definitions removed >
public DirectionCode getHello2() {
return hello2;
}
< other methods removed >
}
_________________________________________________________________
Live Search Maps – find all the local information you need, right when you need
it.
http://maps.live.com/?icid=wlmtag2&FOR M=MGAC01