File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes finding response time for quality of webservices using java in axis2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "finding response time for quality of webservices using java in axis2" Watch "finding response time for quality of webservices using java in axis2" New topic
Author

finding response time for quality of webservices using java in axis2

srividhya natarajan
Greenhorn

Joined: Dec 15, 2011
Posts: 1
hey ..
is it possible to find the response time for java soap webservices using java ....
if it is possible please let me know....




with regards,
vidhya
Arun Kumar
Ranch Hand

Joined: Oct 10, 2007
Posts: 30
one of the ways is by using handlers on client/server side.
handlers would have access to both request and response.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Yes, as Arun Kumar says, you can use handlers.
Assume you want to find the time it takes for a request to travel from the client until the client receives the corresponding response:
1. In the client-side handler, add a timestamp in a SOAP header of outgoing messages.
2. In the server-side handler, insert the timestamp from ingoing messages into the MessgeContext of each message and, for outgoing messages, transfer the timestamp from the MessageContext to a SOAP header.
Properties in the MessageContext are copied from the incoming message to the outgoing response.
3. In the client-side handler, when receiving a message with a timestamp, calculate and log the time it took for the request.

The above approach have the drawback that it does not separate the time spent "on the wire" from the time taken to actually process a request.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Rahul Ury
Greenhorn

Joined: Dec 29, 2011
Posts: 2
Hi - I am new to Axis2 and am also trying to do the same. I used the operationContext to set the current time when the action is of type request
and then used it to calculate the duration when the action is of type response.
Do you see any problem with this approach ?
Here is some relevant code

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Are you experiencing any problems with your implementation?
I am not familiar with the Axis web service stack, so I cannot really tell if my suggestions work with it. If it adheres to the JAX-WS standard, then there should (theoretically) be no problems.
Best wishes!
Rahul Ury
Greenhorn

Joined: Dec 29, 2011
Posts: 2
It seems to be working fine although I am not entirely clear on what "Operation Context" means. I assume it means for a given user & for a given session & most importantly one user operation (ie) one webservice operation call done by the user.

If I were to do this in a generic non-axis2 way, or said differently,
On the server side, how do I pass ANY information between a request message and its corresponding response message ?
I think the statement 2 you made
2. In the server-side handler, insert the timestamp from ingoing messages into the MessgeContext of each message and, for outgoing messages, transfer the timestamp from the MessageContext to a SOAP header.
Properties in the MessageContext are copied from the incoming message to the outgoing response.

addresses it, but can you please elaborate with a code snippet please ?

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: finding response time for quality of webservices using java in axis2
 
Similar Threads
Multiple endpointInterface
Simple Web Services application ?
possible to intercept an Ajax response
develop web services in struts
JAVA CAPS