You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Oleg Timofeyev <li...@2xdigi.com> on 2001/10/31 00:55:44 UTC

session maintance

Ok I deploy service with Session scope, and get the session ID by

org.apache.soap.rpc.SOAPContext cnt (taking in from the call)

HttpSession session = (HttpSession)
cnt.getProperty(Constants.BAG_HTTPSESSION);
session.getID();

For some reason each call from the same client gives me different session ID

what am I doing worng? any ideas

Thank you
Oleg


RE: session maintance

Posted by Ong Boon Pang <on...@coleridge.com.sg>.
Hi,

>Oh I see, so the session will persists for the same call object. Is there
>any way to implement a session for a a client, nomatter if its new or same
>call, but not application scope because than if anohter client accesses
>methods, there will be trouble.
Are you refering to the client side or server side of the SOAP?

If its client side,the code shown previously allow the all
3 Call objects: getID, square and cube  to use the same "shc" object
hence invoking those 3 call objects will maintain a single client session
on the server.

If its server side, you would want to code those 3 methods like:

private String getRunInfo(){
   return Thread.currentThread().toString()+" using obj: "+this.toString();
}


public String getID(SOAPContext soapCtx, String msg)throws SOAPException{
     String str=getRunInfo()+" running: getID("+msg+")";

     HttpSession httpSess= 
soapCtx.getProperty(org.apache.soap.Constants.BAG_HTTPSESSION);

     httpSess.setMaxInactiveInterval(900); // set session time out
     httpSess.setAttribute("getID", str);

         System.out.println(str);
         return str;
}

private int val= -1;

public String square(SOAPContext soapCtx, int num){
     val=num;
     HttpSession httpSess= 
soapCtx.getProperty(org.apache.soap.Constants.BAG_HTTPSESSION);
     String str=(String)httpSess.getAttribute("getID");

         System.out.println(getRunInfo()+" running: square("+num+") val:"+val);
     return "["+str+"]"+(num*num);
}

public String cube(SOAPContext soapCtx){
     HttpSession httpSess= 
soapCtx.getProperty(org.apache.soap.Constants.BAG_HTTPSESSION);
     String str=(String)httpSess.getAttribute("getID");

         System.out.println(getRunInfo()+" running: cube() val:"+val);

     return "["+str+"]"+(val*val*val);
}

Call getID, square, cube in such sequence... you should be able to see the 
difference.
Hope it helps...
If misunderstand your question, please clarify to me.

Cheers,
Boon Pang
ongbp@coleridge.com.sg
At 07:41 PM 10/30/2001 -0800, you wrote:
>Oh I see, so the session will persists for the same call object. Is there
>any way to implement a session for a a client, nomatter if its new or same
>call, but not application scope because than if anohter client accesses
>methods, there will be trouble.
>
>Sincerely,
>Oleg
>
>-----Original Message-----
>From: Ong Boon Pang [mailto:ongbp@coleridge.com.sg]
>Sent: Tuesday, October 30, 2001 7:26 PM
>To: soap-user@xml.apache.org
>Subject: Re: session maintance
>
>
>Hi Oleg,
>
>  >For some reason each call from the same client gives me different session
>ID
>That is b'coz you didn't use a single instance of
>org.apache.soap.transport.http.SOAPHTTPConnection
>across all Call Objects.
>
>private Call getID = new Call(), square=new Call(), cube=new Call();
>
>...
>SOAPHTTPConnection shc=new SOAPHTTPConnection();
>
>getID.setTargetObjectURI("urn:jsoap-svc-example");
>getID.setMethodName("getID");
>getID.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>getID.setSOAPTransport( shc);
>
>square.setTargetObjectURI("urn:jsoap-svc-math");
>square.setMethodName("square");
>square.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>square.setSOAPTransport( shc);
>
>cube.setTargetObjectURI("urn:jsoap-svc-math");
>cube.setMethodName("cube");
>cube.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>cube.setSOAPTransport( shc);
>
>cheers,
>Boon Pang
>ongbp@coleridge.com.sg


RE: session maintance

Posted by Ong Boon Pang <on...@coleridge.com.sg>.
Hi,

>Oh I see, so the session will persists for the same call object. Is there
>any way to implement a session for a a client, nomatter if its new or same
>call, but not application scope because than if anohter client accesses
>methods, there will be trouble.
Are you refering to the client side or server side of the SOAP?

If its client side,the code shown previously allow the all
3 Call objects: getID, square and cube  to use the same "shc" object
hence invoking those 3 call objects will maintain a single client session
on the server.

If its server side, you would want to code those 3 methods like:

private String getRunInfo(){
   return Thread.currentThread().toString()+" using obj: "+this.toString();
}


public String getID(SOAPContext soapCtx, String msg)throws SOAPException{
     String str=getRunInfo()+" running: getID("+msg+")";

     HttpSession httpSess= 
soapCtx.getProperty(org.apache.soap.Constants.BAG_HTTPSESSION);

     httpSess.setMaxInactiveInterval(900); // set session time out
     httpSess.setAttribute("getID", str);

         System.out.println(str);
         return str;
}

private int val= -1;

public String square(SOAPContext soapCtx, int num){
     val=num;
     HttpSession httpSess= 
soapCtx.getProperty(org.apache.soap.Constants.BAG_HTTPSESSION);
     String str=(String)httpSess.getAttribute("getID");

         System.out.println(getRunInfo()+" running: square("+num+") val:"+val);
     return "["+str+"]"+(num*num);
}

public String cube(SOAPContext soapCtx){
     HttpSession httpSess= 
soapCtx.getProperty(org.apache.soap.Constants.BAG_HTTPSESSION);
     String str=(String)httpSess.getAttribute("getID");

         System.out.println(getRunInfo()+" running: cube() val:"+val);

     return "["+str+"]"+(val*val*val);
}

Call getID, square, cube in such sequence... you should be able to see the 
difference.
Hope it helps...
If misunderstand your question, please clarify to me.

Cheers,
Boon Pang
ongbp@coleridge.com.sg
At 07:41 PM 10/30/2001 -0800, you wrote:
>Oh I see, so the session will persists for the same call object. Is there
>any way to implement a session for a a client, nomatter if its new or same
>call, but not application scope because than if anohter client accesses
>methods, there will be trouble.
>
>Sincerely,
>Oleg
>
>-----Original Message-----
>From: Ong Boon Pang [mailto:ongbp@coleridge.com.sg]
>Sent: Tuesday, October 30, 2001 7:26 PM
>To: soap-user@xml.apache.org
>Subject: Re: session maintance
>
>
>Hi Oleg,
>
>  >For some reason each call from the same client gives me different session
>ID
>That is b'coz you didn't use a single instance of
>org.apache.soap.transport.http.SOAPHTTPConnection
>across all Call Objects.
>
>private Call getID = new Call(), square=new Call(), cube=new Call();
>
>...
>SOAPHTTPConnection shc=new SOAPHTTPConnection();
>
>getID.setTargetObjectURI("urn:jsoap-svc-example");
>getID.setMethodName("getID");
>getID.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>getID.setSOAPTransport( shc);
>
>square.setTargetObjectURI("urn:jsoap-svc-math");
>square.setMethodName("square");
>square.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>square.setSOAPTransport( shc);
>
>cube.setTargetObjectURI("urn:jsoap-svc-math");
>cube.setMethodName("cube");
>cube.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>cube.setSOAPTransport( shc);
>
>cheers,
>Boon Pang
>ongbp@coleridge.com.sg


Interoperability Sites

Posted by Ian Snead <is...@ezgov.com>.
Hello all,

Could someone point me to some interoperability
sites that host public SOAP services? A range
of SOAP implementations ( MS Toolkit v2.0, 
Apache, etc. ) would be most useful.

I'm thinking of something similar to the resource
described at :

http://www.xmethods.net/soapbuilders/proposal.html

An extremely up-to-date list of interop snafu's
would be worth it's weight in caffine, too. :P

Thank you for any help,

Ian

--
Ian Snead
Software Developer
EzGov.com
Work : 404 836 7957

"Return a buffered reader to receive 
 back the response to whatever was sent to whatever."
 
 - from the Apache SOAP documentation

Interoperability Sites

Posted by Ian Snead <is...@ezgov.com>.
Hello all,

Could someone point me to some interoperability
sites that host public SOAP services? A range
of SOAP implementations ( MS Toolkit v2.0, 
Apache, etc. ) would be most useful.

I'm thinking of something similar to the resource
described at :

http://www.xmethods.net/soapbuilders/proposal.html

An extremely up-to-date list of interop snafu's
would be worth it's weight in caffine, too. :P

Thank you for any help,

Ian

--
Ian Snead
Software Developer
EzGov.com
Work : 404 836 7957

"Return a buffered reader to receive 
 back the response to whatever was sent to whatever."
 
 - from the Apache SOAP documentation

RE: session maintance

Posted by Oleg Timofeyev <li...@2xdigi.com>.
Oh I see, so the session will persists for the same call object. Is there
any way to implement a session for a a client, nomatter if its new or same
call, but not application scope because than if anohter client accesses
methods, there will be trouble.

Sincerely,
Oleg

-----Original Message-----
From: Ong Boon Pang [mailto:ongbp@coleridge.com.sg]
Sent: Tuesday, October 30, 2001 7:26 PM
To: soap-user@xml.apache.org
Subject: Re: session maintance


Hi Oleg,

 >For some reason each call from the same client gives me different session
ID
That is b'coz you didn't use a single instance of
org.apache.soap.transport.http.SOAPHTTPConnection
across all Call Objects.

private Call getID = new Call(), square=new Call(), cube=new Call();

...
SOAPHTTPConnection shc=new SOAPHTTPConnection();

getID.setTargetObjectURI("urn:jsoap-svc-example");
getID.setMethodName("getID");
getID.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
getID.setSOAPTransport( shc);

square.setTargetObjectURI("urn:jsoap-svc-math");
square.setMethodName("square");
square.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
square.setSOAPTransport( shc);

cube.setTargetObjectURI("urn:jsoap-svc-math");
cube.setMethodName("cube");
cube.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
cube.setSOAPTransport( shc);

cheers,
Boon Pang
ongbp@coleridge.com.sg
At 03:55 PM 10/30/2001 -0800, you wrote:
>Ok I deploy service with Session scope, and get the session ID by
>
>org.apache.soap.rpc.SOAPContext cnt (taking in from the call)
>
>HttpSession session = (HttpSession)
>cnt.getProperty(Constants.BAG_HTTPSESSION);
>session.getID();
>
>For some reason each call from the same client gives me different session
ID
>
>what am I doing worng? any ideas
>
>Thank you
>Oleg


RE: session maintance

Posted by Oleg Timofeyev <li...@2xdigi.com>.
Oh I see, so the session will persists for the same call object. Is there
any way to implement a session for a a client, nomatter if its new or same
call, but not application scope because than if anohter client accesses
methods, there will be trouble.

Sincerely,
Oleg

-----Original Message-----
From: Ong Boon Pang [mailto:ongbp@coleridge.com.sg]
Sent: Tuesday, October 30, 2001 7:26 PM
To: soap-user@xml.apache.org
Subject: Re: session maintance


Hi Oleg,

 >For some reason each call from the same client gives me different session
ID
That is b'coz you didn't use a single instance of
org.apache.soap.transport.http.SOAPHTTPConnection
across all Call Objects.

private Call getID = new Call(), square=new Call(), cube=new Call();

...
SOAPHTTPConnection shc=new SOAPHTTPConnection();

getID.setTargetObjectURI("urn:jsoap-svc-example");
getID.setMethodName("getID");
getID.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
getID.setSOAPTransport( shc);

square.setTargetObjectURI("urn:jsoap-svc-math");
square.setMethodName("square");
square.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
square.setSOAPTransport( shc);

cube.setTargetObjectURI("urn:jsoap-svc-math");
cube.setMethodName("cube");
cube.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
cube.setSOAPTransport( shc);

cheers,
Boon Pang
ongbp@coleridge.com.sg
At 03:55 PM 10/30/2001 -0800, you wrote:
>Ok I deploy service with Session scope, and get the session ID by
>
>org.apache.soap.rpc.SOAPContext cnt (taking in from the call)
>
>HttpSession session = (HttpSession)
>cnt.getProperty(Constants.BAG_HTTPSESSION);
>session.getID();
>
>For some reason each call from the same client gives me different session
ID
>
>what am I doing worng? any ideas
>
>Thank you
>Oleg


Re: session maintance

Posted by Ong Boon Pang <on...@coleridge.com.sg>.
Hi Oleg,

 >For some reason each call from the same client gives me different session ID
That is b'coz you didn't use a single instance of 
org.apache.soap.transport.http.SOAPHTTPConnection
across all Call Objects.

private Call getID = new Call(), square=new Call(), cube=new Call();

...
SOAPHTTPConnection shc=new SOAPHTTPConnection();

getID.setTargetObjectURI("urn:jsoap-svc-example");
getID.setMethodName("getID");
getID.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
getID.setSOAPTransport( shc);

square.setTargetObjectURI("urn:jsoap-svc-math");
square.setMethodName("square");
square.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
square.setSOAPTransport( shc);

cube.setTargetObjectURI("urn:jsoap-svc-math");
cube.setMethodName("cube");
cube.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
cube.setSOAPTransport( shc);

cheers,
Boon Pang
ongbp@coleridge.com.sg
At 03:55 PM 10/30/2001 -0800, you wrote:
>Ok I deploy service with Session scope, and get the session ID by
>
>org.apache.soap.rpc.SOAPContext cnt (taking in from the call)
>
>HttpSession session = (HttpSession)
>cnt.getProperty(Constants.BAG_HTTPSESSION);
>session.getID();
>
>For some reason each call from the same client gives me different session ID
>
>what am I doing worng? any ideas
>
>Thank you
>Oleg


Re: session maintance

Posted by Ong Boon Pang <on...@coleridge.com.sg>.
Hi Oleg,

 >For some reason each call from the same client gives me different session ID
That is b'coz you didn't use a single instance of 
org.apache.soap.transport.http.SOAPHTTPConnection
across all Call Objects.

private Call getID = new Call(), square=new Call(), cube=new Call();

...
SOAPHTTPConnection shc=new SOAPHTTPConnection();

getID.setTargetObjectURI("urn:jsoap-svc-example");
getID.setMethodName("getID");
getID.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
getID.setSOAPTransport( shc);

square.setTargetObjectURI("urn:jsoap-svc-math");
square.setMethodName("square");
square.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
square.setSOAPTransport( shc);

cube.setTargetObjectURI("urn:jsoap-svc-math");
cube.setMethodName("cube");
cube.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
cube.setSOAPTransport( shc);

cheers,
Boon Pang
ongbp@coleridge.com.sg
At 03:55 PM 10/30/2001 -0800, you wrote:
>Ok I deploy service with Session scope, and get the session ID by
>
>org.apache.soap.rpc.SOAPContext cnt (taking in from the call)
>
>HttpSession session = (HttpSession)
>cnt.getProperty(Constants.BAG_HTTPSESSION);
>session.getID();
>
>For some reason each call from the same client gives me different session ID
>
>what am I doing worng? any ideas
>
>Thank you
>Oleg