aspose file tools*
The moose likes Web Services and the fly likes Request and Response handlers (Axis2) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Request and Response handlers (Axis2)" Watch "Request and Response handlers (Axis2)" New topic
Author

Request and Response handlers (Axis2)

padma harika pottamsetty
Greenhorn

Joined: Jun 27, 2011
Posts: 7
Hi

i have deployed a webservice in JBoss and Then added two handlers before the service.One handlers(Request handler) takes the incoming soap message and prints it out and similarly the outgoing messgage from the service passed through another handler ( Response Handler) and prints out a mesasge.Bothe teh handlers are defined as two seperate class files.

what I want to do is , Can I directly send teh message from the Request Handler to Response Handler instead of hitting the service and coming back?

Thank you
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 409
    
    3
I take this as an opportunity to see how handler chain work:

Assumption:
Consumer end-point ---------> [ Handler A on Provider side ------> Provider end-point ]

-Suppose we have a simple case where we ignore/block the incoming request,
In this case, the Handler A (via underlying SOAP engine) will not forward the request to the Provider end-point.
It's the duty of the Handler A
1) prepare a customized response if needed
2) or let the default reponse to be the orginal request itself
so that the underlying SOAP engine will pass back to the Consumer end-point.



Now in your AXIS2 case, you have 2 different handlers: 1 RequestHandler and 1 for ResponseHandler

I would only *guess*, in your RequestHandler:
if somehow by code you tell AXIS2 not to forward the request to the end-point, then AXIS2 will not forward the request to the End-Point
Then AXIS2 will call ResponseHandler to do whatever it wished (implicitly going back to Client)

Just doing an experiment with a debugger and you will the flow of handler chaining. Go luck.

This is like "Trust But Verify."
padma harika pottamsetty
Greenhorn

Joined: Jun 27, 2011
Posts: 7
Hi paul
Well I tried doing what you said , about "if somehow by code you tell AXIS2 not to forward the request to the end-point, then AXIS2 will not forward the request to the End-Point "
My code:


RequestHandler:


Respaonse Handler


So in the request handler the Changes that I made was , instead of CONTINUE, I replaced it with ABORT.But that completely stopped the message to flow further .
I even tried hardcoding a soap message in response handler, so as to sent it back to the client.But I could only the request and no response.
I dint understand how to exactly stop the message from going to the endpoint.


Also I wanted clarify on one thing , the two ways you defined .. can they be still used by axis2?


Thank You
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 409
    
    3
1. Go to Axis2
http://axis.apache.org/axis2/java/core/docs/jaxws-guide.html#Handlers

2. Also, use Google or Search this forum to see which AXIS or AXIS2 support JAX-RPC handler and/or JAX-WS handler.
You'll get the answer.

3. BTW, There is also http://www.coderanch.com/how-to/java/WebServicesFaq

As always, go luck to you.
padma harika pottamsetty
Greenhorn

Joined: Jun 27, 2011
Posts: 7
Thank will try looking into it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Request and Response handlers (Axis2)