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... > > 2. Should we send PUT or POST Request ? > > 3. May we define a method with return value, e.g. String, or must be void? > > 4. Should we annotate our method with @Action(semantics = > SemanticsOf.NON_IDEMPOTENT) ? Without annotations, Isis proposes the POST > > 5. We put in request header > > Content-Type:text/plain > > Should we put something else/more? If-Match element? If yes which value? * > > 6. How the request body should look like? > > 6a: raw text ? e.g. ABC > > 6b: Json clob representation from previous description response > { > "clob": { > "value": "ABC" > } > } > > 6c: Json value > > { > "value": "ABC" > } > > > Depending on request variants, we get different exceptions. So we are not > sure if we use it wrongly or we have a bug... > > > > Thanks,Vladmir > >