You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Tim Kitchens <tk...@Unwiredexpress.com> on 2002/09/11 23:47:50 UTC
Help: SAXException Invalid element
It seems there may be a problem with deserialization on the Axis client when using a hyphen in the name of elements that returned by the web service. When I define the schema that results in the service returning the following SOAP envelope:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<event xmlns="http://namespaces.anytype.com">
<bos>
<bo>
<name>Fred</name>
</bo>
</bos>
</event>
</soapenv:Body>
</soapenv:Envelope>
everything works fine. Now, if I change JUST the NAMES of the "bos" and "bo" elements to "business-objects" and "business-object", respectively, resulting in the following envelope being returned by the service:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<event xmlns="http://namespaces.anytype.com">
<business-objects>
<business-object>
<name>Fred</name>
</business-object>
</business-objects>
</event>
</soapenv:Body>
</soapenv:Envelope>
then, I get the following exception:
[java] org.xml.sax.SAXException: Invalid element in ws.Event - business
objects
[java] - Exception:
[java] org.xml.sax.SAXException: Invalid element in ws.Event - business-ob
ects
[java] at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(B
anDeserializer.java:248)
[java] at org.apache.axis.encoding.DeserializationContextImpl.startEle
ent(DeserializationContextImpl.java:883)
[java] at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRe
order.java:158)
[java] at org.apache.axis.message.MessageElement.publishToHandler(Mess
geElement.java:681)
[java] at org.apache.axis.message.RPCElement.deserialize(RPCElement.ja
a:244)
[java] at org.apache.axis.message.RPCElement.getParams(RPCElement.java
268)
[java] at org.apache.axis.client.Call.invoke(Call.java:1862)
[java] at org.apache.axis.client.Call.invoke(Call.java:1768)
[java] at org.apache.axis.client.Call.invoke(Call.java:1306)
[java] at ws.GetAnyTypeSoapBindingStub.getAnyType(GetAnyTypeSoapBindin
Stub.java:141)
I'm guessing this is a bug, since I see no reason why simply changing an element name would have any impact on deserialization. The "hyphenation" follows our company's naming conventions. Is this a bug or is there some rule I'm unaware of here? Meanwhile, I'll check the BeanDeserializer code to see whether I can spot the problem.
Thanks,
Tim