axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KaiErnst" <k...@fernbach.com>
Subject SAXException: SimpleDeserializer encountered a child element
Date Fri, 03 Oct 2003 07:34:12 GMT
Hi to all,

 

I'm trying to write a Webservice wich has to send complex object/java
types over thw wire. Although I already wrote custom (de)serializer
factories wich should filter the javaTypes I don't need do serialize, I
still get a SAXException.

 

While I'm watching at tcpmon, SOAPMonitor respectively I just see that
the request was send but an error occured at the server side. De facto I
always get a HTTP/1.1 500 Internal Server Error..!

 

Here's the error message:

 

AxisFault

 faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException

 faultSubcode: 

 faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a
child element, which is NOT expected, in something it was trying to
deserialize.

 faultActor: 

 faultNode: 

 faultDetail: 

      {http://xml.apache.org/axis/}stackTrace: AxisFault

 faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException

 faultSubcode: 

 faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a
child element, which is NOT expected, in something it was trying to
deserialize.

 faultActor: 

 faultNode: 

 faultDetail: 

 

org.xml.sax.SAXException: SimpleDeserializer encountered a child
element, which is NOT expected, in something it was trying to
deserialize.

      at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.ja
va:260)

      at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.jav
a:169)

      at
org.apache.axis.encoding.DeserializationContextImpl.endElement(Deseriali
zationContextImpl.java:1015)

      at
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)

      at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValid
ator.java:1550)

      at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatc
h(XMLDocumentScanner.java:1204)

      at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScan
ner.java:381)

      at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)

      at javax.xml.parsers.SAXParser.parse(SAXParser.java:393)

      at
org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializatio
nContextImpl.java:242)

      at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)

      at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)

      at org.apache.axis.client.Call.invokeEngine(Call.java:2583)

      at org.apache.axis.client.Call.invoke(Call.java:2553)

      at org.apache.axis.client.Call.invoke(Call.java:2248)

      at org.apache.axis.client.Call.invoke(Call.java:2171)

      at org.apache.axis.client.Call.invoke(Call.java:1691)

      at test.stateobject.TestClient.main(TestClient.java:86)

 

 

org.xml.sax.SAXException: SimpleDeserializer encountered a child
element, which is NOT expected, in something it was trying to
deserialize.

      at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.ja
va:260)

      at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.jav
a:169)

      at
org.apache.axis.encoding.DeserializationContextImpl.endElement(Deseriali
zationContextImpl.java:1015)

      at
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)

      at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValid
ator.java:1550)

      at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatc
h(XMLDocumentScanner.java:1204)

      at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScan
ner.java:381)

      at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)

      at javax.xml.parsers.SAXParser.parse(SAXParser.java:393)

      at
org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializatio
nContextImpl.java:242)

      at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)

      at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)Error:
org.xml.sax.SAXException: SimpleDeserializer encountered a child
element, which is NOT expected, in something it was trying to
deserialize.

 

      at org.apache.axis.client.Call.invokeEngine(Call.java:2583)

      at org.apache.axis.client.Call.invoke(Call.java:2553)

      at org.apache.axis.client.Call.invoke(Call.java:2248)

      at org.apache.axis.client.Call.invoke(Call.java:2171)

      at org.apache.axis.client.Call.invoke(Call.java:1691)

      at test.stateobject.TestClient.main(TestClient.java:86)

 

Here some code fragments from my webservice:

 

(1) Client Code:

****************

 

public class TestClient {

      

      public static void main(String[] args) throws Exception {

            

      Options options = new Options(args);

 

      Person person = new Person();

      ...

      //some getters

      ...

      Service service = new Service();

      Call call = (Call)service.createCall();

      

      QName qn = new QName("urn:StateObjectService", "Person");

      

       call.registerTypeMapping(Class.class, qn,

             new ClassSerializerFactory(Class.class, qn),

             new ClassDeserializerFactory(Class.class, qn));

             

      call.registerTypeMapping(Person.class, qn, 

             new MyBeanSerializerFactory(Person.class, qn),

             new MyBeanDeserializerFactory(Person.class, qn));

             

             String result;

             

             try {

                  call.setTargetEndpointAddress(new
java.net.URL(options.getURL()));

                  call.setOperationName(new QName("StateObjectProcessor"
"processStateObject"));

                  call.addParameter("arg1", qn, ParameterMode.IN);

 
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);

                  

                  result = (String) call.invoke(new Object[]{person});

             }

                  catch(AxisFault fault){

                  result = "Error: " + fault.toString();

                  fault.printStackTrace();

             }

             System.out.println(result);

      }

}

 

(2) Service Code:

*****************

 

public class Service {

      

            String response = new String();

      

            public String processStateObject(Person person)

            {

 

            try {

                        

                  String response = "something: " +
person.getSOMETHING();

                  }

                  catch (Exception e) {

                     e.printStackTrace();

                  }

                  return response;

                 }

}

 

(3) Deployment descricptor (wsdd-file):

***************************************

 

<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

 

<typeMapping xmlns:myNS="urn:StateObjectService" qname="myNS:Person"
languageSpecificType="java:test.stateobject.Person"

             serializer="test.stateobject.MyBeanSerializerFactory"
deserializer="test.stateobject.MyBeanDeserializerFactory"/>

                 

    <service name="StateObjectProcessor" provider="java:RPC">

      <requestFlow>

            <handler type="soapmonitor"/>

      </requestFlow>

      <responseFlow>

            <handler type="soapmonitor"/>

      </responseFlow>

            <parameter name="allowedMethods"
value="processStateObject"/>

            <parameter name="className"
value="test.stateobject.Service"/>

            <parameter name="wsdlTargetNamespace"
value="urn:StateObjectService"/>

            <parameter name="wsdlServiceElement"
value="ServiceService"/>

            <parameter name="className"
value="test.stateobject.Service"/>

            <parameter name="allowedMethods"
value="processStateObject"/>

        

    <typeMapping xmlns:myNS="urn:StateObjectService" qname="myNS:Person"
type="java:test.stateobject.Person"

                 serializer="test.stateobject.ClassSerializerFactory"
deserializer="test.stateobject.ClassDeserializerFactory"/>

   </service>

</deployment>

 

Useful hints or advices are very appreciated. 

Thanks!!

 

Best regards

Kai

 


Mime
View raw message