Am no longer using the json. i have simply constructed the body as a string:
String data =
"{\"document\":\"data:application/octet-stream;base64,"+Base64.encodeToString(sb.toString().getBytes(),
Base64.DEFAULT)+"\"}";
String post = "{\"workflow:\""+data+"}";
then i write the 'post' string to the player url
Cheers
2015-07-03 13:48 GMT+01:00 Ian Dunlop <[email protected]>:
> Hello,
>
> Maybe the JSONObject postJson or dos.writeBytes(postJson.toString()); in
> https://github.com/larrytech7/incubator-taverna-mobile/blob/master/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java
> is not doing what you think it should. Try creating the request as a string
> rather than using the JSONObject. It is just a string like in my message
> below.
>
> Cheers,
>
> Ian
>
> -----Original Message-----
> From: Larry Akah [mailto:[email protected]]
> Sent: 03 July 2015 13:47
> To: [email protected]
> Subject: Re: GSOC Taverna Mobile: Uploading workflows to the Taverna player
>
> I did the same thing with a Chrome REST client and it worked ok, but from
> the java request, i don't seem to figure out exactly what could be
> happening behind the scenes.
>
> 2015-07-03 13:39 GMT+01:00 Ian Dunlop <[email protected]>:
>
> > Hello,
> >
> > I just tried sending a workflow using curl with the request formatted
> > like below and the player is working ok and sent back the correct
> response.
> >
> > {"workflow" : { "document" :
> > "data:application/octet-stream;base64,BASE64
> > ENCODE WORKFLOW GOES HERE"}}
> >
> > Where BASE64 ENCODE WORKFLOW GOES HERE is the BASE 64 encoded version
> > of the workflow with no url encoding.
> >
> > Cheers,
> >
> > Ian
> >
> > -----Original Message-----
> > From: Ian Dunlop [mailto:[email protected]]
> > Sent: 03 July 2015 13:29
> > To: [email protected]
> > Subject: RE: GSOC Taverna Mobile: Uploading workflows to the Taverna
> > player
> >
> > Hello,
> >
> > Unfortunately I can't see your request in the logs for some reason
> > (some docker issue that we don't understand). Can you paste the body
> > in an email (remember not to include any username/password stuff).
> >
> > Cheers,
> >
> > Ian
> >
> > -----Original Message-----
> > From: Larry Akah [mailto:[email protected]]
> > Sent: 03 July 2015 12:26
> > To: [email protected]
> > Subject: GSOC Taverna Mobile: Uploading workflows to the Taverna
> > player
> >
> > Hello, now, am posting the body exactly as described without encoding
> > with json and am getting a 400 bad request message.
> > Anything that could be done about that?
> >
> > Cheers
> >
> >
> > 2015-07-02 10:23 GMT+01:00 Ian Dunlop <[email protected]>:
> >
> > > Hello,
> > >
> > > That’s good news. Can’t wait to see it working in the app – let me
> > > know when you have committed the code. By the way, I think the
> > > mailing list removes attachments, probably best to either add
> > > screenshots to JIRA or send links to the screenshots in something
> > > like dropbox or
> > google drive.
> > >
> > > Cheers,
> > >
> > > Ian
> > >
> > > From: Larry Akah [mailto:[email protected]]
> > > Sent: 01 July 2015 20:07
> > > To: [email protected]
> > > Subject: Re: gsoc taverna mobile - creating a run causes 'fatal'
> > > error and app stops.
> > >
> > > Great, i think its working. I have tested it from a REST client in
> > > chrome and i receieved the 201 status code and the structure of the
> > > workflow. Find here attached a screenshot of the post request.
> > > Next up, i will be incorporating that into the app.
> > >
> > > cheers
> > >
> > > 2015-06-30 6:39 GMT-05:00 Larry Akah <[email protected]<mailto:
> > > [email protected]>>:
> > > Ok, thanks.
> > > When i try that, i will send my feedback.
> > >
> > > Cheers
> > >
> > > 2015-06-30 6:35 GMT-05:00 Ian Dunlop <[email protected]
> > <mailto:
> > > [email protected]>>:
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > >
> > > Hello,
> > >
> > > I think the workflow can just be sent as it is. The request is JSON
> > > formatted but the things inside the request don't have to be. The
> > > t2flow/xml can be sent base64 encoded as they are.
> > >
> > > Cheers,
> > >
> > > Ian
> > >
> > > On 30/06/15 12:32, Larry Akah wrote:
> > > > Hello, The workflows we get from myexperiment are formatted as xml
> > > > or t2flow files. Do these absolutely need to be converted in json
> > > > before posting or they can be sent as is?
> > > >
> > > > Cheers
> > > >
> > > > 2015-06-30 5:11 GMT-05:00 Ian Dunlop
> > > > <[email protected]<mailto:[email protected]>>:
> > > >
> > > > Hello,
> > > >
> > > > I've had a chat with the taverna player developer and you need to
> > > > send a request as follows:
> > > >
> > > > POST to /workflows.json
> > > >
> > > > {"workflow" : { "document" :
> > > > "data:application/octet-stream;base64,BASE64 ENCODED WORKFLOW GOES
> > > > HERE"}}
> > > >
> > > > using HTTP basic auth with username:password base64 encoded in the
> > > > Authorization header in the request e.g. Authorization: Basic
> > > > QWxhZGRpbjpvcGVuIHNlc2FtZQ==. You have to specify .json because
> > > > the content type is not being respected for some reason.
> > > >
> > > >
> > > > Here's an example using curl: curl -u your_username -X POST -H
> > > > "Content-Type: application/json" [email protected]<mailto:[email protected]>
> > > > http://taverna-player-server/workflows.json
> > > >
> > > > where wf.json is the workflow file, this would then prompt for a
> > > > passwor d. Hope this helps, please let us know how you get on.
> > > >
> > > > Cheers,
> > > >
> > > > Ian
> > > >
> > > > On 29/06/15 19:23, Larry Akah wrote:
> > > >>>> I need some help with uploading a workflow to the player. The
> > > >>>> API doesn't make it seem possible currently. How is it done?
> > > >>>>
> > > >>>> cheers
> > > >>>>
> > > >>>> 2015-06-29 16:55 GMT+01:00 Larry Akah <[email protected]
> <mailto:
> > > [email protected]>>:
> > > >>>>
> > > >>>>> Yes, its not yet ready. i still need to adjust that because at
> > > >>>>> first , i was using the player to fetch workflows and derived
> > > >>>>> a run skeleton to use for creating workflows. There is still
> > > >>>>> some stuff that needs to be fixed there.
> > > >>>>>
> > > >>>>> Cheers
> > > >>>>>
> > > >>>>> 2015-06-29 16:34 GMT+01:00 Ian Dunlop
> > > >>>>> <[email protected]<mailto:[email protected]
> >>:
> > > >>>>>
> > > >>>>>> Hello,
> > > >>>>>>
> > > >>>>>> I got a ‘fatal’ error which the emulator reported when
> > > >>>>>> clicking on ‘create run’:
> > > >>>>>>
> > > >>>>>> 06-29 15:25:39.554
> > > >>>>>> 8216-8216/mobile.taverna.apache.org.tavernamobile
> > > >>>>>> E/AndroidRuntime﹕ FATAL EXCEPTION: main Process:
> > > >>>>>> mobile.taverna.apache.org.tavernamobile, PID: 8216
> > > >>>>>> java.lang.NullPointerException: Attempt to invoke virtual
> > > >>>>>> method 'void android.app.AlertDialog.show()' on a null object
> > > >>>>>> reference at
> > > >>>>>> org.apache.taverna.mobile.fragments.workflowdetails.Workflowd
> > > >>>>>> et
> > > >>>>>> ai
> > > lFr
> > > >
> > > >>>>>>
> > > agment$WorkflowRunTask.onPostExecute(WorkflowdetailFragment.java:407
> > > )
> > > >>>>>>
> > > >>>>>>
> > > > at
> > > >>>>>> org.apache.taverna.mobile.fragments.workflowdetails.Workflowd
> > > >>>>>> et
> > > >>>>>> ai
> > > lFr
> > > >
> > > >>>>>>
> > > agment$WorkflowRunTask.onPostExecute(WorkflowdetailFragment.java:289
> > > )
> > > >>>>>>
> > > >>>>>>
> > > > at android.os.AsyncTask.finish(AsyncTask.java:636)
> > > >>>>>> at android.os.AsyncTask.access$500(AsyncTask.java:177)
> > > >>>>>> at
> > > >>>>>> android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.
> > > >>>>>> ja
> > > >>>>>> va
> > > :65
> > > >
> > > >>>>>>
> > > 3)
> > > >>>>>>
> > > >>>>>>
> > > > at android.os.Handler.dispatchMessage(Handler.java:102)
> > > >>>>>> at android.os.Looper.loop(Looper.java:135) at
> > > >>>>>> android.app.ActivityThread.main(ActivityThread.java:5257)
> > > >>>>>> at java.lang.reflect.Method.invoke(Native Method) at
> > > >>>>>> java.lang.reflect.Method.invoke(Method.java:372) at
> > > >>>>>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(Zy
> > > >>>>>> go
> > > >>>>>> te
> > > Ini
> > > >
> > > >>>>>>
> > > t.java:903)
> > > >>>>>>
> > > >>>>>>
> > > > at
> > > >>>>>> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > The device reported that the app had stopped running but in
> > > >>>>>> fact it returned it to the workflows view but all the
> > > >>>>>> workflows had disappeared from the view. I guess it’s
> > > >>>>>> probably because this functionality is not ready yet but I
> > > >>>>>> figured I should report it anyway.
> > > >>>>>>
> > > >>>>>> Cheers,
> > > >>>>>>
> > > >>>>>> Ian
> > > >>>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> -- *Akah Larry N.H*
> > > >>>>>
> > > >>>>> *Lead Software Engineer @ GiftedMom* *Founder IceTeck Inc*
> > > >>>>> *www.iceteck.com<http://www.iceteck.com>*
> > > >>>>>
> > > >>>>> Developing technologies for emergence and sustainable
> > > >>>>> development.
> > > >>>>>
> > > >>>>>
> > > >>>>
> > > >>>>
> > > >>
> > > >
> > > >
> > > >
> > > -----BEGIN PGP SIGNATURE-----
> > > Version: GnuPG v1
> > > iQEcBAEBAgAGBQJVkn8TAAoJEPK45GBX+Cy5iC0IAJ9YpVLfGxgdd+LHyo3eOMfY
> > > SO4sL23TS/htyvAU/61BQh85g8TEmUOvo/19tGkc7ExXf97rTtGc9/KMkHeyeqp+
> > > rnz4OCLHujtsuRgy8P2AZeCibjtb3tqxBuIXmk4fcGyF9IiokHMtHksI0FMcERl8
> > > xYJKacZ4j8XGC7m3oskpLwgF936UbuZTtUsP0rE9JkZgjJU39rjbmGh5ibgHGF35
> > > iYuyO2kb7XQMM3evZHqRkelAK8yraFi6/J+qeVadBGrxPk+8QcyCO21833MXYP1X
> > > wZnLkSfribveFAq8bVLZgbZTmdt9Txwa+5sKBaCVG34voPIRFisg6u7lxgm5Wbs=
> > > =RrFl
> > > -----END PGP SIGNATURE-----
> > >
> > >
> > >
> > > --
> > > *Akah Larry N.H*
> > > *Lead Software Engineer @ GiftedMom* *Founder IceTeck Inc*
> > > *www.iceteck.com<http://www.iceteck.com>*
> > >
> > > Developing technologies for emergence and sustainable development.
> > >
> > >
> > >
> > > --
> > > *Akah Larry N.H*
> > > *Lead Software Engineer @ GiftedMom* *Founder IceTeck Inc*
> > > *www.iceteck.com<http://www.iceteck.com>*
> > >
> > > Developing technologies for emergence and sustainable development.
> > >
> >
> >
> >
> > --
> > *Akah Larry N.H*
> >
> > *Lead Software Engineer @ GiftedMom*
> > *Founder IceTeck Inc*
> > *www.iceteck.com*
> >
> > Developing technologies for emergence and sustainable development.
> >
>
>
>
> --
> *Akah Larry N.H*
>
> *Lead Software Engineer @ GiftedMom*
> *Founder IceTeck Inc*
> *www.iceteck.com*
>
> Developing technologies for emergence and sustainable development.
>
--
*Akah Larry N.H*
*Lead Software Engineer @ GiftedMom*
*Founder IceTeck Inc*
*www.iceteck.com*
Developing technologies for emergence and sustainable development.