Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Local ip address and port number of WS client

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic