  | |  | How does Stub.setMaintainSession(boolean) work | How does Stub.setMaintainSession(boolean) work 2005-06-01 - By Bala Ramakrishnan (balar)
Back I have this piece of code that establishes the Soap handle used to make subsequent API calls. private Config createConfigHandle() { try { URL sURL = new URL(hprotocol + "://" + wlse_ip + ":" + httpport + "/services/Config"); m_logger.info("service URL is: " + sURL) ; ConfigService service = new ConfigServiceLocator(); Config config = service.getConfig(sURL) ; ConfigSoapBindingStub stub = (ConfigSoapBindingStub)config; stub.setMaintainSession(true); stub.setUsername(username); stub.setPassword(password); return config; } I use the handle to invoke all the methods exposed in the "Config" interface. If I change the call: stub.setMaintainSession(true);
to stub.setMaintainSession(false); What is the impact? Can I make multiple calls using the same handle? does Soap automatically create new session for each API call? or do I have to invoke setUserName(), and setPassword() before every API invocation if I call stub.setMaintainSession(false)?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=us-ascii"> <META content="MSHTML 6.00.2800.1498" name=GENERATOR></HEAD> <BODY> <DIV><FONT face=Arial size=2><SPAN class=823331119-01062005>I have this piece of code that establishes the Soap handle used to make subsequent API calls.</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=823331119-01062005></SPAN></FONT> </DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005>private Config createConfigHandle() {<BR> try {<BR> URL sURL = new URL(hprotocol + "://" + wlse_ip + ":" + httpport + "/services/Config");<BR> m_logger.info("service URL is: " + sURL) ;</SPAN></FONT></DIV> <DIV><FONT face="Courier New"></FONT> </DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005> ConfigService service = new ConfigServiceLocator();</SPAN></FONT></DIV> <DIV><FONT face="Courier New"></FONT> </DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005> Config config = service.getConfig(sURL) ;<BR>   ; ConfigSoapBindingStub stub = (ConfigSoapBindingStub)config;<BR> stub.setMaintainSession(true);<BR> stub.setUsername(username);<BR> stub.setPassword(password);</SPAN></FONT></DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005> return config;<BR> }</SPAN></FONT></DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005></SPAN></FONT> </DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005>I use the handle to invoke all the methods exposed in the "Config" interface.</SPAN></FONT></DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005></SPAN></FONT> </DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005>If I change the call:</SPAN></FONT></DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005>stub.setMaintainSession(true);<BR></SPAN></FONT></DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005>to</SPAN></FONT></DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005></SPAN></FONT> </DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005>stub.setMaintainSession(false);</SPAN></FONT></DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005></SPAN></FONT> </DIV> <DIV><FONT size=2><SPAN class=823331119-01062005><FONT face="Courier New">What is the impact? Can I make multiple calls using the same handle? does Soap automatically create new session for each API call? or do I have to invoke setUserName(), and setPassword() before every API invocation if I call stub.setMaintainSession(false)?</FONT></SPAN></FONT></DIV> <DIV><FONT face="Courier New" size=2><SPAN class=823331119-01062005></SPAN></FONT><FONT size=2><SPAN class=823331119-01062005><FONT face="Courier New"><BR> </DIV></FONT></SPAN></FONT></BODY></HTML>
Earn $52 per hosting referral at Lunarpages.
|
|
 |