You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Subhro Moitra (smoitra)" <sm...@cisco.com> on 2008/05/07 15:48:12 UTC

Sharing data among services in same service group.

 
Hi All,
 
I have the following services.xml
 
<serviceGroup>
    <service name="MultiPortTypes2" scope="application"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Skeleto
n">
        <messageReceivers>
            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Message
ReceiverInOut"/>
        </messageReceivers>
        <parameter
name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPort
Types2Skeleton</parameter>
        <parameter name="ServiceTCCL" locked="false">service</parameter>
    </service>
    <service name="MultiPortTypes1" scope="transportsession"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Skeleto
n">
        <messageReceivers>
            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Message
ReceiverInOut"/>
        </messageReceivers>
        <parameter
name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPort
Types1Skeleton</parameter>
        <parameter name="ServiceTCCL" locked="false">service</parameter>
    </service>
</serviceGroup>
 

How can i share data between "MultiPortTypes1" and "MultiPortTypes2"?
 

In MultiPortTypes1 we have an operation with the below code.
MessageContext mc=MessageContext.getCurrentMessageContext();
     if(mc!=null){
      ServiceGroupContext sgc=mc.getServiceGroupContext();
      if(sgc!=null)sgc.setProperty("sessionId", "100000");
      else System.out.println("\t\t SGC is null cannot set sesionId");
      
      SessionContext sc=mc.getSessionContext();
      if(sc!=null) sc.setProperty("sessionId", "sessiontransport");
      else System.out.println("\t\t session context is null cannot set
sessionId");
      
     }
 
In MultiPortTypes2 we have an operation with the below code:
 
MessageContext mc=MessageContext.getCurrentMessageContext();
     if(mc!=null){
      System.out.println("\t\t MCCtx: "+mc.getProperty("sessionId"));
      ServiceGroupContext sgc=mc.getServiceGroupContext();
      if(sgc!=null) System.out.println(" \t\t ServiceGroupContext:
"+sgc.getProperty("sessionId"));
      else System.out.println("\t\t SGC is null");
      
      SessionContext sc=mc.getSessionContext();
      if(sc!=null) System.out.println("\t\t sessionContext:
"+sc.getProperty("sessionId"));
      else System.out.println("\t\t session context is null cannot set
sessionId");
      
     }
 
The output for "MultiPortTypes2 " is null. Please help.
 
Thanks,
Subhro.

RE: Sharing data among services in same service group.

Posted by "Subhro Moitra (smoitra)" <sm...@cisco.com>.
stub1 = new
MultiPortTypes1Stub("http://localhost:8080/axis2/services/MultiPortTypes
1");
 
stub1._getServiceClient().getOptions().setProperty(org.apache.axis2.tran
sport.http.HTTPConstants.REUSE_HTTP_CLIENT,new Boolean(true));
 
stub1._getServiceClient().getOptions().setProperty(org.apache.axis2.tran
sport.http.HTTPConstants.SO_TIMEOUT /* CONNECTION_TIMEOUT */,new
Integer("7200000")); // 2hr for now.
 
stub1._getServiceClient().getOptions().setTimeOutInMilliSeconds(7200000L
);
  stub1._getServiceClient().getOptions().setManageSession(true);
  
  
  stub2 = new
MultiPortTypes2Stub("http://localhost:8080/axis2/services/MultiPortTypes
2");
 
stub2._getServiceClient().getOptions().setProperty(org.apache.axis2.tran
sport.http.HTTPConstants.REUSE_HTTP_CLIENT,new Boolean(true));
 
stub2._getServiceClient().getOptions().setProperty(org.apache.axis2.tran
sport.http.HTTPConstants.SO_TIMEOUT /* CONNECTION_TIMEOUT */,new
Integer("7200000")); // 2hr for now.
 
stub2._getServiceClient().getOptions().setTimeOutInMilliSeconds(7200000L
);
  stub2._getServiceClient().getOptions().setManageSession(true);
 
The browser is returning some "XML Parsing error" not only for this
service but all other services as well.
Is something wrong with the axis installation?
 
Thanks,
Subhro.

________________________________

From: keith chapman [mailto:keithgchapman@gmail.com] 
Sent: Thursday, May 08, 2008 1:15 PM
To: axis-user@ws.apache.org
Subject: Re: Sharing data among services in same service group.


How is your client implemented? as I said before transport sessions uses
the HTTPSession to maintain state. So unless your client is using the
same HTTPSessions this will not work. Try invoking the two services via
a browser.

Thanks,
Keith.


On Thu, May 8, 2008 at 12:21 PM, Subhro Moitra (smoitra)
<sm...@cisco.com> wrote:


	Thanks Keith For replying.
	I did what you said. Both the scopes are "transportsession".
	 
	But still the stub2.newOperation1() call is returning null.
	 
	Please help!!
	 
	Thanks,
	Subhro.

________________________________

	From: keith chapman [mailto:keithgchapman@gmail.com] 
	Sent: Wednesday, May 07, 2008 8:54 PM
	To: axis-user@ws.apache.org
	Subject: Re: Sharing data among services in same service group.
	
	
	Hi,
	
	I think the problem here is that the two services are in two
scopes. When transport session is used its the underlying transport that
depends how the session is managed. For e.g when http is used the
HTTPSession is used to manage the session. Can you try deploying both
services on the same scope, then this should work.
	
	Thanks,
	Keith.
	
	
	On Wed, May 7, 2008 at 7:18 PM, Subhro Moitra (smoitra)
<sm...@cisco.com> wrote:
	

		 
		Hi All,
		 
		I have the following services.xml
		 
		<serviceGroup>
		    <service name="MultiPortTypes2" scope="application"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Skeleto
n">
		        <messageReceivers>
		            <messageReceiver
mep="http://www.w3.org/ns/wsdl/in-out"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Message
ReceiverInOut"/>
		        </messageReceivers>
		        <parameter
name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPort
Types2Skeleton</parameter>
		        <parameter name="ServiceTCCL"
locked="false">service</parameter>
		    </service>
		    <service name="MultiPortTypes1"
scope="transportsession"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Skeleto
n">
		        <messageReceivers>
		            <messageReceiver
mep="http://www.w3.org/ns/wsdl/in-out"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Message
ReceiverInOut"/>
		        </messageReceivers>
		        <parameter
name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPort
Types1Skeleton</parameter>
		        <parameter name="ServiceTCCL"
locked="false">service</parameter>
		    </service>
		</serviceGroup>
		 

		How can i share data between "MultiPortTypes1" and
"MultiPortTypes2"?
		 

		In MultiPortTypes1 we have an operation with the below
code.
		MessageContext
mc=MessageContext.getCurrentMessageContext();
		     if(mc!=null){
		      ServiceGroupContext
sgc=mc.getServiceGroupContext();
		      if(sgc!=null)sgc.setProperty("sessionId",
"100000");
		      else System.out.println("\t\t SGC is null cannot
set sesionId");
		      
		      SessionContext sc=mc.getSessionContext();
		      if(sc!=null) sc.setProperty("sessionId",
"sessiontransport");
		      else System.out.println("\t\t session context is
null cannot set sessionId");
		      
		     }
		 
		In MultiPortTypes2 we have an operation with the below
code:
		 
		MessageContext
mc=MessageContext.getCurrentMessageContext();
		     if(mc!=null){
		      System.out.println("\t\t MCCtx:
"+mc.getProperty("sessionId"));
		      ServiceGroupContext
sgc=mc.getServiceGroupContext();
		      if(sgc!=null) System.out.println(" \t\t
ServiceGroupContext: "+sgc.getProperty("sessionId"));
		      else System.out.println("\t\t SGC is null");
		      
		      SessionContext sc=mc.getSessionContext();
		      if(sc!=null) System.out.println("\t\t
sessionContext: "+sc.getProperty("sessionId"));
		      else System.out.println("\t\t session context is
null cannot set sessionId");
		      
		     }
		 
		The output for "MultiPortTypes2 " is null. Please help.
		 
		Thanks,
		Subhro.




	-- 
	Keith Chapman
	Senior Software Engineer
	WSO2 Inc.
	Oxygenating the Web Service Platform.
	http://wso2.org/
	
	blog: http://www.keith-chapman.org 




-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org 

Re: Sharing data among services in same service group.

Posted by keith chapman <ke...@gmail.com>.
How is your client implemented? as I said before transport sessions uses the
HTTPSession to maintain state. So unless your client is using the same
HTTPSessions this will not work. Try invoking the two services via a
browser.

Thanks,
Keith.

On Thu, May 8, 2008 at 12:21 PM, Subhro Moitra (smoitra) <sm...@cisco.com>
wrote:

>  Thanks Keith For replying.
> I did what you said. Both the scopes are "transportsession".
>
> But still the stub2.newOperation1() call is returning null.
>
> Please help!!
>
> Thanks,
> Subhro.
>
>  ------------------------------
> *From:* keith chapman [mailto:keithgchapman@gmail.com]
> *Sent:* Wednesday, May 07, 2008 8:54 PM
> *To:* axis-user@ws.apache.org
> *Subject:* Re: Sharing data among services in same service group.
>
> Hi,
>
> I think the problem here is that the two services are in two scopes. When
> transport session is used its the underlying transport that depends how the
> session is managed. For e.g when http is used the HTTPSession is used to
> manage the session. Can you try deploying both services on the same scope,
> then this should work.
>
> Thanks,
> Keith.
>
> On Wed, May 7, 2008 at 7:18 PM, Subhro Moitra (smoitra) <sm...@cisco.com>
> wrote:
>
> >
> >  Hi All,
> >
> > I have the following services.xml
> >
> > <serviceGroup>
> >     <service name="MultiPortTypes2" scope="application"
> > class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Skeleton">
> >         <messageReceivers>
> >             <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
> > class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2MessageReceiverInOut"/>
> >         </messageReceivers>
> >         <parameter
> > name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Skeleton</parameter>
> >         <parameter name="ServiceTCCL" locked="false">service</parameter>
> >     </service>
> >     <service name="MultiPortTypes1" scope="transportsession"
> > class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Skeleton">
> >         <messageReceivers>
> >             <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
> > class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1MessageReceiverInOut"/>
> >         </messageReceivers>
> >         <parameter
> > name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Skeleton</parameter>
> >         <parameter name="ServiceTCCL" locked="false">service</parameter>
> >     </service>
> > </serviceGroup>
> >
> >
> > How can i share data between "MultiPortTypes1" and "MultiPortTypes2"?
> >
> >
> > In MultiPortTypes1 we have an operation with the below code.
> > MessageContext mc=MessageContext.getCurrentMessageContext();
> >      if(mc!=null){
> >       ServiceGroupContext sgc=mc.getServiceGroupContext();
> >       if(sgc!=null)sgc.setProperty("sessionId", "100000");
> >       else System.out.println("\t\t SGC is null cannot set sesionId");
> >
> >       SessionContext sc=mc.getSessionContext();
> >       if(sc!=null) sc.setProperty("sessionId", "sessiontransport");
> >       else System.out.println("\t\t session context is null cannot set
> > sessionId");
> >
> >      }
> >
> > In MultiPortTypes2 we have an operation with the below code:
> >
> > MessageContext mc=MessageContext.getCurrentMessageContext();
> >      if(mc!=null){
> >       System.out.println("\t\t MCCtx: "+mc.getProperty("sessionId"));
> >       ServiceGroupContext sgc=mc.getServiceGroupContext();
> >       if(sgc!=null) System.out.println(" \t\t ServiceGroupContext:
> > "+sgc.getProperty("sessionId"));
> >       else System.out.println("\t\t SGC is null");
> >
> >       SessionContext sc=mc.getSessionContext();
> >       if(sc!=null) System.out.println("\t\t sessionContext:
> > "+sc.getProperty("sessionId"));
> >       else System.out.println("\t\t session context is null cannot set
> > sessionId");
> >
> >      }
> >
> > The output for "MultiPortTypes2 " is null. Please help.
> >
> > Thanks,
> > Subhro.
> >
>
>
>
> --
> Keith Chapman
> Senior Software Engineer
> WSO2 Inc.
> Oxygenating the Web Service Platform.
> http://wso2.org/
>
> blog: http://www.keith-chapman.org
>



-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org

AW: Sharing data among services in same service group.

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Hi Subharo,
 
I had a slight different problem. But maybe I can help you a bit. Application Servers like Tomcat, up on which Axis2 is based are multithreaded. The question for me was how to reach with each session-thread an new instance of a service-object. (Just opposit to you)  Reaching the same instance of an object could mean - sharing data - while reaching a different instance - lets say on a per user session basis - can be used to share data.
 
My approch was to use scope=soapsession and a long timeout.
 
When Axis2 created my object, which had a privat variable to keep a JavaBean and behind the JavaBeab my WSIT integrated web-service server, areal OpenVMS legacy server process which had to be user specific. In the beginning each session-thread reached the same, the latest created process, which was wrong for me.
 
Then I realised that I just had to make the variable keeping my JavaBean private but not static and all was fine. While the variable keeping the log4j logger is still keept as private static variable all session-threads share a common logger - what I need. But each new session in scope=soapsession creates now a new instance of my service - object and hence I had a mapping from user-session-threads to unique JavaBeans and through this Beans to unique per User Processes or to common used loggers.
 
Also, cuical is that in my model that the client session uses the same service group Id.  
 
Whit this ideas in mind I am confident that you can talk by each session-thread to the same object and hence share data via one of its attributes - its variables.
 
 
Here my service.xml
 
<service name="SpezplaService" scope="soapsession">
    <description>
        This is the SpezplaService with login, fktmap and logout.
    </description>
    <module ref="addressing"/>
    <parameter name="ServiceClass" locked="false">axawl.spezpla.servers.SpezplaService.SpServer</parameter>
    <operation name="login">
        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
        <actionMapping>urn:login</actionMapping>
    </operation>
    <operation name="fktmap">
        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
        <actionMapping>urn:fktmap</actionMapping>
    </operation>
    <operation name="logout">
        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
        <actionMapping>urn:logout</actionMapping>
    </operation>
</service>

And my service in the attachment below (still in a changing state) but using the loggers and time stamps one can easy see what is going on.
 
 
Hope it helps
Josef
 
 

-----Ursprüngliche Nachricht-----
Von: Subhro Moitra (smoitra) [mailto:smoitra@cisco.com]
Gesendet: Donnerstag, 8. Mai 2008 08:52
An: axis-user@ws.apache.org
Betreff: RE: Sharing data among services in same service group.


Thanks Keith For replying.
I did what you said. Both the scopes are "transportsession".
 
But still the stub2.newOperation1() call is returning null.
 
Please help!!
 
Thanks,
Subhro.

  _____  

From: keith chapman [mailto:keithgchapman@gmail.com] 
Sent: Wednesday, May 07, 2008 8:54 PM
To: axis-user@ws.apache.org
Subject: Re: Sharing data among services in same service group.


Hi,

I think the problem here is that the two services are in two scopes. When transport session is used its the underlying transport that depends how the session is managed. For e.g when http is used the HTTPSession is used to manage the session. Can you try deploying both services on the same scope, then this should work.

Thanks,
Keith.


On Wed, May 7, 2008 at 7:18 PM, Subhro Moitra (smoitra) < smoitra@cisco.com> wrote:


 
Hi All,
 
I have the following services.xml
 
<serviceGroup>
    <service name="MultiPortTypes2" scope="application" class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Skeleton">
        <messageReceivers>
            <messageReceiver mep=" http://www.w3.org/ns/wsdl/in-out" class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2MessageReceiverInOut"/>
        </messageReceivers>
        <parameter name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Skeleton</parameter>
        <parameter name="ServiceTCCL" locked="false">service</parameter>
    </service>
    <service name="MultiPortTypes1" scope="transportsession" class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Skeleton">
        <messageReceivers>
            <messageReceiver mep=" http://www.w3.org/ns/wsdl/in-out" class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1MessageReceiverInOut"/>
        </messageReceivers>
        <parameter name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Skeleton</parameter>
        <parameter name="ServiceTCCL" locked="false">service</parameter>
    </service>
</serviceGroup>
 

How can i share data between "MultiPortTypes1" and "MultiPortTypes2"?
 

In MultiPortTypes1 we have an operation with the below code.
MessageContext mc=MessageContext.getCurrentMessageContext();
     if(mc!=null){
      ServiceGroupContext sgc=mc.getServiceGroupContext();
      if(sgc!=null)sgc.setProperty("sessionId", "100000");
      else System.out.println("\t\t SGC is null cannot set sesionId");
      
      SessionContext sc=mc.getSessionContext();
      if(sc!=null) sc.setProperty("sessionId", "sessiontransport");
      else System.out.println("\t\t session context is null cannot set sessionId");
      
     }
 
In MultiPortTypes2 we have an operation with the below code:
 
MessageContext mc=MessageContext.getCurrentMessageContext();
     if(mc!=null){
      System.out.println("\t\t MCCtx: "+mc.getProperty("sessionId"));
      ServiceGroupContext sgc=mc.getServiceGroupContext();
      if(sgc!=null) System.out.println(" \t\t ServiceGroupContext: "+sgc.getProperty("sessionId"));
      else System.out.println("\t\t SGC is null");
      
      SessionContext sc=mc.getSessionContext();
      if(sc!=null) System.out.println("\t\t sessionContext: "+sc.getProperty("sessionId"));
      else System.out.println("\t\t session context is null cannot set sessionId");
      
     }
 
The output for "MultiPortTypes2 " is null. Please help.
 
Thanks,
Subhro.




-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org 


RE: Sharing data among services in same service group.

Posted by "Subhro Moitra (smoitra)" <sm...@cisco.com>.
Thanks Keith For replying.
I did what you said. Both the scopes are "transportsession".
 
But still the stub2.newOperation1() call is returning null.
 
Please help!!
 
Thanks,
Subhro.

________________________________

From: keith chapman [mailto:keithgchapman@gmail.com] 
Sent: Wednesday, May 07, 2008 8:54 PM
To: axis-user@ws.apache.org
Subject: Re: Sharing data among services in same service group.


Hi,

I think the problem here is that the two services are in two scopes.
When transport session is used its the underlying transport that depends
how the session is managed. For e.g when http is used the HTTPSession is
used to manage the session. Can you try deploying both services on the
same scope, then this should work.

Thanks,
Keith.


On Wed, May 7, 2008 at 7:18 PM, Subhro Moitra (smoitra)
<sm...@cisco.com> wrote:


	 
	Hi All,
	 
	I have the following services.xml
	 
	<serviceGroup>
	    <service name="MultiPortTypes2" scope="application"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Skeleto
n">
	        <messageReceivers>
	            <messageReceiver
mep="http://www.w3.org/ns/wsdl/in-out"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Message
ReceiverInOut"/>
	        </messageReceivers>
	        <parameter
name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPort
Types2Skeleton</parameter>
	        <parameter name="ServiceTCCL"
locked="false">service</parameter>
	    </service>
	    <service name="MultiPortTypes1" scope="transportsession"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Skeleto
n">
	        <messageReceivers>
	            <messageReceiver
mep="http://www.w3.org/ns/wsdl/in-out"
class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Message
ReceiverInOut"/>
	        </messageReceivers>
	        <parameter
name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPort
Types1Skeleton</parameter>
	        <parameter name="ServiceTCCL"
locked="false">service</parameter>
	    </service>
	</serviceGroup>
	 

	How can i share data between "MultiPortTypes1" and
"MultiPortTypes2"?
	 

	In MultiPortTypes1 we have an operation with the below code.
	MessageContext mc=MessageContext.getCurrentMessageContext();
	     if(mc!=null){
	      ServiceGroupContext sgc=mc.getServiceGroupContext();
	      if(sgc!=null)sgc.setProperty("sessionId", "100000");
	      else System.out.println("\t\t SGC is null cannot set
sesionId");
	      
	      SessionContext sc=mc.getSessionContext();
	      if(sc!=null) sc.setProperty("sessionId",
"sessiontransport");
	      else System.out.println("\t\t session context is null
cannot set sessionId");
	      
	     }
	 
	In MultiPortTypes2 we have an operation with the below code:
	 
	MessageContext mc=MessageContext.getCurrentMessageContext();
	     if(mc!=null){
	      System.out.println("\t\t MCCtx:
"+mc.getProperty("sessionId"));
	      ServiceGroupContext sgc=mc.getServiceGroupContext();
	      if(sgc!=null) System.out.println(" \t\t
ServiceGroupContext: "+sgc.getProperty("sessionId"));
	      else System.out.println("\t\t SGC is null");
	      
	      SessionContext sc=mc.getSessionContext();
	      if(sc!=null) System.out.println("\t\t sessionContext:
"+sc.getProperty("sessionId"));
	      else System.out.println("\t\t session context is null
cannot set sessionId");
	      
	     }
	 
	The output for "MultiPortTypes2 " is null. Please help.
	 
	Thanks,
	Subhro.




-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org 

Re: Sharing data among services in same service group.

Posted by keith chapman <ke...@gmail.com>.
Hi,

I think the problem here is that the two services are in two scopes. When
transport session is used its the underlying transport that depends how the
session is managed. For e.g when http is used the HTTPSession is used to
manage the session. Can you try deploying both services on the same scope,
then this should work.

Thanks,
Keith.

On Wed, May 7, 2008 at 7:18 PM, Subhro Moitra (smoitra) <sm...@cisco.com>
wrote:

>
>  Hi All,
>
> I have the following services.xml
>
> <serviceGroup>
>     <service name="MultiPortTypes2" scope="application"
> class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Skeleton">
>         <messageReceivers>
>             <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
> class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2MessageReceiverInOut"/>
>         </messageReceivers>
>         <parameter
> name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes2Skeleton</parameter>
>         <parameter name="ServiceTCCL" locked="false">service</parameter>
>     </service>
>     <service name="MultiPortTypes1" scope="transportsession"
> class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Skeleton">
>         <messageReceivers>
>             <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
> class="com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1MessageReceiverInOut"/>
>         </messageReceivers>
>         <parameter
> name="ServiceClass">com.xxxxxxxxxx.yyyy.zzzzz.service.xmlbeans.MultiPortTypes1Skeleton</parameter>
>         <parameter name="ServiceTCCL" locked="false">service</parameter>
>     </service>
> </serviceGroup>
>
>
> How can i share data between "MultiPortTypes1" and "MultiPortTypes2"?
>
>
> In MultiPortTypes1 we have an operation with the below code.
> MessageContext mc=MessageContext.getCurrentMessageContext();
>      if(mc!=null){
>       ServiceGroupContext sgc=mc.getServiceGroupContext();
>       if(sgc!=null)sgc.setProperty("sessionId", "100000");
>       else System.out.println("\t\t SGC is null cannot set sesionId");
>
>       SessionContext sc=mc.getSessionContext();
>       if(sc!=null) sc.setProperty("sessionId", "sessiontransport");
>       else System.out.println("\t\t session context is null cannot set
> sessionId");
>
>      }
>
> In MultiPortTypes2 we have an operation with the below code:
>
> MessageContext mc=MessageContext.getCurrentMessageContext();
>      if(mc!=null){
>       System.out.println("\t\t MCCtx: "+mc.getProperty("sessionId"));
>       ServiceGroupContext sgc=mc.getServiceGroupContext();
>       if(sgc!=null) System.out.println(" \t\t ServiceGroupContext:
> "+sgc.getProperty("sessionId"));
>       else System.out.println("\t\t SGC is null");
>
>       SessionContext sc=mc.getSessionContext();
>       if(sc!=null) System.out.println("\t\t sessionContext:
> "+sc.getProperty("sessionId"));
>       else System.out.println("\t\t session context is null cannot set
> sessionId");
>
>      }
>
> The output for "MultiPortTypes2 " is null. Please help.
>
> Thanks,
> Subhro.
>



-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org