Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Riena » How how to send settings for a service call
How how to send settings for a service call [message #23822] Mon, 30 March 2009 08:58 Go to next message
Henzler Peter is currently offline Henzler PeterFriend
Messages: 19
Registered: July 2009
Junior Member
I have different services on the server side giving data.
I want that the client can give some information along with the service
call that make the service behave different.

Example:
I have a service that has many methods to query foo objects on the server.
I want also call this service in a way where the language dependent data
of the found objects gets translated before returning the result.
Instead of duplicate the service and all the methods in it, I want to give
some data to the server along with the service call that specify how the
service handles that specific call. This could be a map with properties
like 'translate=true' and 'languages=de,fr,en'

Is there a build-in way to handle that?
How can I set data for a single service call so that that data can be read
on the server side when the call is processed?

Thank you for any answer.

Peter
Re: How how to send settings for a service call [message #23865 is a reply to message #23822] Mon, 30 March 2009 13:35 Go to previous messageGo to next message
Stefan Liebig is currently offline Stefan LiebigFriend
Messages: 124
Registered: July 2009
Senior Member
Hallo Peter,

If I get you right you do not want to have the information ?language? as
a separate parameter of your service call, right?
Instead you would like to transfer this information behind the scenes
from the client to the server?
This can be achieved with hooks. You can register on the client side an
instance of ICallHook as OSGi-service. This service will be called on
each remote request before (beforeCall(CallContext context)) and after
(afterCall(CallContext context)) the actual remote call.
Whithin the beforeCall you can access the CallContext and obtain an
ICallMessageContext where you can add a request header with your
information.
On the server side you have to register the counterpart an instance of
IServiceHook. This service hook may now access your special information
and store it in a thread local so that your service can access it.

What that help?

However, the hooks will get called for every remote request.

HTH

Tschüß,
Stefan


Henzler Peter wrote:
> I have different services on the server side giving data.
> I want that the client can give some information along with the service
> call that make the service behave different.
>
> Example:
> I have a service that has many methods to query foo objects on the server.
> I want also call this service in a way where the language dependent data
> of the found objects gets translated before returning the result.
> Instead of duplicate the service and all the methods in it, I want to
> give some data to the server along with the service call that specify
> how the service handles that specific call. This could be a map with
> properties like 'translate=true' and 'languages=de,fr,en'
>
> Is there a build-in way to handle that?
> How can I set data for a single service call so that that data can be
> read on the server side when the call is processed?
>
> Thank you for any answer.
>
> Peter
>
Re: How how to send settings for a service call [message #23946 is a reply to message #23865] Tue, 31 March 2009 05:27 Go to previous message
Christian Campo is currently offline Christian CampoFriend
Messages: 597
Registered: July 2009
Senior Member
As Stefan mentions, a service hook is not specified on the service level but on the global level. Not sure if that it is
such a good place. How would you solve that problem that you describe with a local service ?

Wouldnt you just pass a HashMap that describes the desired behaviour ? Or is that different behavious just user
dependant ? Then accessing the userid (Principal) could control it. Last not least very often the remote service is only
a shallow instance that then delegates to the actual service. So indeed it might be an idea to have two such remote
services each delegating to the same local service but with different paramaters. So a remote Service method
search(lastname) could be delegated to search(lastname,"translate=true, language=de") for one remote service instance
and with a differnt second parm or another.

But we are just guessing here. Did any of that make sense ?

christian campo

Stefan Liebig schrieb:
> Hallo Peter,
>
> If I get you right you do not want to have the information ?language? as
> a separate parameter of your service call, right?
> Instead you would like to transfer this information behind the scenes
> from the client to the server?
> This can be achieved with hooks. You can register on the client side an
> instance of ICallHook as OSGi-service. This service will be called on
> each remote request before (beforeCall(CallContext context)) and after
> (afterCall(CallContext context)) the actual remote call.
> Whithin the beforeCall you can access the CallContext and obtain an
> ICallMessageContext where you can add a request header with your
> information.
> On the server side you have to register the counterpart an instance of
> IServiceHook. This service hook may now access your special information
> and store it in a thread local so that your service can access it.
>
> What that help?
>
> However, the hooks will get called for every remote request.
>
> HTH
>
> Tschüß,
> Stefan
>
>
> Henzler Peter wrote:
>> I have different services on the server side giving data.
>> I want that the client can give some information along with the
>> service call that make the service behave different.
>>
>> Example:
>> I have a service that has many methods to query foo objects on the
>> server.
>> I want also call this service in a way where the language dependent
>> data of the found objects gets translated before returning the result.
>> Instead of duplicate the service and all the methods in it, I want to
>> give some data to the server along with the service call that specify
>> how the service handles that specific call. This could be a map with
>> properties like 'translate=true' and 'languages=de,fr,en'
>>
>> Is there a build-in way to handle that?
>> How can I set data for a single service call so that that data can be
>> read on the server side when the call is processed?
>>
>> Thank you for any answer.
>>
>> Peter
>>
Re: How how to send settings for a service call [message #581583 is a reply to message #23822] Mon, 30 March 2009 13:35 Go to previous message
Stefan Liebig is currently offline Stefan LiebigFriend
Messages: 124
Registered: July 2009
Senior Member
Hallo Peter,

If I get you right you do not want to have the information ?language? as
a separate parameter of your service call, right?
Instead you would like to transfer this information behind the scenes
from the client to the server?
This can be achieved with hooks. You can register on the client side an
instance of ICallHook as OSGi-service. This service will be called on
each remote request before (beforeCall(CallContext context)) and after
(afterCall(CallContext context)) the actual remote call.
Whithin the beforeCall you can access the CallContext and obtain an
ICallMessageContext where you can add a request header with your
information.
On the server side you have to register the counterpart an instance of
IServiceHook. This service hook may now access your special information
and store it in a thread local so that your service can access it.

What that help?

However, the hooks will get called for every remote request.

HTH

Tschüß,
Stefan


Henzler Peter wrote:
> I have different services on the server side giving data.
> I want that the client can give some information along with the service
> call that make the service behave different.
>
> Example:
> I have a service that has many methods to query foo objects on the server.
> I want also call this service in a way where the language dependent data
> of the found objects gets translated before returning the result.
> Instead of duplicate the service and all the methods in it, I want to
> give some data to the server along with the service call that specify
> how the service handles that specific call. This could be a map with
> properties like 'translate=true' and 'languages=de,fr,en'
>
> Is there a build-in way to handle that?
> How can I set data for a single service call so that that data can be
> read on the server side when the call is processed?
>
> Thank you for any answer.
>
> Peter
>
Re: How how to send settings for a service call [message #581607 is a reply to message #23865] Tue, 31 March 2009 05:27 Go to previous message
Christian Campo is currently offline Christian CampoFriend
Messages: 597
Registered: July 2009
Senior Member
As Stefan mentions, a service hook is not specified on the service level but on the global level. Not sure if that it is
such a good place. How would you solve that problem that you describe with a local service ?

Wouldnt you just pass a HashMap that describes the desired behaviour ? Or is that different behavious just user
dependant ? Then accessing the userid (Principal) could control it. Last not least very often the remote service is only
a shallow instance that then delegates to the actual service. So indeed it might be an idea to have two such remote
services each delegating to the same local service but with different paramaters. So a remote Service method
search(lastname) could be delegated to search(lastname,"translate=true, language=de") for one remote service instance
and with a differnt second parm or another.

But we are just guessing here. Did any of that make sense ?

christian campo

Stefan Liebig schrieb:
> Hallo Peter,
>
> If I get you right you do not want to have the information ?language? as
> a separate parameter of your service call, right?
> Instead you would like to transfer this information behind the scenes
> from the client to the server?
> This can be achieved with hooks. You can register on the client side an
> instance of ICallHook as OSGi-service. This service will be called on
> each remote request before (beforeCall(CallContext context)) and after
> (afterCall(CallContext context)) the actual remote call.
> Whithin the beforeCall you can access the CallContext and obtain an
> ICallMessageContext where you can add a request header with your
> information.
> On the server side you have to register the counterpart an instance of
> IServiceHook. This service hook may now access your special information
> and store it in a thread local so that your service can access it.
>
> What that help?
>
> However, the hooks will get called for every remote request.
>
> HTH
>
> Tschüß,
> Stefan
>
>
> Henzler Peter wrote:
>> I have different services on the server side giving data.
>> I want that the client can give some information along with the
>> service call that make the service behave different.
>>
>> Example:
>> I have a service that has many methods to query foo objects on the
>> server.
>> I want also call this service in a way where the language dependent
>> data of the found objects gets translated before returning the result.
>> Instead of duplicate the service and all the methods in it, I want to
>> give some data to the server along with the service call that specify
>> how the service handles that specific call. This could be a map with
>> properties like 'translate=true' and 'languages=de,fr,en'
>>
>> Is there a build-in way to handle that?
>> How can I set data for a single service call so that that data can be
>> read on the server side when the call is processed?
>>
>> Thank you for any answer.
>>
>> Peter
>>
Previous Topic:How how to send settings for a service call
Next Topic:Authorizarion Service on client side causes problems
Goto Forum:
  


Current Time: Tue Apr 23 06:23:01 GMT 2024

Powered by FUDForum. Page generated in 0.03307 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top