HTTP params of the connection
Hi,
Is there any way how to get HTTP connection parameters/attributes when using WS?
I have WS on AS and client connect into it using SOAP over HTTP and I need to get HTTP attrs/params for the connection. The param(s) I'm interested in is SESSIONID/JSESSIONID.
Thanks to all.
Pat
[311 byte] By [
x-st0rma] at [2007-11-26 23:52:11]

# 1
Hi Pat,I think you wont be able to get it.But why do you need that, you can ask the login parameters from the user and create the session in application side and maintain it in application side.Regards,Mukunt
# 2
Hi,
Well, I need to keep kind of "token" to provide "stateful" WS ... . That was the first thought - probably not the best one.
OK, my J2EE application is going to be a client to the WS server. If you know about tutorial/sample how to handle it I'll be thankful !!!
Thanks a lot.
Pat
# 3
Hi Pat,
I have only worked on the WS part. I guess what you can do is
1.Your WS client should call the login API in your WS and get the sessionid back
2.In subsequent calls, the client should send the sessionid as one of the parameters which the server will have to validate
This is how my application works
Regards,
Mukunt
# 5
Hi Pat,
Unfortunately I dont have the code now.
Its like following
1.The call1 sends username/passwd to WS
2.Generate a rand #(session id) and send it back to the client as the result of successful login .
3.Maintain that session id in memory to validate subsequent connections(u may set expiry time etc)
4.The client has ab object alled Request , which is the super calss class for all types of requests to the WS. This Request object has a variable called sessionId
5.FIll the sessionId variable in Request and send to the server
Hope this helps you
Regards,
Mukunt
# 6
Hello,
I must be blind :-( The steps are clear to me, but cannot find the proper point in the code to do that. Could you point me to the methods of the WS I have to focus on?
Right now I have code for DII (from the J2EE1.4 tutorial), so I have javax.xml.rpc.Service and javax.xml.rpc.Call objects to play with, but I'm afraid these are not the correct one.
Still cannot find solution for the client :-(
Thanks a lot
Pat
# 7
Hello,
So, I found the solution to keep http cookies. (next questions are at the bottom of the message).
steps are these:
~~~
server:
~~~
1) use RPC style (when I try this with document style I received only errors when trying to create method Call).
2) create server implementation from the WSDL (or from scratch)
3) the server implementation has to implement javax.xml.rpc.server.ServiceLifecycle interface and provide necessary implementations
client:
~~~
1) generate implementation from the WSDL
2) follow the steps from the J2EE 1.4 tutorial section "Dynamic Invocation Interface Client"
3) when the login operation s successful, then over Call object do this:
Object cookieJar = call.getProperty("com.sun.xml.rpc.client.http.CookieJar");
the cookieJar contains (I hope) all cookie from the HTTP response
4) when creating next call after the login, simply setup the cookieJar as property, like this:
call.setProperty("com.sun.xml.rpc.client.http.CookieJar", cookieJar);
And that's it :-)
Questions:
~~~
1) Is it possible to create Call objects in the document WS style and how?
2) I think, better solution will be using SOAPMessage, etc. classes, but how to use them at all. Can someone point me to the sample which explains this way?
3) If there's another way how to do this, please let me know.
Thanks to all.
Pat