I think you are facing the same issues as in the following threads:

http://mail-archives.apache.org/mod_mbox/ws-axis-user/200503.mbox/[EMAIL PROTECTED]
http://www.mail-archive.com/axis-user@ws.apache.org/msg03143.html

Reasons I can think of are that when using the ((SOAPMessageContext)context).setMessage(soapMessage) API you may need to be careful to ensure that it isn't actually modifying the 'request' soapMessage.

That said, I think you still can resolve the problem that you are facing, since really you are not trying to modify the request message.

In the response handler, you may want to try this:

///// some logic here to generate response...

org.apache.axis.MessageContext context = org.apache.axis.MessageContext.getCurrentContext();

context.setResponseMessage((Message) responseMessage);

return true;
          
////

Best,
-Arun

On 10/11/05, Mathew, Jose <[EMAIL PROTECTED]> wrote:
Well, I could track it down to "Invocation arguments were modified" exception in HandlerChainImpl class. Apparently axis checks to see if the original invocation arguments were modified in the postinvoke( ) method there. So does that mean that altering the SOAPBody in a handler is not allowed??
 
- Jose
 

From: Mathew, Jose
Sent: Tuesday, October 11, 2005 8:53 AM
To: axis-user@ws.apache.org
Subject: RE: Help with Axis Handlers!!

Thanks Arun!
 
I have been using Axis' handlers, now I have switched to JAXPRC Handlers like you suggested. One problem, though..  in my scenario, I have just one Handler class, and I make use of the handleRequest (return false) and handleResponse (return true) methods to process my request and response , and completely avoid execution of the actual end point by returning false from handleRequest method. In my handleResponse , I need to set a new message into the messagecontext . I do it like this..
 
ByteArrayInputStream bis = new ByteArrayInputStream(response.getBytes());
InputSource is = new InputSource((java.io.InputStream)bis);
   
SOAPMessage soapMessage= MessageFactory.newInstance().createMessage();      
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document soapDoc = parser.parse(is);     
soapMessage.getSOAPPart().getEnvelope().getBody().addDocument(soapDoc);
   
((SOAPMessageContext)context).setMessage(soapMessage);  // Is there a setResponseMessage( ) instead?
((SOAPMessageContext)context).getMessage().writeTo(System.out);
 
 
The handleResponse proceeds with out any errors, but in the response at the client side, i keep getting a "Server Error" SOAP fault message. I am pretty sure that the message I am setting in the SOAPMessageContext is a 'good' SOAP message, since it was working while I was using Axis Handlers..
 
Any idea what is going wrong? Any help would be greatly appreciated.
 
Thanks again
 
Jose Mathew


From: Soactive Inc [mailto:[EMAIL PROTECTED]]
Sent: Sunday, October 09, 2005 1:04 AM
To: axis-user@ws.apache.org
Subject: Re: Help with Axis Handlers!!

You need to return false in the request handling function of the handler that you would like to skip rest of the handlers:

public boolean handleRequest(MessageContext mc) {

   // some logic

   // once you decide to quit the remainder of the chain, set the appropriate response message and return false

   context.setResponseMessage(someResponseMessage);

   return false;
}

-Arun

On 10/7/05, Mathew, Jose <[EMAIL PROTECTED]> wrote:
I am using Axis 1.2
As part of something I am trying to do, I would like to break out of a Request handler I have for a service, and return a SOAP response, without going further down the chain (skip deserialization etc) . Is this possible? Can anyone help me with any tips?
Thanks.
Jose Mathew


Reply via email to