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 Anne Thomas Manes <at...@gmail.com> on 2005/03/16 16:54:37 UTC

Re: org.xml.sax.SAXException: SimpleDeserializer encountered a ch ild element...

Use message style.


On Wed, 16 Mar 2005 09:47:51 -0600, BALDWIN, ALAN J
[AG-Contractor/1000] <al...@monsanto.com> wrote:
> I actually took out the static wsdl after the first post.  The wsdl below is generated by Axis.  As for RC2, I had included the old jar file.  I just updated the jars, and it didn't fix anything.
> 
> What I really want to do is turn off the xml-->java binding, and get at the xml myself.  This service will really only need to validate the xml data and forward it.
> 
> Does anyone have any experience with turning off binding?
> 
> Thanks again,
> 
>   -Alan-
> 
> -----Original Message-----
> From: Dino Chiesa [mailto:dinoch@microsoft.com]
> Sent: Tuesday, March 15, 2005 5:57 PM
> To: axis-user@ws.apache.org
> Subject: RE: org.xml.sax.SAXException: SimpleDeserializer encountered a
> child element...
> 
> Ps: you originally said  you were using AXIS 1.2RC3,
> But that WSDL doc (which I still cannot parse)
> says it was generated by AXIS 1.2RC2.
> 
> ??
> 
> Seems like in your WSDD you are specifying a static WSDL?  Is that
> right?
> Then there is nothing guaranteeing that the static WSDL you are serving
> actually conforms to what your code is expecting.
> 
> The static WSDL file could have a picture of tweety bird in it, but that
> doesn't mean your MessageService actually implements the tweety bird
> contract.
> 
> -Dino
> 
> -----Original Message-----
> From: BALDWIN, ALAN J [AG-Contractor/1000]
> [mailto:alan.j.baldwin@monsanto.com]
> Sent: Tuesday, March 15, 2005 5:40 PM
> To: 'axis-user@ws.apache.org'
> Subject: RE: org.xml.sax.SAXException: SimpleDeserializer encountered a
> child element...
> 
> Actually, that WSDL validated in the eclipse plugin... I was including
> an external wsdl into the wsdd file so that axis would not generate one
> for me.  I have determined that is not the problem.
> 
> Here is what is happening now (I've been dealing with this issue for a
> while):  I have a "PurchaseOrder" java bean with a "description" field
> on it.
> 
> Again, I'm using document/literal.
> 
> If the soap message looks like this, it works:
> 
> <SOAP-ENV:Body>
>    <echoMessage>
>         <description>test...</description>
>    </echoMessage>
> <SOAP-ENV:Body>
> 
> This does NOT work:
> 
> <SOAP-ENV:Body>
>    <echoMessage>
>         <PurchaseOrder>
>                 <description>test...</description>
>         <PurchaseOrder>
>    </echoMessage>
> <SOAP-ENV:Body>
> 
> When I put the PurchaseOrder node in, it breaks.  This is just a proof
> of concept service, but when we implement, I will need the root node in
> there to validate against an industry standard schema.  In this case,
> I'm just using PurchaseOrder.
> 
> Any ideas?  Thanks for the reply.
> 
> Here is the WSDL: (copied from the running service, auto-generated from
> axis)
> 
> <wsdl:definitions
> targetNamespace="http://localhost:8080/poc-axis-server/services/MessageS
> ervice">
> 
>         <!--
> WSDL created by Apache Axis version: 1.2RC2 Built on Nov 16, 2004
> (12:19:44 EST)
> -->
> 
> <wsdl:types>
> 
> <schema elementFormDefault="qualified"
> targetNamespace="http://localhost:8080/poc-axis-server/services/MessageS
> ervice">
>         <complexType name="purchaseOrder">
>                 <sequence>
>                         <element name="description" nillable="true"
> type="xsd:string"/>
>                 </sequence>
>         </complexType>
> 
>         <element name="echoMessageReturn" type="xsd:string"/>
> 
> </schema>
> 
> <schema elementFormDefault="qualified"
> targetNamespace="http://server.web.services.farmsource.com">
>                 <import
> namespace="http://localhost:8080/poc-axis-server/services/MessageService
> "/>
>                 <element name="po" type="impl:purchaseOrder"/> </schema>
> </wsdl:types>
> 
>         <wsdl:message name="echoMessageResponse">
>                 <wsdl:part element="impl:echoMessageReturn"
> name="echoMessageReturn"/>
>         </wsdl:message>
> 
>         <wsdl:message name="echoMessageRequest">
>                 <wsdl:part element="tns1:po" name="po"/>
>         </wsdl:message>
> 
>         <wsdl:portType name="JaxRpcMessageService">
> 
>         <wsdl:operation name="echoMessage" parameterOrder="po">
>                 <wsdl:input message="impl:echoMessageRequest"
> name="echoMessageRequest"/>
>                 <wsdl:output message="impl:echoMessageResponse"
> name="echoMessageResponse"/>
>         </wsdl:operation>
> 
> </wsdl:portType>
> 
>         <wsdl:binding name="MessageServiceSoapBinding"
> type="impl:JaxRpcMessageService">
>                 <wsdlsoap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> 
>         <wsdl:operation name="echoMessage">
>                 <wsdlsoap:operation soapAction=""/>
> 
>                 <wsdl:input name="echoMessageRequest">
>                         <wsdlsoap:body use="literal"/>
>                 </wsdl:input>
> 
>                 <wsdl:output name="echoMessageResponse">
>                         <wsdlsoap:body use="literal"/>
>                 </wsdl:output>
>         </wsdl:operation>
> </wsdl:binding>
> 
> <wsdl:service name="JaxRpcMessageServiceService">
>         <wsdl:port binding="impl:MessageServiceSoapBinding"
> name="MessageService">
>                 <wsdlsoap:address
> location="http://localhost:8080/poc-axis-server/services/MessageService"
> />
>         </wsdl:port>
> </wsdl:service>
> 
> </wsdl:definitions>
> 
> -----Original Message-----
> From: Dino Chiesa [mailto:dinoch@microsoft.com]
> Sent: Tuesday, March 15, 2005 4:24 PM
> To: axis-user@ws.apache.org
> Subject: RE: org.xml.sax.SAXException: SimpleDeserializer encountered a
> child element...
> 
> It looks like a disagreement in XML namespace.
> 
> The echoMessage in the wsdl appears to be in a particular namespace,
> whereas the VB6 client is sending a message in no namespace at all.
> 
>     <echoMessage>
>       <PurchaseOrder>
>         <description>string</description>
>       </PurchaseOrder>
>     </echoMessage>
> 
> The WSDL you sent isn't a real wsdl.  It is missing a bunch of stuff?
> So it is hard to say whether what I wrote above is right.
> 
> -----Original Message-----
> From: BALDWIN, ALAN J [AG-Contractor/1000]
> [mailto:alan.j.baldwin@monsanto.com]
> Sent: Tuesday, March 15, 2005 5:03 PM
> To: 'axis-user@ws.apache.org'
> Subject: RE: org.xml.sax.SAXException: SimpleDeserializer encountered a
> child element...
> 
> Here is the response I'm getting, if this helps.  I've seen several
> people having this problem on the web, but nobody seems to have posted
> any fixes.
> 
> <soapenv:Fault
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>         <faultcode>soapenv:Server.userException</faultcode>
>         <faultstring>org.xml.sax.SAXException: SimpleDeserializer
> encountered a child element, which is NOT expected, in something it was
> trying to deserialize.</faultstring>
>         <detail>
>                 <ns1:hostname
> xmlns:ns1="http://xml.apache.org/axis/">LCEVER</ns1:hostname>
>         </detail>
> </soapenv:Fault>
> 
> Thanks,
> 
>    -Alan Baldwin-
> 
> -----Original Message-----
> From: BALDWIN, ALAN J [AG-Contractor/1000]
> [mailto:alan.j.baldwin@monsanto.com]
> Sent: Tuesday, March 15, 2005 2:56 PM
> To: 'axis-user@ws.apache.org'
> Subject: org.xml.sax.SAXException: SimpleDeserializer encountered a
> child element...
> 
> Hi all, I'm having an issue with Apache Axis 1.2 RC3.  It is running on
> Tomcat 5.0.28.  The error I'm getting is "org.xml.sax.SAXException:
> SimpleDeserializer encountered a child element, which is NOT expected,
> in something it was trying to deserialize".  I've tried tweaking the
> schema and wsdl but to no avail.  Nothing I do seems to get rid of this
> error.  I'm using a document/literal approach, as you will note below.
> Is this a schema validation problem?  I have downloaded the axis source,
> but I haven't dug *too* deeply into it.
> 
> Can anyone help me?
> 
> Thanks a lot,
> 
>   Alan Baldwin
> 
> Stack trace:
> 
> Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a
> child element, which is NOT expected, in something it was trying to
> deserialize.
>         at
> org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeser
> ializer.java:143)
>         at
> org.apache.axis.encoding.DeserializationContext.startElement(Deserializa
> tionContext.java:1031)
>         at
> org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:
> 165)
>         at
> org.apache.axis.message.MessageElement.publishToHandler(MessageElement.j
> ava:1140)
>         at
> org.apache.axis.message.RPCElement.deserialize(RPCElement.java:238)
>         at
> org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
>         at
> org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.ja
> va:148)
>         at
> org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:319
> )
> 
> Here is my soap message (vb6 client):
> 
> <SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
> xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
> <SOAP-ENV:Body>
> <echoMessage>
>         <PurchaseOrder>
>                 <description>test</description>
>         </PurchaseOrder>
> </echoMessage>
> </SOAP-ENV:Body>
> <SOAP-ENV:Envelope>
> 
> Here is my wsdl:
> 
> <wsdl:definitions
> targetNamespace="http://localhost:8080/poc-axis-server/services/MessageS
> ervice">
> 
> <wsdl:types>
> 
> <xs:schema attributeFormDefault="unqualified"
> elementFormDefault="qualified">
>         <xs:element name="echoMessage">
>                 <xs:complexType>
>                         <xs:sequence>
>                                 <xs:element ref="PurchaseOrder"/>
>                         </xs:sequence>
>                 </xs:complexType>
>         </xs:element>
> 
>         <xs:element name="PurchaseOrder">
>                 <xs:complexType>
>                         <xs:sequence>
>                                 <xs:element name="description"
> type="xs:string"/>
>                         </xs:sequence>
>                 </xs:complexType>
>         </xs:element>
> </xs:schema>
> 
> </wsdl:types>
> 
>         <wsdl:message name="echoMessageResponse"> <wsdl:part
> element="impl:echoMessageReturn" name="echoMessageReturn"/>
> </wsdl:message>
> 
>         <wsdl:message name="echoMessageRequest"> <wsdl:part
> element="impl:echoMessage" name="echoMessage"/> </wsdl:message>
> 
>         <wsdl:portType name="JaxRpcMessageService">
> 
>         <wsdl:operation name="echoMessage">
> <wsdl:input message="echoMessageRequest"/> <wsdl:output
> message="echoMessageResponse"/> </wsdl:operation> </wsdl:portType>
> 
>         <wsdl:binding name="MessageServiceSoapBinding"
> type="impl:JaxRpcMessageService"> <wsdlsoap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> 
>         <wsdl:operation name="echoMessage">
> <wsdlsoap:operation soapAction=""/>
> 
>         <wsdl:input>
> <wsdlsoap:body use="literal"/>
> </wsdl:input>
> 
>         <wsdl:output>
> <wsdlsoap:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> 
>         <wsdl:service name="JaxRpcMessageServiceService">
> 
>         <wsdl:port binding="impl:MessageServiceSoapBinding"
> name="MessageService"> <wsdlsoap:address
> location="http://localhost:8080/poc-axis-server/services/MessageService"
> />
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> 
> Here is my WSDD:
> 
> ...snip...
> 
>   <service name="MessageService" style="document" use="literal"
> provider="java:RPC">
>     <requestFlow>
>       <handler type="soapmonitor"/>
>     </requestFlow>
>     <responseFlow>
>       <handler type="soapmonitor"/>
>     </responseFlow>
>     <parameter name="allowedMethods" value="*"/>
>     <parameter name="className"
>       value="com.farmsource.services.web.server.JaxRpcMessageService"/>
> 
>     <wsdlFile>PurchaseOrder.wsdl</wsdlFile>
> 
>    </service>
> 
> ../snip....
> 
> Here is my Java code:
> 
> public class JaxRpcMessageService extends ServletEndpointSupport
> implements
>         RemoteMessageService, MessageService {
> 
>     protected final Log logger = LogFactory.getLog(getClass());
> 
>     private MessageService messageService;
> 
>     //this is from a spring context.  this is working fine.
>     protected void onInit() throws ServiceException {
>         messageService = (MessageService)
> getWebApplicationContext().getBean(
>                 "messageService");
>         logger.info("Service implementation (from application context):"
>                 + messageService.getClass());
>     }
> 
>     public String echoMessage(SOAPElement po) {
>         logger.info("Retrieving broadcast message from local service");
>         return messageService.echoMessage(po);
>     }
> 
> }
> 
>