Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] POST ECF Rest call

Hi Atanas,

On 8/9/2011 8:53 AM, Атанас Тодоров wrote:
Hi Scott,

I have tried what you suggested.I also set the requestEntityType to 0 
HttpPostRequestType postRequest = new HttpPostRequestType(0); so the code on client side looks like that :
IRemoteCallParameter [] defaultParams = RemoteCallParameterFactory.createParameters("default","my Default Value");
HttpPostRequestType postRequest = new HttpPostRequestType(0);
IRemoteCallable callable = RestCallableFactory.createCallable(url, url,
   defaultParams, postRequest, IRestCall.DEFAULT_TIMEOUT);
IRemoteServiceRegistration registration = adapter.registerCallables(
new IRemoteCallable[] { callable }, null);
IRemoteService restClientService = adapter
.getRemoteService(registration.getReference());
InputStream inputStream = new ByteArrayInputStream("My Test value".getBytes(Charset.defaultCharset()));
return (T) restClientService.callSync(RestCallFactory.createRestCall(url, new Object[]{inputStream}));

And what happens as a result of this callSync?

Also...what is the value of url variable?  Perhaps there is some problem with the setup/mapping of the callables to Restlet remote method calls?  And how exactly does restlet represent the getResource method call in terms of the url + path + parameters?  My suspicion is that somehow the client is not providing the appropriate url+path+params that Restlet server expects for the getResource request.  Note the RestClientService class has a number of overridable methods (both public and protected) that allow the remote call to be made specific to a particular rest framework (e.g. Restlet).



I guess you are familiar with Restlet Framework.

Yes.  As I said, I have a Restlet-based ECF remote services provider now...that allows remote Restlet resources to be both discovered (via OSGi EndpointDescriptions), and a functioning proxy to be automatically created at remote service discover time.  This makes the implementation of the Restlet client completely unnecessary (i.e. it's done automatically by the OSGi remote services implementation).


On server side i have a restlet that expose a web resource.Making a remote rest call via ECF i actually invoke this method below.

@POST
public void getResource(){
org.restlet.Request ---> how take the send inputStream from that request
}

I am also  willing to provide some example if we make it work of course.

If you provide the client code that you are working with, and provide access to some service for testing, I'll help debug and we can then perhaps make it available as an example and/or test.

Scott


Back to the top