aspose file tools*
The moose likes Web Services and the fly likes How to identify client calls from server side Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to identify client calls from server side" Watch "How to identify client calls from server side" New topic
Author

How to identify client calls from server side

Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
we have a web service running in jboss as 4.2 and we have to check which client is accessing (just atleast one identity is enough). i.e. we there should be an indication that one client is accessing the web service in the console.

Is there any possibilities to get that client information form web service running console?


Thanks,
Kumar
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Unless you enclose some information that helps you identify the client in requests to the server, I think the only piece of information giving information about the client is the IP address from which the request originates.
This is the "drawback" of web services - they are meant to be language and technology independent.
Best wishes!
Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
Hi Ivan,
Thanks for replying to my question. Atleast if I get that IPaddress or so information, thats enough to identify client.
Could you please give me a clue how to get that information.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Use the following procedure to be able to retrieve the IP address of the client, or the last proxy, form which the request was sent:
1. Have a WebServiceContext injected in the endpoint implementation class.
2. At request time, retrieve a MessageContext from the WebServiceContext.
3. From the MessageContext you can retrieve the servlet request object for the request using the MessageContext.SERVLET_REQUEST constant.
4. From the servlet request object you can retrieve the IP address using the ServletRequest.getRemoteAddress() method.
Best wishes!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to identify client calls from server side