Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Serialization/Deserialization of parameters and return values

I was looking to use the generic provider. I think your recommendation should work for me.

Thanks

On Oct 25, 2011 3:16 PM, "Scott Lewis" <slewis@xxxxxxxxxxxxx> wrote:
Hi Jarmar,

On 10/25/2011 11:32 AM, Jarmar Fowler wrote:
I would like to serialize a service methods parameters to  JSON on the client side and deserialize from  JSON on the host side.   If this is possible what would be the recommended approach?

So the first thing to ask you is...which provider are you currently using?  (e.g. r-OSGi, REST, generic?).

With the REST provider the answer is a clear 'yes'...because there is support built into the REST api for customizing the marshalling of service method parameters.    Specifically, here's some example code [1].   See the call in setUp() to adapter.setAlso see the following javadocs [2].  The IRemoteServiceClientContainerAdapter has two methods:  setParameterSerializer [3], and setResponseDeserializer [4].  These can be used to set the parameter serialization and the response deserialization to use JSON (org.json bundle is included with ECF SDK)...or some other, custom serialization/deserialization.

>Can this be done declaratively?

Currently, no. 

Thanks,

Scott





[1] http://git.eclipse.org/c/ecf/org.eclipse.ecf.git/tree/tests/bundles/org.eclipse.ecf.tests.remoteservice.rest/src/org/eclipse/ecf/tests/remoteservice/rest/twitter/TwitterRemoteServiceTest.java

[2] http://download.eclipse.org/rt/ecf/3.5.2/javadoc/org/eclipse/ecf/remoteservice/client/IRemoteServiceClientContainerAdapter.html

[3] http://download.eclipse.org/rt/ecf/3.5.2/javadoc/org/eclipse/ecf/remoteservice/client/IRemoteServiceClientContainerAdapter.html#setParameterSerializer(org.eclipse.ecf.remoteservice.client.IRemoteCallParameterSerializer)

[4] http://download.eclipse.org/rt/ecf/3.5.2/javadoc/org/eclipse/ecf/remoteservice/client/IRemoteServiceClientContainerAdapter.html#setResponseDeserializer(org.eclipse.ecf.remoteservice.client.IRemoteResponseDeserializer)



_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev


_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev


Back to the top