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: [email protected]
  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

Reply via email to