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 <[email protected]>:
> 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:[email protected]]
> Sent: 02 July 2015 00:58
> To: [email protected]
> 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.toStr
>> 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 <[email protected]>:
>
>> 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.

Reply via email to