Hi Martin, thank you for your reply. Meanwhile I've made it. Here my method on e.g. SimpleObject
* @org.apache.isis.applib.annotation.MemberOrder(sequence = "5.1")* * @Action(semantics = SemanticsOf.NON_IDEMPOTENT)* * public void uploadFile(final Clob input) {* * logger.info <http://logger.info>("Uploaded file details: \nName: " + input.getName() + ", MimeType: " + input.getMimeType() + ", Length: " + input.getChars().length());* * }* After sending the post request *URL: http://localhost:8080/restful/objects/SIMPLE/L_0/actions/uploadFile/invoke <http://localhost:8080/restful/objects/SIMPLE/L_0/actions/uploadFile/invoke>* *No specific headers like e.g. ContentType* *Body: {"clob":{"value": "test.txt:text/plain:abc"}} * I've got the correct instantiated Clob object as action parameter. Thank you for your support! @Dan: I'm not sure if the RO spec in this case is up to date. Regs,Vladimir 2015-03-11 21:10 GMT+01:00 Martin Grigorov <mgrigo...@apache.org>: > Hi, > > I haven't used Isis restful support yet but let me think loud on your > questions: > > On Wed, Mar 11, 2015 at 6:33 PM, Vladimir Nišević <vnise...@gmail.com> > wrote: > > > Hi there, here my question I've posted in isis dev mailing list. Probably > > it is isis-users question. > > Maybe someone can help me with a hint. > > > > BR,Vladimir > > > > > > Anfang der weitergeleiteten E‑Mail: > > > > > Von: Vladimir Nišević <vnise...@gmail.com> > > > Datum: 06. März 2015 10:00:53 MEZ > > > An: "d...@isis.apache.org" <d...@isis.apache.org> > > > Betreff: Entity action with Clob parameter thru restful service > > > > > > Hi, we want to expose upload file feature of an entity thru restful > > interface. > > > > > > According to restful spec > > https://github.com/danhaywood/restfulobjects-spec it should go like > this: > > > > > > 16.2.2 Request (if blobClobs) > > > Updating blobClob properties is performed by PUTting the actual value > > > (e.g. image), with appropriate content type. > > > Note that optional validation (x-ro-validate-only) and domain type > > > metadata preferences (x-ro-domain-model) are not supported for > > > blobClobs. > > > 16.2.2.1 Query String > > > · none > > > 16.2.2.2 Headers > > > · Content-Type: (depends on property type) > > > o eg image/jpeg, image/png, application/pdf > > > · If-Match > > > o timestamp digest > > > obtained from ETag header of representation > > > only validate the request, do not modify the property > > > 16.2.2.3 Body > > > · a byte array (for blobs) > > > · a character array (for clobs) > > > > > > So our method signature is: > > > > > > public String uploadFile(Clob input) { ....} > > > > > > And calling restful description of single entity we get > > > > > > ... > > > "uploadFile": { > > > "id": "uploadFile", > > > "memberType": "action", > > > "links": [ > > > { > > > "rel": "urn:org.restfulobjects:rels/details;action=\"uploadFile\"", > > > "href": " > > > http://localhost:8080/restful/objects/ASE_BATCH_JOB/L_2354/actions/uploadFile > > ", > > > "method": "GET", > > > "type": > > > "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"" > > > } > > > ] > > > } > > > ... > > > > > > and in the next step we have > > > ... > > > { > > > "rel": "urn:org.restfulobjects:rels/invoke;action=\"uploadFile\"", > > > "href": " > > > http://localhost:8080/restful/objects/ASE_BATCH_JOB/L_2354/actions/uploadFile/invoke > > ", > > > "method": "POST", > > > "type": > > > "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"", > > > "arguments": { > > > "clob": { > > > "value": null > > > } > > > } > > > }, > > > ... > > > > > > So we have playing around with executing the methods thru e.g. postman > > (chrome app), but with no success. > > > > > > Here our questions: > > > > > > 1. URL should be something like: > > > http://localhost:8080/restful/objects/ASE_BATCH_JOB/L_2354/actions/uploadFile/invoke > > - this is pretty clear, I think... > > > > Agreed! Look correct! > > > > > > > > 2. Should we send PUT or POST Request ? > > > > Use PUT for idempotent operations and POST for non-idempotent > > > > > > > > 3. May we define a method with return value, e.g. String, or must be > > void? > > > > #uploadFile() is an action with a parameter (the Clob). > I am not sure about restful. > Wicket viewer will use the return type to render the result of the action. > I guess restful will do something similar, i.e. will render a String or an > empty response with code 200. > > > > > > > > 4. Should we annotate our method with @Action(semantics = > > SemanticsOf.NON_IDEMPOTENT) ? Without annotations, Isis proposes the POST > > > > See 2. > > > > > > > > 5. We put in request header > > > > > > Content-Type:text/plain > > > > > > Should we put something else/more? If-Match element? If yes which > value? > > * > > > > I guess you mean If-None-Match - this should be used for GET requests so > the server can decide whether to stream the body or just response 304 (non > modified). > The content-type value will be put in Clob#contentType, I guess. > > > > > > > > 6. How the request body should look like? > > > > > > 6a: raw text ? e.g. ABC > > > > yes, if content-type is "text/plain" > > > > > > > > 6b: Json clob representation from previous description response > > > { > > > "clob": { > > > "value": "ABC" > > > } > > > } > > > > > > 6c: Json value > > > > > > { > > > "value": "ABC" > > > } > > > > 6c looks correct if content-type is "application/json" and there is set up > converter/encoder that will instantiate a Java object automatically for you > > > > > > > > > > > Depending on request variants, we get different exceptions. So we are > > not sure if we use it wrongly or we have a bug... > > > > Please share the exceptions. It will be useful for us to see what is going > wrong and whether there is a bug in Isis. > > I'll test your use case tomorrow and let you know if I find the proper way. > > > > > > > > > > > > > > Thanks,Vladmir > > > > > > > > >