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
Macromedia
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10, 2002 12:49 PM
To: [EMAIL PROTECTED]
Subject: RE: getting request hostname/IP


Tom,
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)
-Dug

Please respond to [EMAIL PROTECTED]

To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc:
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
Macromedia


-----Original Message-----
From: Davanum Srinivas [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 08, 2002 12:35 AM
To: [EMAIL PROTECTED]
Subject: Re: cvs commit:
xml-axis/java/src/org/apache/axis/transport/http SimpleAxisWorker.java


Tom,

Is this what u are looking for?

Thanks,
dims

--------------------------------------------------------------------------------
import java.net.*;
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) {
    System.out.println(

    "Could not find this computer's address.");
    }
}
}
--------------------------------------------------------------------------------



--- [EMAIL PROTECTED] wrote:
> tomj        2002/06/07 14:36:30
>
>   Modified:    java/src/org/apache/axis/transport/http
>                         SimpleAxisWorker.java
>   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/SimpleAxisWorker.java
>
>   Index: SimpleAxisWorker.java
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisWorker.java,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- SimpleAxisWorker.java 7 Jun 2002 18:31:58 -0000 1.1
>   +++ SimpleAxisWorker.java 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 0.0.0.0
>   +                //  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 -
http://xml.apache.org/~dims/

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

Reply via email to