Thanks Martin! Without discussion like this, it'll take me hours and days of time to find out those tricks.
Best,
Daniel


Martin Gainty wrote:

Daniel-
the suggestion gets the request from SOAPContext via
HttpServletRequest hsr = req.getProperty(Constants.BAG_HTTPSERVLETREQUEST);

you can then get ALL of the HTTP Variable parameters that the Request has
access to via
hsr.getQueryString() OR
hsr.getHost()
to see all the HTTP Variables you have access to take a look at
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletRequest.html
Regards,
-Martin
----- Original Message ----- From: "Daniel Zhang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 26, 2004 9:27 AM
Subject: Re: SOAP method to get server/ip of incoming message source





Thank you Scott! That's what I want. We are using messaging API.
Actually I am looking at the SOAPContext class, but I didn't find method
to getRemoteAddr/getRemoteHost directly and I don't the trick to use
getProperty(Constants.BAG_HTTPSERVLETREQUEST).

Daniel

Scott Nichol wrote:



You will need to access the SOAPContext for the request. This allows you


to access the HttpServletRequest, on which the getRemoteAddr or
getRemoteHost method will give you what you need.


Does your service use the RPC or messaging API? For the messaging API,


you get the SOAPContext for the request passed into your service method.
For the RPC API, you need to use a trick: add SOAPContext as the first
parameter to your method. For example, if your method is


  String foo(String bar, int baz)

change it to

  String foo(SOAPContext req, String bar, int baz)

Now that you have the SOAPContext, use the getProperty method with the


parameter Constants.BAG_HTTPSERVLETREQUEST, i.e.


HttpServletRequest hsr =


req.getProperty(Constants.BAG_HTTPSERVLETREQUEST);


This is documented in the User Guide


(http://ws.apache.org/soap/docs/guide/migration.html).


Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- From: "Daniel Zhang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 25, 2004 2:30 PM
Subject: SOAP method to get server/ip of incoming message source







Hi, All:

In SOAP package, is there any method could retrieve servername/IP of
incoming source?  I need a method sitting on the server side to tell the
client servername or IP.

Thanks,

Daniel










Reply via email to