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 Siamak Haschemi <si...@gmx.de> on 2006/04/17 17:49:37 UTC

Exchange Data between twi Services in a ServiceGroup

Hello to all.

I have two Services defnied. They need to share a reference to the 
Spring-ApplicationContext. Now I need to know how the communication 
between two Services in a ServiceGroup can be achieved. I know I can do 
this with a Singleton, but I wonder if Axis2 has some mechanism for 
Inter-Service-Communication.

Another Idea would be to merge the two MessageReceivers, but I need this 
separation.

<serviceGroup>
  <service name="sale" scope="application">
    <messageReceivers>
      <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
        class="org.haschemi.sale.service.SpringSaleMessageReceiverInOut" />
    </messageReceivers>
    <parameter locked="false" 
name="ServiceClass">org.haschemi.sale.service.SaleSkeleton</parameter>
    <operation name="order" mep="http://www.w3.org/2004/08/wsdl/in-out">
      <actionMapping>http://haschemi.org/sale/order</actionMapping>
    </operation>
  </service>
  <service name="care" scope="application">
    <messageReceivers>
      <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
        class="org.haschemi.sale.service.SpringCareMessageReceiverInOut" />
    </messageReceivers>
    <parameter locked="false" 
name="ServiceClass">org.haschemi.sale.service.CareSkeleton</parameter>
    <operation name="addProduct" 
mep="http://www.w3.org/2004/08/wsdl/in-out">
      <actionMapping>http://haschemi.org/sale/addProduct</actionMapping>
    </operation>
  </service>
</serviceGroup>



Thanks a lot,

Siamak Haschemi


Re: Exchange Data between twi Services in a ServiceGroup

Posted by Siamak Haschemi <si...@gmx.de>.
Thank you for your hint.

I will give it a try.

I think that Axis2 needs much more examples for such little questions. 
This will be a keypoint for the acceptance of the 3rd generation of this 
Apache project.


Thank you very much,

Siamak Haschemi

Deepal Jayasinghe schrieb:
> Hi Siamak;
> Sorry for late reply.
> You dont need to use static variable , context hierarchy is there to
> provide those features for you. When you deploy a service in application
> scope , then the associate ServiceGroupContext and serviceContext has
> the life time of the system , so best way is  to store a property in one
> of those context rather than using static variables.
>
> at the runtime you can access any of those context using message context.
>
> Siamak Haschemi wrote:
>
>   
>> I solved my problem by using a static variable, but it would be nice
>> to know if there exists a Context to put references in which has a
>> lifetime longer than a service-call.
>>
>> Thanks a lot,
>>
>> Siamak Haschemi
>>
>> Siamak Haschemi schrieb:
>>
>>     
>>> Hello Robert,
>>>
>>> I've already implemented such a Spring-MessageReceiver that lookups
>>> Services that are actualy Beans from its SpringConfiguration.
>>>
>>> I only searching about a way to share some Object  reference across
>>> multiple Service-Calls.
>>>
>>> Thanks,
>>>
>>> Siamak Haschemi
>>>
>>>
>>> robert lazarski schrieb:
>>>
>>>       
>>>> Is what you're realy after is two services that are wired into Spring?
>>>> Spring-ApplicationContext already is a singleton - look at setting up a
>>>> BeanFactory.
>>>>
>>>> The other way is as you show in services.xml - message recievers. I'm
>>>> actually coding one up a spring message receiver now. The idea is to
>>>> wire
>>>> spring aware beans that are services.
>>>>
>>>> Anyways, HTH,
>>>> Robert
>>>> http://www.braziloutsource.com/
>>>>
>>>> On 4/17/06, Siamak Haschemi <si...@gmx.de> wrote:
>>>>  
>>>>
>>>>         
>>>>> Hello to all.
>>>>>
>>>>> I have two Services defnied. They need to share a reference to the
>>>>> Spring-ApplicationContext. Now I need to know how the communication
>>>>> between two Services in a ServiceGroup can be achieved. I know I
>>>>> can do
>>>>> this with a Singleton, but I wonder if Axis2 has some mechanism for
>>>>> Inter-Service-Communication.
>>>>>
>>>>> Another Idea would be to merge the two MessageReceivers, but I need
>>>>> this
>>>>> separation.
>>>>>
>>>>> <serviceGroup>
>>>>>   <service name="sale" scope="application">
>>>>>     <messageReceivers>
>>>>>       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>>>>        
>>>>> class="org.haschemi.sale.service.SpringSaleMessageReceiverInOut"
>>>>> />
>>>>>     </messageReceivers>
>>>>>     <parameter locked="false"
>>>>> name="ServiceClass">org.haschemi.sale.service.SaleSkeleton</parameter>
>>>>>     <operation name="order"
>>>>> mep="http://www.w3.org/2004/08/wsdl/in-out">
>>>>>       <actionMapping>http://haschemi.org/sale/order</actionMapping>
>>>>>     </operation>
>>>>>   </service>
>>>>>   <service name="care" scope="application">
>>>>>     <messageReceivers>
>>>>>       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>>>>        
>>>>> class="org.haschemi.sale.service.SpringCareMessageReceiverInOut"
>>>>> />
>>>>>     </messageReceivers>
>>>>>     <parameter locked="false"
>>>>> name="ServiceClass">org.haschemi.sale.service.CareSkeleton</parameter>
>>>>>     <operation name="addProduct"
>>>>> mep="http://www.w3.org/2004/08/wsdl/in-out">
>>>>>      
>>>>> <actionMapping>http://haschemi.org/sale/addProduct</actionMapping>
>>>>>     </operation>
>>>>>   </service>
>>>>> </serviceGroup>
>>>>>
>>>>>
>>>>>
>>>>> Thanks a lot,
>>>>>
>>>>> Siamak Haschemi
>>>>>
>>>>>
>>>>>     
>>>>>           
>>>>   
>>>>         
>>>       
>>
>>     
>
>   


Re: Exchange Data between twi Services in a ServiceGroup

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Siamak;
Sorry for late reply.
You dont need to use static variable , context hierarchy is there to
provide those features for you. When you deploy a service in application
scope , then the associate ServiceGroupContext and serviceContext has
the life time of the system , so best way is  to store a property in one
of those context rather than using static variables.

at the runtime you can access any of those context using message context.

Siamak Haschemi wrote:

> I solved my problem by using a static variable, but it would be nice
> to know if there exists a Context to put references in which has a
> lifetime longer than a service-call.
>
> Thanks a lot,
>
> Siamak Haschemi
>
> Siamak Haschemi schrieb:
>
>> Hello Robert,
>>
>> I've already implemented such a Spring-MessageReceiver that lookups
>> Services that are actualy Beans from its SpringConfiguration.
>>
>> I only searching about a way to share some Object  reference across
>> multiple Service-Calls.
>>
>> Thanks,
>>
>> Siamak Haschemi
>>
>>
>> robert lazarski schrieb:
>>
>>> Is what you're realy after is two services that are wired into Spring?
>>> Spring-ApplicationContext already is a singleton - look at setting up a
>>> BeanFactory.
>>>
>>> The other way is as you show in services.xml - message recievers. I'm
>>> actually coding one up a spring message receiver now. The idea is to
>>> wire
>>> spring aware beans that are services.
>>>
>>> Anyways, HTH,
>>> Robert
>>> http://www.braziloutsource.com/
>>>
>>> On 4/17/06, Siamak Haschemi <si...@gmx.de> wrote:
>>>  
>>>
>>>> Hello to all.
>>>>
>>>> I have two Services defnied. They need to share a reference to the
>>>> Spring-ApplicationContext. Now I need to know how the communication
>>>> between two Services in a ServiceGroup can be achieved. I know I
>>>> can do
>>>> this with a Singleton, but I wonder if Axis2 has some mechanism for
>>>> Inter-Service-Communication.
>>>>
>>>> Another Idea would be to merge the two MessageReceivers, but I need
>>>> this
>>>> separation.
>>>>
>>>> <serviceGroup>
>>>>   <service name="sale" scope="application">
>>>>     <messageReceivers>
>>>>       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>>>        
>>>> class="org.haschemi.sale.service.SpringSaleMessageReceiverInOut"
>>>> />
>>>>     </messageReceivers>
>>>>     <parameter locked="false"
>>>> name="ServiceClass">org.haschemi.sale.service.SaleSkeleton</parameter>
>>>>     <operation name="order"
>>>> mep="http://www.w3.org/2004/08/wsdl/in-out">
>>>>       <actionMapping>http://haschemi.org/sale/order</actionMapping>
>>>>     </operation>
>>>>   </service>
>>>>   <service name="care" scope="application">
>>>>     <messageReceivers>
>>>>       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>>>        
>>>> class="org.haschemi.sale.service.SpringCareMessageReceiverInOut"
>>>> />
>>>>     </messageReceivers>
>>>>     <parameter locked="false"
>>>> name="ServiceClass">org.haschemi.sale.service.CareSkeleton</parameter>
>>>>     <operation name="addProduct"
>>>> mep="http://www.w3.org/2004/08/wsdl/in-out">
>>>>      
>>>> <actionMapping>http://haschemi.org/sale/addProduct</actionMapping>
>>>>     </operation>
>>>>   </service>
>>>> </serviceGroup>
>>>>
>>>>
>>>>
>>>> Thanks a lot,
>>>>
>>>> Siamak Haschemi
>>>>
>>>>
>>>>     
>>>
>>>
>>>   
>>
>>
>
>
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~ 



Re: Exchange Data between twi Services in a ServiceGroup

Posted by Siamak Haschemi <si...@gmx.de>.
I solved my problem by using a static variable, but it would be nice to 
know if there exists a Context to put references in which has a lifetime 
longer than a service-call.

Thanks a lot,

Siamak Haschemi

Siamak Haschemi schrieb:
> Hello Robert,
>
> I've already implemented such a Spring-MessageReceiver that lookups 
> Services that are actualy Beans from its SpringConfiguration.
>
> I only searching about a way to share some Object  reference across 
> multiple Service-Calls.
>
> Thanks,
>
> Siamak Haschemi
>
>
> robert lazarski schrieb:
>> Is what you're realy after is two services that are wired into Spring?
>> Spring-ApplicationContext already is a singleton - look at setting up a
>> BeanFactory.
>>
>> The other way is as you show in services.xml - message recievers. I'm
>> actually coding one up a spring message receiver now. The idea is to 
>> wire
>> spring aware beans that are services.
>>
>> Anyways, HTH,
>> Robert
>> http://www.braziloutsource.com/
>>
>> On 4/17/06, Siamak Haschemi <si...@gmx.de> wrote:
>>  
>>> Hello to all.
>>>
>>> I have two Services defnied. They need to share a reference to the
>>> Spring-ApplicationContext. Now I need to know how the communication
>>> between two Services in a ServiceGroup can be achieved. I know I can do
>>> this with a Singleton, but I wonder if Axis2 has some mechanism for
>>> Inter-Service-Communication.
>>>
>>> Another Idea would be to merge the two MessageReceivers, but I need 
>>> this
>>> separation.
>>>
>>> <serviceGroup>
>>>   <service name="sale" scope="application">
>>>     <messageReceivers>
>>>       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>>         
>>> class="org.haschemi.sale.service.SpringSaleMessageReceiverInOut"
>>> />
>>>     </messageReceivers>
>>>     <parameter locked="false"
>>> name="ServiceClass">org.haschemi.sale.service.SaleSkeleton</parameter>
>>>     <operation name="order" 
>>> mep="http://www.w3.org/2004/08/wsdl/in-out">
>>>       <actionMapping>http://haschemi.org/sale/order</actionMapping>
>>>     </operation>
>>>   </service>
>>>   <service name="care" scope="application">
>>>     <messageReceivers>
>>>       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>>         
>>> class="org.haschemi.sale.service.SpringCareMessageReceiverInOut"
>>> />
>>>     </messageReceivers>
>>>     <parameter locked="false"
>>> name="ServiceClass">org.haschemi.sale.service.CareSkeleton</parameter>
>>>     <operation name="addProduct"
>>> mep="http://www.w3.org/2004/08/wsdl/in-out">
>>>       
>>> <actionMapping>http://haschemi.org/sale/addProduct</actionMapping>
>>>     </operation>
>>>   </service>
>>> </serviceGroup>
>>>
>>>
>>>
>>> Thanks a lot,
>>>
>>> Siamak Haschemi
>>>
>>>
>>>     
>>
>>   
>


Re: Exchange Data between twi Services in a ServiceGroup

Posted by Siamak Haschemi <si...@gmx.de>.
Hello Robert,

I've already implemented such a Spring-MessageReceiver that lookups 
Services that are actualy Beans from its SpringConfiguration.

I only searching about a way to share some Object  reference across 
multiple Service-Calls.

Thanks,

Siamak Haschemi


robert lazarski schrieb:
> Is what you're realy after is two services that are wired into Spring?
> Spring-ApplicationContext already is a singleton - look at setting up a
> BeanFactory.
>
> The other way is as you show in services.xml - message recievers. I'm
> actually coding one up a spring message receiver now. The idea is to wire
> spring aware beans that are services.
>
> Anyways, HTH,
> Robert
> http://www.braziloutsource.com/
>
> On 4/17/06, Siamak Haschemi <si...@gmx.de> wrote:
>   
>> Hello to all.
>>
>> I have two Services defnied. They need to share a reference to the
>> Spring-ApplicationContext. Now I need to know how the communication
>> between two Services in a ServiceGroup can be achieved. I know I can do
>> this with a Singleton, but I wonder if Axis2 has some mechanism for
>> Inter-Service-Communication.
>>
>> Another Idea would be to merge the two MessageReceivers, but I need this
>> separation.
>>
>> <serviceGroup>
>>   <service name="sale" scope="application">
>>     <messageReceivers>
>>       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>         class="org.haschemi.sale.service.SpringSaleMessageReceiverInOut"
>> />
>>     </messageReceivers>
>>     <parameter locked="false"
>> name="ServiceClass">org.haschemi.sale.service.SaleSkeleton</parameter>
>>     <operation name="order" mep="http://www.w3.org/2004/08/wsdl/in-out">
>>       <actionMapping>http://haschemi.org/sale/order</actionMapping>
>>     </operation>
>>   </service>
>>   <service name="care" scope="application">
>>     <messageReceivers>
>>       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>         class="org.haschemi.sale.service.SpringCareMessageReceiverInOut"
>> />
>>     </messageReceivers>
>>     <parameter locked="false"
>> name="ServiceClass">org.haschemi.sale.service.CareSkeleton</parameter>
>>     <operation name="addProduct"
>> mep="http://www.w3.org/2004/08/wsdl/in-out">
>>       <actionMapping>http://haschemi.org/sale/addProduct</actionMapping>
>>     </operation>
>>   </service>
>> </serviceGroup>
>>
>>
>>
>> Thanks a lot,
>>
>> Siamak Haschemi
>>
>>
>>     
>
>   


Re: Exchange Data between twi Services in a ServiceGroup

Posted by robert lazarski <ro...@gmail.com>.
Is what you're realy after is two services that are wired into Spring?
Spring-ApplicationContext already is a singleton - look at setting up a
BeanFactory.

The other way is as you show in services.xml - message recievers. I'm
actually coding one up a spring message receiver now. The idea is to wire
spring aware beans that are services.

Anyways, HTH,
Robert
http://www.braziloutsource.com/

On 4/17/06, Siamak Haschemi <si...@gmx.de> wrote:
>
> Hello to all.
>
> I have two Services defnied. They need to share a reference to the
> Spring-ApplicationContext. Now I need to know how the communication
> between two Services in a ServiceGroup can be achieved. I know I can do
> this with a Singleton, but I wonder if Axis2 has some mechanism for
> Inter-Service-Communication.
>
> Another Idea would be to merge the two MessageReceivers, but I need this
> separation.
>
> <serviceGroup>
>   <service name="sale" scope="application">
>     <messageReceivers>
>       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>         class="org.haschemi.sale.service.SpringSaleMessageReceiverInOut"
> />
>     </messageReceivers>
>     <parameter locked="false"
> name="ServiceClass">org.haschemi.sale.service.SaleSkeleton</parameter>
>     <operation name="order" mep="http://www.w3.org/2004/08/wsdl/in-out">
>       <actionMapping>http://haschemi.org/sale/order</actionMapping>
>     </operation>
>   </service>
>   <service name="care" scope="application">
>     <messageReceivers>
>       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>         class="org.haschemi.sale.service.SpringCareMessageReceiverInOut"
> />
>     </messageReceivers>
>     <parameter locked="false"
> name="ServiceClass">org.haschemi.sale.service.CareSkeleton</parameter>
>     <operation name="addProduct"
> mep="http://www.w3.org/2004/08/wsdl/in-out">
>       <actionMapping>http://haschemi.org/sale/addProduct</actionMapping>
>     </operation>
>   </service>
> </serviceGroup>
>
>
>
> Thanks a lot,
>
> Siamak Haschemi
>
>