Dridi, Saber wrote:
Hi,
Thanks a lot for your help Martin. Do you see or someone a way how to fetch the
host address from the request socket (socket.getInetAddress().getHostAddress()).
I mean is it possible to change the host address from the request socket bevor
the globus WS Core fetch it ?
My Target is to hide the ip address of the job requester (client) for the web
service in the globus container.
If this is not possible i will use 3 PC´s. The first PC act as a client (job
requester)
The second PC act as a web service which became the job request from the client
and send it the third PC which act as the server (globus conatiner).
This one execute the job and send the response to the web service in the second
pc. Finally this one send the job response to the client in the first pc.
In this case the web service in the second pc will act as a client for the
globus container in the third pc.
This sounds like the better way to me.
Martin
Anyhow i don´ t see another way how to hide the client host address for the
java ws core.
If someone has another idea please contact me.
thanks a lot
saber
thank you for your help. I have added the following code in my web service. I
see that the IP address of the client has been changed only in the
message context.
ResourceContext ctx = ResourceContext.getResourceContext();
String remoteAddress = (String)
ctx.getProperty(org.apache.axis.Constants.MC_REMOTE_ADDR);
System.out.println(remoteAddress);
ctx.setProperty(org.apache.axis.Constants.MC_REMOTE_ADDR,
"192.168.33.1");
String newAddress = (String)
ctx.getProperty(org.apache.axis.Constants.MC_REMOTE_ADDR);
System.out.println(newAddress);
But the Java WS Core fetches the host address from the request socket
(socket.getInetAddress().getHostAddress()). I added the following code in my
web service:
InetAddress hostname = InetAddress.getLocalHost();
String host = hostname.getHostName();
InetAddress callerId = InetAddress.getByName(host);
String ip = callerId.getHostAddress();
System.out.println(ip);
I became the local IP Address 127.0.1.1 Can you please tell me how can i
modify the ip address of the client in the web service so that the server will
became
the job request with the modified IP Address. I have implemented this web
service only to receive the job request from a client and to change the IP
Address of
this client. This web service send than the job request to the container.
Can you tell where does the Java WS Core fetch the host address.
thanks
saber
Um, so you want this for an arbitrary service, i thought it was about ws-gram
...
The things i described were ws-gram specific.
Java WS Core fetches the host address from the request socket
(socket.getInetAddress().getHostAddress()) and adds it as a property to
the message context. an arbitrary service can fetch the remote address
from the message context. try this:
...
import org.globus.wsrf.ResourceContext;
import org.apache.axis.Constants;
...
ResourceContext ctx = ResourceContext.getResourceContext();
String remoteAddress = (String) ctx.getProperty(Constants.MC_REMOTE_ADDR));
However, i don't see a way for you to get the port, as this information
is not made available.
If you need this, you'd have to think about designing your service interface
accordingly, i.e. pass the client ip and port as input parameters of your
service method(s).
Saber Dridi
Universität Siegen
Tel.: 01634679447
________________________________________
Von: Martin Feller [[email protected]]
Gesendet: Montag, 22. Dezember 2008 08:11
An: Dridi, Saber
Cc: [email protected]
Betreff: Re: [gt-user] Caller IP Address?
Um, so you want this for an arbitrary service, i thought it was about ws-gram
...
The things i described were ws-gram specific.
Java WS Core fetches the host address from the request socket
(socket.getInetAddress().getHostAddress()) and adds it as a property to
the message context. an arbitrary service can fetch the remote address
from the message context. try this:
...
import org.globus.wsrf.ResourceContext;
import org.apache.axis.Constants;
...
ResourceContext ctx = ResourceContext.getResourceContext();
String remoteAddress = (String) ctx.getProperty(Constants.MC_REMOTE_ADDR));
However, i don't see a way for you to get the port, as this information
is not made available.
If you need this, you'd have to think about designing your service interface
accordingly, i.e. pass the client ip and port as input parameters of your
service method(s).
Saber Dridi
Universität Siegen
Tel.: 01634679447
________________________________________
Von: Martin Feller [[email protected]]
Gesendet: Samstag, 17. Januar 2009 02:01
An: Dridi, Saber
Cc: [email protected]; [email protected]
Betreff: Re: [gt-user] Setting properties in a message context.
I cannot reproduce that (GT 4.2.1): If I modify this property and fetch it
again, then i'm getting the new value:
logger.info((String) ctx.getProperty(org.apache.axis.Constants.MC_REMOTE_ADDR));
ctx.setProperty(org.apache.axis.Constants.MC_REMOTE_ADDR,"hello");
logger.info((String) ctx.getProperty(org.apache.axis.Constants.MC_REMOTE_ADDR));
(prints "hello" for the second logging statement to my logfile)
Note that setting this property does not have any functional consequence as far
as
i know. The response to your WS request will NOT be sent to the new IP-address
you
provided. Setting the remote address to 'hello' (which is a pretty odd address)
does not even cause an error.
As far as i know, this is so because whatever you set there will not be used.
The server-side socket of your request which will be used to send the response
will
not be effected by changing this property in the MessageContext.
Martin
Dridi, Saber wrote:
Hi,
i have a question about the message context. Java WS Core fetches the host
address from the request socket
(socket.getInetAddress().getHostAddress()) and adds it as a property to the
message context.
The web service fetches the remote address from the message context.
I have implemented a handler class to catch the request message:
...
import org.globus.wsrf.ResourceContext;
import org.apache.axis.Constants;
...
ResourceContext ctx = ResourceContext.getResourceContext();
String remoteAddress = (String) ctx.getProperty(Constants.MC_REMOTE_ADDR));
So i want to insert a new remote address:
ctx.setProperty(Constants.MC_REMOTE_ADDR, "192.168.33.1");
but in the web service the following method display the remote address
127.0.1.1:
String remoteAddress = (String)
ctx.getProperty(org.apache.axis.Constants.MC_REMOTE_ADDR);
System.out.println(remoteAddress);
Can someone please correct how to set a property in the message context.
thanks a lot
saber
Saber Dridi
Universität Sie