Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invalid element in returned XML

 
Don Markham
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic