taverna-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Dunlop <Ian.Dun...@manchester.ac.uk>
Subject RE: GSoC taverna mobile - how is the workflow upload
Date Thu, 02 Jul 2015 13:53:25 GMT
Hello,

When I base64 encode the workflow that Larry is using (myexperiment.org/workflows/35) I get
the following

PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzOnNjdWZsIHhtbG5zOnM9Imh0dHA6Ly9vcmcuZW1ibC5lYmkuZXNjaWVuY2UveHNjdWZsLzAuMWFscGhhIiB2ZXJzaW9uPSIwLjIiIGxvZz0iMCI+DQogIDxzOndvcmtmbG93ZGVzY3JpcHRpb24gbHNpZD0idXJuOmxzaWQ6bmV0LnNmLnRhdmVybmE6d2ZEZWZpbml0aW9uOmY1ZjZjYWI0LTM5MDQtNDE0Zi1iNWQ2LWYwOGZlMjJhMjM4NyIgYXV0aG9yPSIiIHRpdGxlPSJxdWVyeVNXU19taW5pbWFsUXVlcnkiIC8+DQogIDxzOnByb2Nlc3NvciBuYW1lPSJxdWVyeVNXUyI+DQogICAgPHM6ZGVzY3JpcHRpb24+UXVlcnkgYW4gU1JTIGxpYnJhcnk8L3M6ZGVzY3JpcHRpb24+DQogICAgPHM6c29hcGxhYndzZGw+aHR0cDovL2Jpb2luZm9ybWF0aWNzLmlzdGdlLml0OjgwODAvYXhpcy9zZXJ2aWNlcy9zd3MucXVlcnlTV1M8L3M6c29hcGxhYndzZGw+DQogIDwvczpwcm9jZXNzb3I+DQogIDxzOmxpbmsgc291cmNlPSJsaWIiIHNpbms9InF1ZXJ5U1dTOmxpYiIgLz4NCiAgPHM6bGluayBzb3VyY2U9InF1ZXJ5IiBzaW5rPSJxdWVyeVNXUzpxdWVyeSIgLz4NCiAgPHM6bGluayBzb3VyY2U9InF1ZXJ5U1dTOmVudHJpZXMiIHNpbms9ImVudHJpZXMiIC8+DQogIDxzOmxpbmsgc291cmNlPSJxdWVyeVNXUzpyZXBvcnQiIHNpbms9InJlcG9ydCIgLz4NCiAgPHM6c291cmNlIG5hbWU9ImxpYiIgLz4NCiAgPHM6c291cmNlIG5hbWU9InF1ZXJ5IiAvPg0KICA8czpzaW5rIG5hbWU9ImVudHJpZXMiIC8+DQogIDxzOnNpbmsgbmFtZT0icmVwb3J0IiAvPg0KPC9zOnNjdWZsPg0KDQo=

If you look closely you can see that datajson.toString() seems to be encoding it for JSON.
However I think it should just be the base64 encoded version as it is.

So, 
datajson.put("document", "data:application/octet-stream;base64,"+Base64.encodeToString(sb.toString().getBytes(),
Base64.DEFAULT)+"");  

Is possibly OK

But

postJson.put("workflow",datajson.toString());

might be encoding the whole datajson bit.

Cheers,

Ian 



-----Original Message-----
From: Ian Dunlop [mailto:Ian.Dunlop@manchester.ac.uk] 
Sent: 02 July 2015 14:06
To: dev@taverna.incubator.apache.org
Subject: RE: GSoC taverna mobile - how is the workflow upload

Hello,

Can you send me a link to the code in the repo please.

Cheers,

Ian

-----Original Message-----
From: Larry Akah [mailto:larryakah@gmail.com]
Sent: 02 July 2015 13:23
To: dev@taverna.incubator.apache.org
Subject: Re: GSoC taverna mobile - how is the workflow upload

2015-07-02 13:10 GMT+01:00 Ian Dunlop <Ian.Dunlop@manchester.ac.uk>:

> Hello,
>
> What is the output from
>
>                   datajson.toString()
>
Output: { "document":
"data:application\/octet-stream;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48czpzY3VmbCB4bWxuczpzPSJo\ndHRwOi8vb3JnLmVtYmwuZWJpLmVzY2llbmNlL3hzY3VmbC8wLjFhbHBoYSIgdmVyc2lvbj0iMC4y\nIiBsb2c9IjAiPiAgPHM6d29ya2Zsb3dkZXNjcmlwdGlvbiBsc2lkPSJ1cm46bHNpZDp3d3cubXln\ncmlkLm9yZy51azpvcGVyYXRpb246SzZaQ0c2SVdOUzAiIGF1dGhvcj0iIiB0aXRsZT0iIiAvPiAg\nPHM6cHJvY2Vzc29yIG5hbWU9IlN0cmluZ19Db25zdGFudCIgYm9yaW5nPSJ0cnVlIj4gICAgPHM6\nc3RyaW5nY29uc3RhbnQ+aHR0cDovL3d3dy5jcy5tYW4uYWMudWsvfmdvZGVyaXNhL1Bob3RvLmpw\nZzwvczpzdHJpbmdjb25zdGFudD4gIDwvczpwcm9jZXNzb3I+ICA8czpwcm9jZXNzb3IgbmFtZT0i\nR2V0X2ltYWdlX2Zyb21fVVJMIj4gICAgPHM6bG9jYWw+b3JnLmVtYmwuZWJpLmVzY2llbmNlLnNj\ndWZsd29ya2Vycy5qYXZhLldlYkltYWdlRmV0Y2hlcjwvczpsb2NhbD4gIDwvczpwcm9jZXNzb3I+\nICA8czpsaW5rIHNvdXJjZT0iU3RyaW5nX0NvbnN0YW50OnZhbHVlIiBzaW5rPSJHZXRfaW1hZ2Vf\nZnJvbV9VUkw6dXJsIiAvPiAgPHM6bGluayBzb3VyY2U9IkdldF9pbWFnZV9mcm9tX1VSTDppbWFn\nZSIgc2luaz0idml6IiAvPiAgPHM6c2luayBuYW1lPSJ2aXoiIC8+PC9zOnNjdWZsPg==\n"
}


>                   postJson.toString()
>
Output: { "workflow":
"{\"document\":\"data:application\\\/octet-stream;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48czpzY3VmbCB4bWxuczpzPSJo\\ndHRwOi8vb3JnLmVtYmwuZWJpLmVzY2llbmNlL3hzY3VmbC8wLjFhbHBoYSIgdmVyc2lvbj0iMC4y\\nIiBsb2c9IjAiPiAgPHM6d29ya2Zsb3dkZXNjcmlwdGlvbiBsc2lkPSJ1cm46bHNpZDp3d3cubXln\\ncmlkLm9yZy51azpvcGVyYXRpb246SzZaQ0c2SVdOUzAiIGF1dGhvcj0iIiB0aXRsZT0iIiAvPiAg\\nPHM6cHJvY2Vzc29yIG5hbWU9IlN0cmluZ19Db25zdGFudCIgYm9yaW5nPSJ0cnVlIj4gICAgPHM6\\nc3RyaW5nY29uc3RhbnQ+aHR0cDovL3d3dy5jcy5tYW4uYWMudWsvfmdvZGVyaXNhL1Bob3RvLmpw\\nZzwvczpzdHJpbmdjb25zdGFudD4gIDwvczpwcm9jZXNzb3I+ICA8czpwcm9jZXNzb3IgbmFtZT0i\\nR2V0X2ltYWdlX2Zyb21fVVJMIj4gICAgPHM6bG9jYWw+b3JnLmVtYmwuZWJpLmVzY2llbmNlLnNj\\ndWZsd29ya2Vycy5qYXZhLldlYkltYWdlRmV0Y2hlcjwvczpsb2NhbD4gIDwvczpwcm9jZXNzb3I+\\nICA8czpsaW5rIHNvdXJjZT0iU3RyaW5nX0NvbnN0YW50OnZhbHVlIiBzaW5rPSJHZXRfaW1hZ2Vf\\nZnJvbV9VUkw6dXJsIiAvPiAgPHM6bGluayBzb3VyY2U9IkdldF9pbWFnZV9mcm9tX1VSTDppbWFn\\nZSIgc2luaz0idml6IiAvPiAgPHM6c2luayBuYW1lPSJ2aXoiIC8+PC9zOnNjdWZsPg==\\n\"}"
}


> Cheers.
>
> Ian
> -----Original Message-----
> From: Ian Dunlop [mailto:Ian.Dunlop@manchester.ac.uk]
> Sent: 02 July 2015 13:03
> To: dev@taverna.incubator.apache.org
> Subject: RE: GSoC taverna mobile - how is the workflow upload
>
> Hello,
>
> Can you push your code up to github, in a branch if you want. It's 
> hard to read in the mail.
>
> Cheers,
>
> Ian
>
> -----Original Message-----
> From: Larry Akah [mailto:larryakah@gmail.com]
> Sent: 02 July 2015 12:29
> To: dev@taverna.incubator.apache.org
> Subject: Re: GSoC taverna mobile - how is the workflow upload
>
> Hello,
> I have encoded both the username/password and the workflow, if you 
> loook closer you will see that i encode at two points the last one 
> being where i am building the request body.
>
> i have used a smaller workflow but get the same error code. At first, 
> i would think that the base64 encoding was too long to be consumed 
> over http, but that apparently isn't the case.  Checkout the logs 
> again using the one but last workflow from the app, that is probably 
> the smallest workflow there. I have printed the workflow body when it is finished constructing.
>
> Cheers
>
> 2015-07-02 10:36 UTC+01:00, Ian Dunlop <Ian.Dunlop@manchester.ac.uk>:
> > Hello,
> >
> > From looking at the server logs it looks like you have Base64 
> > encoded your username/password as the workflow instead of the workflow.
> >
> > Cheers,
> >
> > Ian
> >
> > -----Original Message-----
> > From: Larry Akah [mailto:larryakah@gmail.com]
> > Sent: 02 July 2015 00:58
> > To: dev@taverna.incubator.apache.org
> > Subject: Re: GSoC taverna mobile - how is the workflow upload
> >
> > Hello,
> > Am trying to upload a workflow from the app but am getting a 'server 
> > internal error' message. Here is my code snippet:
> >
> >                 String user = "myportalusername" + ":" + 
> > "portalpassword";
> >>                 String basicAuth = "Basic " + 
> >> Base64.encodeToString(user.getBytes(), Base64.DEFAULT);
> >>
> >                 //prepare post json data
> >>                 JSONObject postJson = new JSONObject();
> >>                 JSONObject datajson = new JSONObject();
> >>                 datajson.put("document", 
> >> "data:application/octet-stream;base64,"+Base64.encodeToString(sb.to
> >> St r ing().getBytes(), Base64.DEFAULT)+"");  //sb already has the 
> >> contents of the workflow file we need to upload
> >>
> >                 postJson.put("workflow",datajson.toString());
> >>
> >>                 System.out.println(postJson.toString(2));
> >>                 connection.setRequestProperty("Authorization",
> >> basicAuth);
> >>            //     connection.setRequestProperty("Accept",
> >> "application/json");
> >>                 connection.setRequestProperty("Content-Type",
> >> "application/json");
> >>                 connection.setRequestMethod("POST");
> >>                 connection.connect(); //send request
> >>
> >>                 DataOutputStream dos = new 
> >> DataOutputStream(connection.getOutputStream());
> >>                 dos.writeBytes(postJson.toString());//write post 
> >> data which is a formatted json data representing body of workflow
> >>                 //dos.writeUTF("");
> >>                 dos.flush();
> >>                 dos.close();
> >>
> >>                 System.out.println("Post Response Code:
> >> "+connection.getResponseCode());
> >>                 System.out.println("Post response message:
> >> "+connection.getResponseMessage());
> >>
> >
> > Anything else that needs to be added or subtracted? or Why do i get 
> > this behavior?
> >
> > Cheers
> >
> > 2015-07-01 16:23 GMT+01:00 Ian Dunlop <Ian.Dunlop@manchester.ac.uk>:
> >
> >> Hello,
> >>
> >> @Larry just wondering how you are getting on with the workflow 
> >> upload after our mails yesterday.
> >>
> >> Cheers,
> >>
> >> Ian
> >>
> >
> >
> >
> > --
> > *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.
Mime
View raw message