axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anne Thomas Manes <a...@manes.net>
Subject RE: SimpleDeserializer encountered a child element, which is NOT expected
Date Thu, 18 Mar 2004 22:10:48 GMT
<html>
<body>
I'm not an expert on this stuff, but I believe that the beanserializer
only works with SOAP encoding.<br><br>
At 05:57 PM 3/18/2004, Hari Lakshmanan wrote:<br>
<blockquote type=cite class=cite cite><font face="arial" size=2 color="#0000FF">Hi
Anne,<br>
The name space in the SOAP envelop works as you had described. However I
am still having problem and my guess is it has to-do with the
MapSerializer and BeanSerializer (I use Doc/literal web service). When I
add a complex type to hashMap, the value element has two children instead
of one and&nbsp; this is causing the problem. I am using the
MapSerializer(shipped with Axis) for HashMap and BeanSerializer (shipped
with Axis) for complext type (CourseBO).<br>
</font>&nbsp;<br>
<font face="arial" size=2 color="#0000FF">Is there a problem in using
Mapserializer and BeanSerializer with doc / literal web service style?
Please note that everything works when I use RPC/Encoded style (due to
multiref object serialization) or am I missing something in my WSDL file?
Here is my WSDL file<br>
</font>&nbsp;<br>
&nbsp;<br>
<font face="arial" size=2 color="#0000FF">Hope this is not too much of
trouble. <br>
</font>&nbsp;<br>
<font face="arial" size=2 color="#0000FF">__Hari<br>
</font>
<dl>
<dd><font face="tahoma" size=2>-----Original Message-----<br>

<dd>From:</b> Anne Thomas Manes
[<a href="mailto:anne@manes.net" eudora="autourl">mailto:anne@manes.net</a>]
<br>

<dd>Sent:</b> Thursday, March 18, 2004 6:35 AM<br>

<dd>To:</b> axis-user@ws.apache.org<br>

<dd>Subject:</b> RE: SimpleDeserializer encountered a child element,
which is NOT expected<br><br>
</font>
<dd>Hari,<br><br>

<dd>If an element is defined as a local element within a schema (i.e., it
is defined within a type definition rather than as a direct child of the
&lt;schema&gt; element), and if you have not specified
elementFormDefault=&quot;qualified&quot; in the schema, then the element
MUST NOT be namespace qualified&nbsp; in a schema instance. <br><br>

<dd>If a document instance declares a default namespace, then each
unqualified local element must include the xmlns=&quot;&quot; attribute
in order to specify no namespace.<br><br>

<dd>For example, if you have a schema such as:<br><br>

<dd>&lt;schema xmlns=&quot;.../XMLSchema&quot;
targetNamespace=&quot;urn:foobar&quot;
xmlns:tns=&quot;urn:foobar&quot;&gt;<br>

<dd>&nbsp; &lt;complexType name=&quot;foobar&quot;&gt;<br>

<dd>&nbsp;&nbsp;&nbsp; &lt;sequence&gt;<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;element name=&quot;foo&quot;
type=&quot;string&quot;/&gt;<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;element name=&quot;bar&quot;
type=&quot;string&quot;/&gt;<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp; &lt;/sequence&gt;<br>

<dd>&nbsp;&nbsp; &lt;/complexType&gt;<br>

<dd>&nbsp;&nbsp; &lt;element name=&quot;foobar&quot;
type=&quot;tns:foobar&quot;/&gt;<br>

<dd>&lt;/schema&gt;<br><br>

<dd>The element &quot;foobar&quot; and the complexType &quot;foobar&quot;
are global, but the elements &quot;foo&quot; and &quot;bar&quot; are
local. In a valid document instance, &quot;foobar&quot; must be namespace
qualified, but &quot;foo&quot; and &quot;bar&quot; must not be. 
<br><br>

<dd>So this instance would be valid:<br><br>

<dd>&lt;tns:foobar xmlns:tns=&quot;urn:foobar&quot;&gt;<br>

<dd>&nbsp; &lt;foo&gt;foo&lt;/foo&gt;<br>

<dd>&nbsp; &lt;bar&gt;bar&lt;/bar&gt;<br>

<dd>&lt;/tns:foobar&gt;<br><br>

<dd>But this instance would not be valid:<br><br>

<dd>&lt;foobar xmlns=&quot;urn:foobar&quot;&gt;<br>

<dd>&nbsp; &lt;foo&gt;foo&lt;/foo&gt;<br>

<dd>&nbsp; &lt;bar&gt;bar&lt;/bar&gt;<br>

<dd>&lt;/foobar&gt;<br><br>

<dd>If you define a default namespace for &lt;foobar&gt;, then you must
override that namespace declaration for each local child element to make
it valid:<br><br>

<dd>&lt;foobar xmlns=&quot;urn:foobar&quot;&gt;<br>

<dd>&nbsp; &lt;foo xmlns=&quot;&quot;&gt;foo&lt;/foo&gt;<br>

<dd>&nbsp; &lt;bar xmlns=&quot;&quot;&gt;bar&lt;/bar&gt;<br>

<dd>&lt;/tns:foobar&gt;<br><br>

<dd>Note that if you set elementFormDefault to &quot;qualified&quot; then
all local elements must then be namespace qualified:<br><br>

<dd>&lt;schema xmlns=&quot;.../XMLSchema&quot;
targetNamespace=&quot;urn:foobar&quot;
xmlns:tns=&quot;urn:foobar&quot;<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;
elementFormDefault=&quot;qualified&quot;&gt;<br>

<dd>&nbsp; &lt;complexType name=&quot;foobar&quot;&gt;<br>

<dd>&nbsp;&nbsp;&nbsp; &lt;sequence&gt;<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;element name=&quot;foo&quot;
type=&quot;string&quot;/&gt;<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;element name=&quot;bar&quot;
type=&quot;string&quot;/&gt;<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp; &lt;/sequence&gt;<br>

<dd>&nbsp;&nbsp; &lt;/complexType&gt;<br>

<dd>&nbsp;&nbsp; &lt;element name=&quot;foobar&quot;
type=&quot;tns:foobar&quot;/&gt;<br>

<dd>&lt;/schema&gt;<br><br>

<dd>With this schema the following document instance would be
invalid:<br><br>

<dd>&lt;tns:foobar xmlns:tns=&quot;urn:foobar&quot;&gt;<br>

<dd>&nbsp; &lt;foo&gt;foo&lt;/foo&gt;<br>

<dd>&nbsp; &lt;bar&gt;bar&lt;/bar&gt;<br>

<dd>&lt;/tns:foobar&gt;<br><br>

<dd>While the following instances would be valid:<br><br>

<dd>&lt;tns:foobar xmlns:tns=&quot;urn:foobar&quot;&gt;<br>

<dd>&nbsp; &lt;tns:foo&gt;foo&lt;/tns:foo&gt;<br>

<dd>&nbsp; &lt;tns:bar&gt;bar&lt;/tns:bar&gt;<br>

<dd>&lt;/tns:foobar&gt;<br><br>

<dd>&lt;foobar xmlns=&quot;urn:foobar&quot;&gt;<br>

<dd>&nbsp; &lt;foo&gt;foo&lt;/foo&gt;<br>

<dd>&nbsp; &lt;bar&gt;bar&lt;/bar&gt;<br>

<dd>&lt;/foobar&gt;<br><br>

<dd>Regards,<br>

<dd>Anne<br><br>

<dd>At 12:09 AM 3/18/2004, you wrote:<br>
<blockquote type=cite class=cite cite>
<dd>This is not directly related to the discussion on hand. But I have
been trying to get around this problem in axis.<br>

<dd>&nbsp;<br>

<dd>If you notice the element <br>

<dd><font color="#0000FF">&lt;processName
xmlns=&quot;&quot;&gt;CourseBusinessProcess&lt;/processName&gt;<br>
</font><br>

<dd>why should the message have a namespace
<font color="#0000FF">xmlns=&quot;&quot; </font>Is it right to have this
for elements.<br><br>

<dd>What is the significance of this element.<br><br>

<dd>Any pointers will be helpful<br>

<dd>Vijay<br><br>

<dd>P.S - I am sort of a newbie in axis.<br><br>

<dd>Hari Lakshmanan &lt;hari@wakesoft.com&gt;</i></b> wrote:
<dd><font face="arial" size=2 color="#0000FF">I get the same error and it
happens only in a particular scenario. I have a class like this</font>
<dd>&nbsp; 
<dd><font face="arial" size=2 color="#0000FF">public class BPEvent {
<dd>private String processName;
<dd>private HashMap attributes;
<dd>...
<dd>...
<dd>}</font>
<dd>&nbsp; 
<dd><font face="arial" size=2 color="#0000FF">When I add a String object
to atts everythign works fine. However when I add my customized type, I
get this error. The SOAP message looks like this</font>
<dd>&nbsp; 
<dd><font face="arial" size=2 color="#0000FF">&lt;soapenv:Body&gt;
<dd>&nbsp; &lt;in0 xmlns=&quot;urn:typeNS&quot;&gt;
<dd>&nbsp;&nbsp; &lt;processName
xmlns=&quot;&quot;&gt;CourseBusinessProcess&lt;/processName&gt;
<dd>&nbsp;&nbsp; &lt;attributes xmlns=&quot;&quot;&gt;
<dd>&nbsp;&nbsp;&nbsp; &lt;item
xmlns:soapenc=&quot;<a href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>&quot;
xmlns:ns1=&quot;<a href="http://xml.apache.org/xml-soap">http://xml.apache.org/xml-soap</a>&quot;&gt;
<dd>&nbsp;&nbsp;&nbsp;&nbsp; &lt;key&gt;Operation&lt;/key&gt;
<dd>&nbsp;&nbsp;&nbsp;&nbsp; &lt;value&gt;Save&lt;/value&gt;
<dd>&nbsp;&nbsp;&nbsp; &lt;/item&gt;
<dd>&nbsp;&nbsp;&nbsp; &lt;item&gt;
<dd>&nbsp;&nbsp;&nbsp;&nbsp; &lt;key&gt;COURSEBO&lt;/key&gt;
<dd>&nbsp;&nbsp;&nbsp;&nbsp; &lt;value&gt;
<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ID&gt;0&lt;/ID&gt;
<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;name
xsi:nil=&quot;true&quot;/&gt;
<dd>&nbsp;&nbsp;&nbsp;&nbsp; &lt;/value&gt;
<dd>&nbsp;&nbsp;&nbsp; &lt;/item&gt;
<dd>&nbsp;&nbsp; &lt;/attributes&gt;
<dd>&nbsp; &lt;/in0&gt;
<dd>&nbsp;&lt;/soapenv:Body&gt;</font>
<dd>&nbsp; 
<dd><font face="arial" size=2 color="#0000FF">In the above the Item
COURSEBO is my customized type and note the way the value element is
being formed. My guess is this is causing the above exception. </font>
<dd>&nbsp; 
<dd><font face="arial" size=2 color="#0000FF">is this a known issue with
Map serializer and de-serializer? If so are there any
workarounds?</font>
<dd>&nbsp; 
<dd><font face="arial" size=2 color="#0000FF">Thanks
<dd>__Hari</font>
<dd><font face="tahoma" size=2>-----Original Message-----
<dd>From: Nick Sharples
[<a href="mailto:nick.anonymous@blueyonder.co.uk" eudora="autourl">mailto:nick.anonymous@blueyonder.co.uk</a>]

<dd>Sent: Wednesday, March 17, 2004 1:04 PM
<dd>To: axis-user@ws.apache.org
<dd>Subject: RE: SimpleDeserializer encountered a child element, which is
NOT expected<br><br>
</font>
<dd><font face="arial" size=2 color="#0000FF">P.S. The same error occurs
when I set my XML parser to be Xerces in stead of Crimson</font>
<dd><font face="tahoma" size=2>-----Original Message-----
<dd>From: Nick Sharples
[<a href="mailto:nick.anonymous@blueyonder.co.uk" eudora="autourl">mailto:nick.anonymous@blueyonder.co.uk</a>]

<dd>Sent: 17 March 2004 21:02
<dd>To: axis-user@ws.apache.org
<dd>Subject: SimpleDeserializer encountered a child element, which is NOT
expected<br><br>
</font>
<dd><font face="arial" size=2>Hello All,</font>
<dd>&nbsp; 
<dd><font face="arial" size=2>Has anybody seen this message
before?</font>
<dd>&nbsp; 
<dd><font face="arial" size=2>I wouldn't be so confused if this error was
consistent, but it only occurs when I try to run the my JUnit test cases
and NOT when I run my client application.</font>
<dd>&nbsp; 
<dd><font face="arial" size=2>I've checked for differences in the
classpaths for the two apps and the only difference I can notice is that
when I run the tests is that I have junit.jar in my classpath.</font>
<dd>&nbsp; 
<dd><font face="arial" size=2>The complete axis fault trace looks like
this:</font>
<dd>&nbsp; 
<dd><font face="arial" size=2>=============================================</font>
<dd>&nbsp; 
<dd><font face="arial" size=2>org.xml.sax.SAXException:
SimpleDeserializer encountered a child element, which is NOT expected, in
something it was trying to deserialize.
<dd>AxisFault
<dd>&nbsp;faultCode:
{<a href="http://schemas.xmlsoap.org/soap/envelope/" eudora="autourl">http://schemas.xmlsoap.org/soap/envelope/</a>}Server.userException
<dd>&nbsp;faultSubcode: 
<dd>&nbsp;faultString: org.xml.sax.SAXException: SimpleDeserializer
encountered a child element, which is NOT expected, in something it was
trying to deserialize.
<dd>&nbsp;faultActor: 
<dd>&nbsp;faultNode: 
<dd>&nbsp;faultDetail: 
<dd>&nbsp;{<a href="http://xml.apache.org/axis/" eudora="autourl">http://xml.apache.org/axis/</a>}stackTrace:
AxisFault
<dd>&nbsp;faultCode:
{<a href="http://schemas.xmlsoap.org/soap/envelope/" eudora="autourl">http://schemas.xmlsoap.org/soap/envelope/</a>}Server.userException
<dd>&nbsp;faultSubcode: 
<dd>&nbsp;faultString: org.xml.sax.SAXException: SimpleDeserializer
encountered a child element, which is NOT expected, in something it was
trying to deserialize.
<dd>&nbsp;faultActor: 
<dd>&nbsp;faultNode: 
<dd>&nbsp;faultDetail: </font>
<dd>&nbsp; 
<dd><font face="arial" size=2>org.xml.sax.SAXException:
SimpleDeserializer encountered a child element, which is NOT expected, in
something it was trying to deserialize.
<dd>&nbsp;at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
<dd>&nbsp;at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
<dd>&nbsp;at
org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1015)
<dd>&nbsp;at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1675)
<dd>&nbsp;at
org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
<dd>&nbsp;at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
<dd>&nbsp;at
org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
<dd>&nbsp;at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
<dd>&nbsp;at
org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
<dd>&nbsp;at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
<dd>&nbsp;at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
<dd>&nbsp;at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
<dd>&nbsp;at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242)
<dd>&nbsp;at
org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
<dd>&nbsp;at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
<dd>&nbsp;at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
<dd>&nbsp;at org.apache.axis.client.Call.invoke(Call.java:2553)
<dd>&nbsp;at org.apache.axis.client.Call.invoke(Call.java:2248)
<dd>&nbsp;at org.apache.axis.client.Call.invoke(Call.java:2171)
<dd>&nbsp;at org.apache.axis.client.Call.invoke(Call.java:1691)
<dd>&nbsp;at
xx.xx.xx.GroupManagementServiceSyncSoapStub.createGroup(GroupManagementServiceSyncSoapStub.java:742)
<dd>&nbsp;at
xx.xx.xx.GroupManagementServiceSyncTestCase.test1GroupManagementServiceSyncSoapCreateGroup(GroupManagementServiceSyncTestCase.java:41)
<dd>&nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
<dd>&nbsp;at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
<dd>&nbsp;at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</font>
<dd>&nbsp; 
<dd><font face="arial" size=2>=============================================</font>
</dl><font face="arial" size=2>Do you Yahoo!?<br>
<a href="http://us.rd.yahoo.com/mailtag_us/*http://mail.yahoo.com">Yahoo!
Mail</a> - More reliable, more storage, less spam </blockquote><br>
~~~~~~~~~~~~~~~~~~<br>
Anne Thomas Manes<br>
VP &amp; Research Director<br>
Burton Group</font> <br><br>
</blockquote>
<x-sigsep><p></x-sigsep>
~~~~~~~~~~~~~~~~~~<br>
Anne Thomas Manes<br>
VP &amp; Research Director<br>
Burton Group</body>
</html>


Mime
View raw message