This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes Invalid element in returned XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Invalid element in returned XML" Watch "Invalid element in returned XML" New topic
Author

Invalid element in returned XML

Don Markham
Greenhorn

Joined: Dec 27, 2005
Posts: 2
I keep getting the following error when I attempt to contact a web service with an invoke(arguments) command. Predir is the first string in an array that is returned.

- Exception:
org.xml.sax.SAXException: Invalid element in com.go2broadband.www.V4_0._QueryOffersResponse - Predir
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.go2broadband.www.V4_0.QueryOffersServiceSoapStub.queryOffers(QueryOffersServiceSoapStub.java:526)
at com.go2broadband.www.V4_0.TestClient.main(TestClient.java:119)
org.xml.sax.SAXException: Invalid element in com.go2broadband.www.V4_0._QueryOffersResponse - Predir

I found this reference at: http://openadaptor.openadaptor.org/pg/soap_components.htm
"Returning Complex Objects
It is likely that most SOAP calls will return complex objects rather than primitives. It is a relatively easy process to write your own extension of AbstractSOAPCall to cater for this.

All you have to do is create a simple deserialiser Bean that mirrors the returned object (ie. have accessor methods for each attribute in the returned object) and then add the following code to your SOAP Call prior to invoking it:

QName qn = new QName("urn:BeanService", "WeatherSummary");

call.registerTypeMapping(WeatherSummary.class,
qn,
new BeanSerializerFactory(WeatherSummary.class, qn),
new BeanDeserializerFactory(WeatherSummary.class, qn));

call.setReturnType(qn);

Note: if your Bean does not have an accessor method for all attributes int he return object then you will get an "org.xml.sax.SAXException: Invalid element in ...." exception"

I believe the stub is doing all of this before the invoke, yet...the error. Any help would be greatly appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalid element in returned XML
 
Similar Threads
Error while running client code on axis webservice
Need Help regarding -- org.xml.sax.SAXException: Invalid element
saxexception-invalid element
AxisFault : Couldn't find deserializer for type
Web Services in Java Vs C#