Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Local ip address and port number of WS client

 
Nils Kruemel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I've created a WS client using wsimport. For my question you may refer to an example taken from http://www.javadb.com/create-a-web-service-client-with-jax-ws .
Here is the corresponding client code:




Well, my problem now is how can I get the LOCAL IP address and TCP port number that is used by the CLIENT when calling the web service? I need this information for logging purposes. There are several network interfaces attached. I managed to retrieve all exchanged SOAP messages with a handler but I think IP address and port number are not accessible in a SOAPMessageContext that is used there.

Any ideas? Thanks in advance.
Nils
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you adapt the service code for this? It can retrieve both the client IP and client port, and send those back as part of the response.
 
Nils Kruemel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, I have no influence on the web service. I have to find a way to do it with the client code.
It would be a shame if it is not possible to do it with the straightforward wsimport code generation since it is really easy to use.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saying "it would be a shame" would be taking it rather far, IMO. This is arcane functionality that's not germane to web services (which are not wedded to any particular transport mechanism, after all).

If you dig deep into the WS client-side code (not the generated code - the source code of the SOAP stack you're using) you should be able to get at the Socket object being used; it can provide you with the local port and IP address.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic