3

What's the correct way of transferring media (photos or movies) using Worklight Adapters?

I sent a photo via the adapter and got the error: form too large, exceed the maximum size... I read I need to change the form size through the Jetty

but the server I'll deploy the app won't be a jetty so what shell i do?
Thanks!

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
A.B
  • 31
  • 2

2 Answers2

3

Please see topic Uploading large (and binary) files to Worklight adapter.

Basically, Worklight does not have the equivalent to an HTTP POST mechanism that allows you to transfer arbitrarily large chunked data. For large files of unknown sizes (photos, video, audio) you'll need to upload the file to the server outside the Worklight adapter framework. For example you could simply post it to a web server you have configured. In my case (in the above referenced answer) I needed to create an entire client-server mechanism to negotiate a port and key, start listening on that port, then accept requests and ensure the posting client passes the key as authorization to transfer the secure data.

Hopefully IBM will provide a formal service for this in a future release.

Community
  • 1
  • 1
user2217751
  • 476
  • 6
  • 14
  • you say "Hopefully IBM will provide a formal service for this in a future release." Any news about that? More details? – WiPhone May 05 '14 at 21:20
1

Adapters do not work with html forms, they work with data. You will need to convert your image to base64 and submit as a adapter invocation parameter.

Having more information regarding what exactly you're trying to achieve might be helpful.

Anton
  • 3,166
  • 1
  • 13
  • 12
  • 1
    I try to transfer a photo. I converted it to base64 but then got an error cause the form was too large. I can change the jetty but it won't help me cause i don't know on which server the application would be deployed on (tomcat\libraty or so)... I would like to know what's the correct way of transferring large data... – A.B Mar 17 '13 at 13:28
  • Edit your post with code snippets - how did you transform the data? what do your functions and procedures look like in the adapter code? Also, file size is of no concern for the application server you will use - that would be a database issue. – Idan Adar Mar 17 '13 at 15:11
  • I take the base64 as an input and call in the adapter to the WL.Server.invokeHttp(input); i read on the worklight form : [link] (https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14916714) that when i receive this exception (form too large) i need to change my jetty parameters... but i deploy the app not on jetty... – A.B Mar 17 '13 at 15:53
  • 1
    I still receive the error. What's the correct way of transferring big data via Worklight? – A.B Mar 19 '13 at 09:33