Community
Participate
Working Groups
Build Identifier: First of all i am not sure if it is a bug or not bug we ageed with Scott to open this bug for the ease of debug. I have a server-client application that runs in OSGI.Server is jetty. 1.On Server side i use Restlet API to expose restlets the way it is described in this tutorial: http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/312-restlet.html 2.On client i use ECF Rest api to make a sync rest call. The problem is i cannot pass content with post request from client to server. Reproducible: Always Steps to Reproduce: Will attach source.
Created attachment 201230 [details] client and server bundles I attached the client and server which are osgi bundles. The server depends on restlet jars.The client depends on ecf jars.Depenedent packages you can find in the manifests.
Here is the HTTP communication sniffed with wireShark. I can see that the POST request does not include the String "op" i am trying to pass. HTTP/1.1 200 OK Date: Wed, 10 Aug 2011 10:21:19 GMT Content-Type: application/xml; charset=UTF-8 Content-Length: 509 Date: Wed, 10 Aug 2011 10:21:19 GMT Accept-Ranges: bytes Server: Restlet-Framework/2.0.8 Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept <?xml version="1.0" encoding="UTF-8" standalone="yes"?><configuration><types><type><configurationObjectClassName>java.util.Properties</configurationObjectClassName><description>simple properties test configuration</description><displayName>Test Properties</displayName><id>system.properties</id><restartRequired>false</restartRequired><serializerClassName>com.softwareag.platform.management.common.configuration.serializer.PropertiesConfigurationSerializer</serializerClassName></type></types></configuration> ================================================================================================ POST /spm/configuration/types/SPM-PROCESS/system.properties? HTTP/1.1 User-Agent: Jakarta Commons-HttpClient/3.1 Content-Length: 0 Authorization: Basic QWRtaW5pc3RyYXRvcjptYW5hZ2U= Host: localhost:8092 ================================================================================================ HTTP/1.1 401 Unauthorized Date: Wed, 10 Aug 2011 10:21:19 GMT WWW-Authenticate: basic realm="DummyLogin" Content-Type: text/html;charset=ISO-8859-1 Cache-Control: must-revalidate,no-cache,no-store Content-Length: 1424 Server: Jetty(7.0.2.v20100331) <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 401 Unauthorized</title> </head> <body><h2>HTTP ERROR 401</h2> <p>Problem accessing /spm/configuration/types/SPM-PROCESS/system.properties. Reason: <pre> Unauthorized</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> </body> </html> ================================================================================================ POST /spm/configuration/types/SPM-PROCESS/system.properties? HTTP/1.1 User-Agent: Jakarta Commons-HttpClient/3.1 Host: localhost:8092 Content-Length: 0
I manage to fix that by registring callable with some default RemoteCallParameters and with requestEntityType equal to "1" IRemoteCallParameter[] rcp = RemoteCallParameterFactory.createParameters("", ""); HttpPostRequestType requestType = new HttpPostRequestType(1); IRemoteCallable callable = RestCallableFactory.createCallable(resource, resource, rcp, requestType,IRestCall.DEFAULT_TIMEOUT); comment: createCallable method requires as parameter AbstractRequestType(the abstract class) instead of IRemoteCallableRequestType(interface).Probably you can fix that.
What in my mind is not quite intuitive is that user need to instatiate HttpPostRequstType with some int args depending on what is going to be transferred trough the wire(String,inputStream.....) and register callable with some default parameters. e.g IRemoteCallParameter[] rcp = RemoteCallParameterFactory.createParameters("",""); Skipping these two actions didn't work for me.
(In reply to comment #3) > I manage to fix that by registring callable with some default > RemoteCallParameters and with requestEntityType equal to "1" > > IRemoteCallParameter[] rcp = RemoteCallParameterFactory.createParameters("", > ""); > HttpPostRequestType requestType = new HttpPostRequestType(1); > IRemoteCallable callable = RestCallableFactory.createCallable(resource, > resource, rcp, requestType,IRestCall.DEFAULT_TIMEOUT); > > comment: createCallable method requires as parameter AbstractRequestType(the > abstract class) instead of IRemoteCallableRequestType(interface).Probably you > can fix that. Hi Atanas. Good to here that things are working. Would it be possible for you to attach the working code to this bug? That way I can possibly take it and turn it into an example for others to use. Also changing title of bug and changing to enhancement. Thanks.
(In reply to comment #4) > What in my mind is not quite intuitive is that user need to instatiate > HttpPostRequstType with some int args depending on what is going to be > transferred trough the wire(String,inputStream.....) and register callable with > some default parameters. > e.g > IRemoteCallParameter[] rcp = > RemoteCallParameterFactory.createParameters("",""); > Skipping these two actions didn't work for me. I agree that the post and put API could be simplified. I'm unable to put a lot of time into it at the moment, so can't take on a redesign at the moment...but if you are willing, please suggest some specific changes without loss of generality...and we can discuss them here and I can/will apply them (for ECF 3.6...that's the earliest that API changes can be applied due to Eclipse dev process). Thanks.
An example was created in tests.