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 Dino Chiesa <di...@microsoft.com> on 2005/03/15 23:23:51 UTC

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);
    }

}