Can anyone offer advice on how a mobile app could send photos back to a Progress database?
My development environment is OpenEdge Mobile App Builder 11.3.
Anyone following this forum could give nainroad1 some suggestions?
Currently we don't have support for CLOB and BLOB datatype support for REST and Mobile of OpenEdge.
Thanks and Regards,
Our app saves pictures as schase has suggested. We currently use SOAP services, as opposed to REST services, to achieve this. I believe that the camera service allows you to state what format you want the image data to be in. We use Appery.io directly, instead of going through OE Mobile, so I'm not sure where the differences begin and end.
Thanks Shelley for the stackoverflow link. I was wondering if anyone had done something like that and you've now pointed me to an example to use as a starting point.
It would be great if Progress added some blob/clob support to the REST service, but I fear that won't come very soon.
Even if Solomon is using Appery.io rather than OE Mobile it sounds like the serialization is working for him. It's nice to learn that at least one person has made a success of this.
That piece (Camera Service) is the same on OE Mobile and Appery.
I have not done what you are asking :(
The challenge here is that the information would need to fit inside a CHAR field (to be sent by REST to the backend).
If I had time to play, I would try something like this:
- Map the ImageDataBase64 directly to a LocalStorageVariable and find how big it is.
- I would map those multiple smaller string LocalStorageVariables to CHAR fields on a REST Service and invoke the service to send the data
- On the backend, when I receive the char fields/strings, I would re-join them into a single base64 clob.
- Lastly, I would write ABL code to convert that base64 clob string back into a Jpeg.
I agree with you, it would be 1000x easier If we could just pass the whole base64 string as a single clob field.
Cheers Ricardo. I appreciate the advice.
As a general rule, we do not support CLOB and BLOB parameters in OpenEdge . We do, however, support LONGCHAR and MEMPTR parameters and BLOB and CLOB temp-table fields in temp-table/dataset parameters..
Have tested this out. Was able to send the output of the Camera service back to the AppServer (didn't save it into the database but stripped the first 24 chars (which note that its data, a JPG and in base64), decoded it with the base64-decode and then used copy-log to copy the resulting Memptr to an image file and it works). I used a CLOB field in a temp--table for the data. I first tried blob but it failed plus the output of the Camera control was string.
You would have to decide if to store in your database the encoded or decoded and if to strip the leading character when storing it in the database or when writing it to windows file (as the web can show it with those chars).
Not sure if this helps.
The LONGCHAR sent from the app is BASE64 except for the start of the string which seems to be used by HTML browsers to tell them that it's a base64 encloded image. Output the LONGCHAR to a text file using COPY-LOB, COPY-LOB it back into a LONGCHAR, stripping out the initial junk then BASE64-DECODE it into a memptr. This can either then be displayed in a program or COPY-LOB into the database to store as a blob.
Yes Phillip and Jackie that does help. I'm almost ready to start working on the photo aspect of my app and every bit of advice gives me a better idea of how to approach the task. Just hearing people say 'they've done it' (and some details) makes me a lot more optimistic that I'm heading down the right path.
Sorry mainroad1 I've been very busy recently (stuck in rooms with no windows). I have this working in my expenses app and I'm willing to share code. I will try to get something to Jean to create a KB entry as I suspect others will want this functionality.
In the meantime please feel free to drop me any questions.
Thanks John. Code examples that shorten my development time are always very welcome!
mainroad1 you said: "It would be great if Progress added some blob/clob support to the REST service, but I fear that won't come very soon."...
Please feel free to report your suggestion in our Community Ideas.
Pick the product ad then you can enter your idea.
Others can then contribute, comment, promote/demote and collaborate.