Hi,

 

Further to my question, the data binding error is thrown by org.apache.xmlbeans.SchemaTypeLoader.parse(XmlStreamReader, SchemaType, XmlOptions) in one of my bound classes (LoginRequestDocument). However, with the msgContext.getEnvelope() line placed in the code shown below it manages to generate a LoginRequestDocument and a LoginResponseDocument (both of which make sense) before the exception is thrown!? Surely there either is a data binding error or there is not. How can it have it both ways? Here is the SOAP envelope for the request:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Header />

<soapenv:Body>

<LoginRequest xmlns="paf.ws.edp.co.uk">

<env>default</env>

<userID>test</userID>

<password>test</password>

</LoginRequest>

</soapenv:Body>

</soapenv:Envelope>

 

Regards,

Ken

 


From: Ken Campbell [mailto:[EMAIL PROTECTED]
Sent: 12 May 2006 11:07
To: [email protected]
Subject: [Axis2 1.0] MessageContext question

 

Hi,

 

If someone understands the AxisEngine well I’d appreciate them having a look at this problem:

 

I’m having a data binding error which I don’t understand. In an attempt to trace it I’ve called:

System.out.println(msgContext.getEnvelope());

in MyMessageReceiverInOut.invokeBusinessLogic()

 

This seems to have a very weird effect. By placing it here :

 

if("login".equals(methodName)){

 

 

            uk.co.edp.ws.paf.LoginResponseDocument param11 = null;

            System.out.println(msgContext.getEnvelope());

           

                    //doc style

             param11 =skel.login(

                     (uk.co.edp.ws.paf.LoginRequestDocument)fromOM(

                             msgContext.getEnvelope().getBody().getFirstElement(),

                             uk.co.edp.ws.paf.LoginRequestDocument.class,

                             getEnvelopeNamespaces(msgContext.getEnvelope())));

                       

              envelope = toEnvelope(getSOAPFactory(msgContext), param11, false);

              System.out.println("toEnvelope() returned.");

 

 

the service classes will return a valid param11, but axis throws an exception:

 

- Servlet.service() for servlet AxisServlet threw exception

java.lang.NullPointerException

            at com.ctc.wstx.util.BijectiveNsMap.findPrefixByUri(BijectiveNsMap.java:132)

            at com.ctc.wstx.sw.SimpleOutputElement.getPrefix(SimpleOutputElement.java:453)

            at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeAttributes(StreamingOMSerializer.java:214)

            at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeElement(StreamingOMSerializer.java:147)

            at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(StreamingOMSerializer.java:73)

            at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:56)

            at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:315)

            at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:786)

            at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:809)

            at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:780)

            at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:171)

            at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:809)

            at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:381)

            at org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:256)

            at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:210)

            at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:589)

            at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:43)

            at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454)…..

- Servlet.service() for servlet jsp threw exception

java.lang.IllegalStateException: getOutputStream() has already been called for this response….

 

So my question is, it seems as if MessageContext.getEnvelope() in some way ‘consumes’ the data stream. How is it possible

that I am getting a response from my service classes when I do this and that no other class complains about my intercepting msgContext until

BijectiveNsMap ? The data binding error is normally thrown in MyMessageReceiverInOut.fromOM() at the request but when I call msgContext.getEnvelope()

it happily goes off and gets a proper response!

 

Regards,

Ken

 

Reply via email to