axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guo Tianchong" <gu...@nec-as.nec.com.cn>
Subject Re: Axis 1.3 - Problem with Handler
Date Tue, 16 Dec 2008 06:17:58 GMT
hi, Hari

I am working with Axis2 1.4.1 and don't know well about Axis 1.3.
Sorry!

but I also remain concerned about this issue.

guo.
  ----- Original Message ----- 
  From: Harikrishna Vemula
  To: axis-user@ws.apache.org
  Sent: Tuesday, December 16, 2008 2:05 PM
  Subject: Re: Axis 1.3 - Problem with Handler


  Hi guo,
       Thanks,
  But in Axis 1.3 we don't have InvocationResponse object itself. In 1.3 invoke method return
type is void. So, as per my knowledge 
only way to stop the process and send back the response by throwing Fault.
  But is there any other way by which we can catch Fault and process the fault message and
send back normal response to client?

  JAX-RPC is having methods with return type true for handleRequest method, how to use JAXRPC
handlers in axis? Any idea?

  Thanks in advance...

  -Hari



  On Tue, Dec 16, 2008 at 6:56 AM, Guo Tianchong <guotc@nec-as.nec.com.cn> wrote:

    Hi,

    you can do something in the Handler's invoke() method
    and encapsulate a new SOAP body in the MessageContext object.

    Using AXIOM, that looks like :


    public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {

            SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
            OMNamespace soapNamespace = fac.createOMNamespace(Constants.URI_SOAP11_ENV, "soap");

            // make envelope element
            SOAPEnvelope newEnvelope = fac.createSOAPEnvelope(soapNamespace);

            // make header element
            SOAPHeader header = fac.createSOAPHeader(newEnvelope);
            // add your header blocks here
            ......

            // make body element
            SOAPBody body = fac.createSOAPBody(newEnvelope);
            // add your body response here
           // body.addChild(.....)

           msgContext.setEnvelope(newEnvelope);

            return InvocationResponse.CONTINUE;

    }



    Please have a try.

    guo

      ----- Original Message ----- 
      From: Harikrishna Vemula
      To: axis-user@ws.apache.org
      Sent: Monday, December 15, 2008 10:36 PM
      Subject: Axis 1.3 - Problem with Handler


      Hi,
         I have a Webservice for that i implemented a Handler to validate input request with
XSD. Whenever any exception occurs in 
invoke method i'm throwing AxisFault. But client doesn't want to have exception as return
value even though any exception occurs.
      Client is expecting to recieve a normal SOAP response with ErrorCode & ErrorMsg
parameters in the response.

      How can i send response with ErrorCode & ErrorMsg when any exception raised in Handlers?

      Please help me out, this is an urgent requirement.

      Thanks in advance...
      -- 
      Hari Krishna Vemula




  -- 
  Hari Krishna Vemula

Mime
View raw message