You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sardar Hussain <sa...@yahoo.com> on 2011/02/05 03:50:17 UTC

[AXIS2] Redirecting a response from axis2 handler to client

Hi,

I have a custom module deployed on axis2 server side. While the client  request goes to that handler in an inflow, i want it should create one error response in that handler
 and send back to client without doing any further processing or forwarding the client request to the Web Service. How can I achieve this, any clue or tutorial please?



  Regards,

Sardar Hussain



      

Re: [AXIS2] Redirecting a response from axis2 handler to client

Posted by Deepal jayasinghe <de...@gmail.com>.
If you throw an exception with the reason from your handler, then client
should get a SOAP fault with that fault message. Or else you can create
a Faulty message and send it to the client, I cloud not find a specific
document to explain it, but if you have access to code most
MessageReceivers do this.

Deepal
> Thank you Deepal, but how can I access that at the client side? I did
> this earlier but I could not get meaningful data from that. Like I
> want to abort and also deliver some specific integer value like 5 in
> response to the client.As I want to add something extra as well like
> my custom message in response too. I don't know how to get a specific
> value for example some string or integer value.
> When I use the following code I can't get that specific values.
>
> ServiceClient sc = new ServiceClient();
>  
>         OperationClient opClient = sc.createClient(
>                 ServiceClient.ANON_OUT_IN_OP);
>         //creating message context
>         MessageContext outMsgCtx = new MessageContext();
>         //assigning message context's option object into instance
> variable
>         Options opts = outMsgCtx.getOptions();
>         //setting properties into option
>         opts.setTo(new EndpointReference(
>                 "http://127.0.0.1:8000/axis2/services/MyService"));
>         opts.setAction("urn:echo");
>         outMsgCtx.setEnvelope(creatSOAPEnvelop());
>  
>         opClient.addMessageContext(outMsgCtx);
>  
>         //pass message label as method argument
>         MessageContext inMsgtCtx = opClient.getMessageContext("In");
>         SOAPEnvelope response = inMsgtCtx.getEnvelope();
>
> Regards,
>
> sardar hussain
>
> --- On *Fri, 4/2/11, Deepal Jayasinghe /<de...@opensource.lk>/* wrote:
>
>
>     From: Deepal Jayasinghe <de...@opensource.lk>
>     Subject: Re: [AXIS2] Redirecting a response from axis2 handler to
>     client
>     To: java-user@axis.apache.org
>     Date: Friday, 4 February, 2011, 18:53
>
>     You can simply throw an exception inside your handler, or you can
>     return Invocation.ABORT as the return value
>
>     Deepal
>
>>     Hi,
>>
>>     I have a custom module deployed on *axis2* server side. While the
>>     client  request goes to that *handler* in an inflow, i want it
>>     should create one error response in that *handler* and send back
>>     to client without doing any further processing or forwarding the
>>     client request to the Web Service. How can I achieve this, any
>>     clue or tutorial please?
>>
>>     Regards,
>>
>>     Sardar Hussain
>>
>>
>


Re: [AXIS2] Redirecting a response from axis2 handler to client

Posted by Sardar Hussain <sa...@yahoo.com>.
Thank you Deepal, but how can I access that at the client side? I did this earlier but I could not get meaningful data from that. Like I want to abort and also deliver some specific integer value like 5 in response to the client.As I want to add something extra as well like my custom message in response too. I don't know how to get a specific value for example some string or integer value. 
When I use the following code I can't get that specific values.

ServiceClient sc = new ServiceClient();
 
        OperationClient opClient = sc.createClient(
                ServiceClient.ANON_OUT_IN_OP);
        //creating message context
        MessageContext outMsgCtx = new MessageContext();
        //assigning message context's option object into instance variable
        Options opts = outMsgCtx.getOptions();
        //setting properties into option
        opts.setTo(new EndpointReference(
                "http://127.0.0.1:8000/axis2/services/MyService"));
        opts.setAction("urn:echo");
        outMsgCtx.setEnvelope(creatSOAPEnvelop());
 
        opClient.addMessageContext(outMsgCtx);
 
        //pass message label as method argument
        MessageContext inMsgtCtx = opClient.getMessageContext("In");
        SOAPEnvelope response = inMsgtCtx.getEnvelope();

Regards,

sardar hussain

--- On Fri, 4/2/11, Deepal Jayasinghe <de...@opensource.lk> wrote:

From: Deepal Jayasinghe <de...@opensource.lk>
Subject: Re: [AXIS2] Redirecting a response from axis2 handler to client
To: java-user@axis.apache.org
Date: Friday, 4 February, 2011, 18:53



  

    
  You can simply throw an exception inside your handler, or you can
    return Invocation.ABORT as the return value

    

    Deepal

    

    
      
        
          
            Hi,

              

              I have a custom module deployed on axis2
              server side. While the client  request goes to that handler in an inflow, i want it should create
              one error response in that handler and
              send back to client without doing any further processing
              or forwarding the client request to the Web Service. How
              can I achieve this, any clue or tutorial please?

              

              Regards,

              

              Sardar Hussain

            
          
        
      
      

    
  



      

Re: [AXIS2] Redirecting a response from axis2 handler to client

Posted by Deepal Jayasinghe <de...@opensource.lk>.
You can simply throw an exception inside your handler, or you can return
Invocation.ABORT as the return value

Deepal

> Hi,
>
> I have a custom module deployed on *axis2* server side. While the
> client  request goes to that *handler* in an inflow, i want it should
> create one error response in that *handler* and send back to client
> without doing any further processing or forwarding the client request
> to the Web Service. How can I achieve this, any clue or tutorial please?
>
> Regards,
>
> Sardar Hussain
>
>