axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Jordahl <>
Subject RE: getting request hostname/IP
Date Mon, 10 Jun 2002 12:22:56 GMT
I would be +1 to changing the hardwired localhost to use the IP address of the local host.
That is better than what we have.
Again, check out the latest CVS tree to be sure that this MessageContext variable is still
I know you can specify a static WSDL in the wsdd file, which Axis will use instead of generating
(every time!) the WSDL on the fly.
Tom Jordahl

-----Original Message-----
From: []
Sent: Monday, June 10, 2002 2:16 PM
Subject: RE: getting request hostname/IP

Don't assume SimpleAxisServer is just for testing. I know of people that are using it in place
of Tomcat because all they really want is Axis listening on a port without having the overhead
of an real app server. So rather than reinventing the wheel they're just using SimpleAxisServer.
Also, because they don't have an app server they need some way to host their WSDL and ?wsdl
on SimpleAxisServer works well for that too - modulo this hostname bug.

Using the hostname isn't great, I agree, I wanted to use the IP address since in a DHCP environment
hostnames don't always work, and I did use the IP address at first but stopped - and I can't
remember what problem I ran into though - I _think_ it might have been a namespace issue.

I'll look into specifying the namespace in the wsdd - if that works that would be great. thanks.


Please respond to 

To: "''" <>
Subject: RE: getting request hostname/IP

Keep in mind this is just for SimpleAxisServer, which is pretty much only used for testing.
Also, in a environment where a hostname lookup wont work (the recent interop for instance,
we used fixed IP address), using the hostname isn't the best.  This is why I would prefer
to get the info from the request.
I think Rick R. recent submit will do the right thing, but I haven't tested it.
As far as setting the namespace from the URL, I believe the right thing here is to specify
the namespace of the service in the deployment description (wsdd).  We might have this already,
I'm not sure.  JWS files would could use the config interface (which needs to be updated so
we can get all the service description info from a JWS (or any) class itself...
Tom Jordahl
-----Original Message-----
From: [ <> ]
Sent: Monday, June 10, 2002 12:49 PM
Subject: RE: getting request hostname/IP

I was just looking at this the other day, using "localhost" is really bad
since when someone uses ?wsdl they'll get "localhost" in the WSDL which
makes it useless. In our local copy we use:
String hostname = InetAddress.getLocalHost().getHostName();
but I didn't check it in because some tests broke. I think the tests are 
wrong but didn't get a chance to look into it.
On a side note - it sure would be nice if ?wsdl supported some options
like setting of the namespace from the URL (ie. ?wsdl&namespace=urn:foo)

Please respond to 

To: "''" <>
Subject: RE: getting request hostname/IP

Yes, that actually is  close.
But what I really want is to reflect back in the WSDL the address or  hostname (and it could
be either) that was used by the  request.

But failing that, we should probably just set the  value to the local host IP address.
This may be trouble on machines with  more than 1 IP address however....

Tom  Jordahl

-----Original Message-----
From:  Davanum Srinivas [  <>]
Sent: Saturday,  June 08, 2002 12:35 AM
Subject: Re: cvs  commit:


Is this what u  are looking  for?


class myAddress { 

	public static void main (String args[]) {
try { 

	InetAddress address =  InetAddress.getLocalHost();
System.out.println("This computer's address  = " +address.getHostName());
System.out.println("This computer's ip = "  +address.getHostAddress());

	} catch (UnknownHostException e)  
"Could not find this computer's  address.");


--- wrote:
> tomj        2002/06/07  14:36:30
>   Modified:     java/src/org/apache/axis/transport/http
>   Log:
>   Fix the broken fix I  submitted which sets the hostname used for
>   WSDL locations.   Can't seem to get the ip address and/or hostname
>   that I  need so put back the hardwired 'localhost'.  This is broken, but
>    for what we use SimpleAxisServer for, it is sufficient.
>    Revision  Changes    Path
>   1.2        +9 -1       xml-axis/java/src/org/apache/axis/transport/http/
>    Index:
>    ===================================================================
>    RCS file:  /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/,v
>    retrieving revision 1.1
>   retrieving revision 1.2
>    diff -u -r1.1 -r1.2
>   --- 7 Jun 2002  18:31:58 -0000 1.1
>   +++ 7 Jun 2002  21:36:30 -0000 1.2
>   @@ -268,7 +268,15 @@
>                      msgContext.setProperty(Constants.MC_JWS_CLASSDIR,
>                              "jwsClasses");
>   -                 String hostname =  socket.getInetAddress().getHostName();
>   +                 // FIXME
>   +                 // This doesn't return anything but
>   +                 //  String hostname =  serverSocket.getInetAddress().getHostAddress();
>   +                 // And this returns the hostname of  the host on the other
>   +                 // end of the socket:
>   +                 //  String hostname =  socket.getInetAddress().getHostName();
>   +                 // This works for 99% of the uses of  SimpleAxisServer,
>   +                 // but is very stupid
>   +                 String hostname = "localhost";
>                     // !!!  Fix string concatenation
>                     String url = "http://" + hostname + ":" +
>                              server.getServerSocket().getLocalPort() + "/"  

Davanum Srinivas -    <>

Do  You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup

View raw message