"Block already consumed" error in JAXWS services
------------------------------------------------

                 Key: AXIS2-4417
                 URL: https://issues.apache.org/jira/browse/AXIS2-4417
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: jaxws
            Reporter: Isuru Eranga Suriarachchi
         Attachments: axis2-jaxws-sample-src.zip, axis2-jaxws-sample.jar

I'm attaching my sample jaxws service and its source code.

In JAXWS services, body and header parts are kept as 
org.apache.axis2.jaxws.message.impl.BlockImpl objects. These message blocks are 
read before invoking the service and all are set as "consumed".

But in this sample service, I want to access Reference Parameters and I've done 
that using the following line.

List<Element> referenceParam = (List<Element>) 
context.getMessageContext().get(MessageContext.REFERENCE_PARAMETERS);

And also this service is expecting a header which is called "TestHeader" and it 
is already consumed when the execution comes into the service. But above access 
to reference parameters calls the getXMLStreamReader of the BlockInmpl object 
of the header block. As it is already consumed, it gives the following 
exception.

Caused by: javax.xml.ws.WebServiceException: An internal error occurred. The 
org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl block object is 
already consumed. Processing cannot continue.  Run with the debug option to 
determine where the block was first consumed.
        at 
org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:173)
        at 
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
        at 
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:118)
        at 
org.apache.axis2.jaxws.message.impl.BlockImpl.getXMLStreamReader(BlockImpl.java:229)
        at 
org.apache.axis2.jaxws.message.impl.BlockImpl.getReader(BlockImpl.java:256)
        at 
org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:226)
        at 
org.apache.axiom.om.impl.llom.OMSourcedElementImpl.forceExpand(OMSourcedElementImpl.java:255)
        at 
org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getAttribute(OMSourcedElementImpl.java:412)
        at 
org.apache.axis2.jaxws.addressing.util.ReferenceParameterList.initialize(ReferenceParameterList.java:96)
        at 
org.apache.axis2.jaxws.addressing.util.ReferenceParameterList.size(ReferenceParameterList.java:74)
        at java.util.AbstractList$Itr.hasNext(AbstractList.java:339)
        at 
org.axis2.jaxws.sample.TestServiceImpl.newOperation(TestServiceImpl.java:27)


So how can I access the reference parameters in the service?

Thanks,
~Isuru

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to