ok, i will try that. Thanks
2015-07-07 12:10 GMT+01:00 Ian Dunlop <[email protected]>: > Hello, > > I changed the encoding part to this: > > String data = "{\"document\":\"data:application/octet-stream;base64," + > > Base64.encodeToString(sb.toString().getBytes("UTF-8"), > Base64.URL_SAFE|Base64.NO_WRAP).replace('-', '+') +"\"}"; > > Basically I did a string replace on the Base64 encoded workflow using > .replace('-', '+') > > Then I tried uploading to the player and it worked. I haven't figured out > what your app does with the response but the request was successful on the > player. > > Cheers, > > Ian > > -----Original Message----- > From: Larry Akah [mailto:[email protected]] > Sent: 07 July 2015 11:58 > To: [email protected] > Subject: Re: GSOC Taverna Mobile: Uploading workflows to the Taverna player > > Hello, > Wait, but i am trying to upload workflow id 34 even with the '+' used and > i still get the 'Internal Server Error'. This is the base64 encoded > workflow: > > > PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHM6c2N1ZmwgeG1sbnM6cz0iaHR0cDovL29yZy5lbWJsLmViaS5lc2NpZW5jZS94c2N1ZmwvMC4xYWxwaGEiIHZlcnNpb249IjAuMiIgbG9nPSIwIj4KICA8czp3b3JrZmxvd2Rlc2NyaXB0aW9uIGxzaWQ9InVybjpsc2lkOnd3dy5teWdyaWQub3JnLnVrOm9wZXJhdGlvbjpLNlpDRzZJV05TMCIgYXV0aG9yPSIiIHRpdGxlPSIiIC8+CiAgPHM6cHJvY2Vzc29yIG5hbWU9IlN0cmluZ19Db25zdGFudCIgYm9yaW5nPSJ0cnVlIj4KICAgIDxzOnN0cmluZ2NvbnN0YW50Pmh0dHA6Ly93d3cuY3MubWFuLmFjLnVrL35nb2RlcmlzYS9QaG90by5qcGc8L3M6c3RyaW5nY29uc3RhbnQ+CiAgPC9zOnByb2Nlc3Nvcj4KICA8czpwcm9jZXNzb3IgbmFtZT0iR2V0X2ltYWdlX2Zyb21fVVJMIj4KICAgIDxzOmxvY2FsPm9yZy5lbWJsLmViaS5lc2NpZW5jZS5zY3VmbHdvcmtlcnMuamF2YS5XZWJJbWFnZUZldGNoZXI8L3M6bG9jYWw+CiAgPC9zOnByb2Nlc3Nvcj4KICA8czpsaW5rIHNvdXJjZT0iU3RyaW5nX0NvbnN0YW50OnZhbHVlIiBzaW5rPSJHZXRfaW1hZ2VfZnJvbV9VUkw6dXJsIiAvPgogIDxzOmxpbmsgc291cmNlPSJHZXRfaW1hZ2VfZnJvbV9VUkw6aW1hZ2UiIHNpbms9InZpeiIgLz4KICA8czpzaW5rIG5hbWU9InZpeiIgLz4KPC9zOnNjdWZsPgoKCg== > > > > This is the code am using to test the upload > > String data = "{\"document\":\"data:application/octet-stream;base64," + > > > > > "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHM6c2N1ZmwgeG1sbnM6cz0iaHR0cDovL29yZy5lbWJsLmViaS5lc2NpZW5jZS94c2N1ZmwvMC4xYWxwaGEiIHZlcnNpb249IjAuMiIgbG9nPSIwIj4KICA8czp3b3JrZmxvd2Rlc2NyaXB0aW9uIGxzaWQ9InVybjpsc2lkOnd3dy5teWdyaWQub3JnLnVrOm9wZXJhdGlvbjpLNlpDRzZJV05TMCIgYXV0aG9yPSIiIHRpdGxlPSIiIC8+CiAgPHM6cHJvY2Vzc29yIG5hbWU9IlN0cmluZ19Db25zdGFudCIgYm9yaW5nPSJ0cnVlIj4KICAgIDxzOnN0cmluZ2NvbnN0YW50Pmh0dHA6Ly93d3cuY3MubWFuLmFjLnVrL35nb2RlcmlzYS9QaG90by5qcGc8L3M6c3RyaW5nY29uc3RhbnQ+CiAgPC9zOnByb2Nlc3Nvcj4KICA8czpwcm9jZXNzb3IgbmFtZT0iR2V0X2ltYWdlX2Zyb21fVVJMIj4KICAgIDxzOmxvY2FsPm9yZy5lbWJsLmViaS5lc2NpZW5jZS5zY3VmbHdvcmtlcnMuamF2YS5XZWJJbWFnZUZldGNoZXI8L3M6bG9jYWw+CiAgPC9zOnByb2Nlc3Nvcj4KICA8czpsaW5rIHNvdXJjZT0iU3RyaW5nX0NvbnN0YW50OnZhbHVlIiBzaW5rPSJHZXRfaW1hZ2VfZnJvbV9VUkw6dXJsIiAvPgogIDxzOmxpbmsgc291cmNlPSJHZXRfaW1hZ2VfZnJvbV9VUkw6aW1hZ2UiIHNpbms9InZpeiIgLz4KICA8czpzaW5rIG5hbWU9InZpeiIgLz4KPC9zOnNjdWZsPgoKCg=="+"\"}"; > > String post = "{\"workflow\":"+data+"}"; > > > > System.out.println("BODY=>"+post); > > connection.setRequestMethod("POST"); > > connection.setRequestProperty("Authorization", > basicAuth); > > connection.setRequestProperty("Content-Type", > > "application/json"); > > connection.setRequestProperty("Content-Encoding", > "UTF-8"); > > connection.setUseCaches (false); > > connection.setDoOutput(true); > > connection.connect(); //send request > > > > DataOutputStream dos = new > > DataOutputStream(connection.getOutputStream()); > > > > dos.writeBytes(post);//write post data which is a > > formatted json data representing body of workflow > > // dos.writeChars(post); > > // dos.write(post.getBytes("UTF-8")); > > // dos.writeUTF(post); > > > > dos.flush(); > > dos.close(); > > > > System.out.println("Post Response Code: > > "+connection.getResponseCode()); > > System.out.println("Post response message: > > "+connection.getResponseMessage()); > > connection.disconnect(); > > > > Cheers > > 2015-07-07 11:45 GMT+01:00 Larry Akah <[email protected]>: > > > Ah, ok. Let me try some options out but i think the former would > > require a new implementation of android's base64 because i have tried > > all the possible options and they all give error. > > > > Cheers > > > > 2015-07-07 11:41 GMT+01:00 Ian Dunlop <[email protected]>: > > > >> Hello, > >> > >> We think we have figured out the issue with the encoding. Java Base64 > >> uses a '-' instead of a '+' when encoding. Command line in Linux and > >> Ruby expect a '+'. When we converted the raw Base64 encoded workflow > >> from the android request and changed all the '-' characters to a '+' > it works ok. > >> So either we need to figure out how to tell Java to use '+' instead of > '-' > >> or we change the encoded workflow string using string replace before > >> adding it to the request string. > >> > >> Lots of thanks to Finn for helping me to debug this. > >> > >> Cheers, > >> > >> Ian > >> > >> -----Original Message----- > >> From: Larry Akah [mailto:[email protected]] > >> Sent: 07 July 2015 11:37 > >> To: [email protected] > >> Subject: Re: GSOC Taverna Mobile: Uploading workflows to the Taverna > >> player > >> > >> Is it possible that i get the body of the request that the player is > >> actually receiving? > >> > >> Cheers > >> > >> 2015-07-07 11:36 GMT+01:00 Larry Akah <[email protected]>: > >> > >> > workflow id number 34 is the workflow i've been working with > >> > > >> > > >> > 2015-07-07 10:27 GMT+01:00 Ian Dunlop <[email protected]>: > >> > > >> >> Hello, > >> >> > >> >> It's hard to tell from the logs if the output relates to what you > >> >> are doing, what workflow are you trying to upload. The logs are > >> >> full of "parser > >> >> error: PCDATA invalid Char value ". Maybe there are characters in > >> >> it that the tavern player XML parser cannot read. Anyone else have > >> >> any > >> ideas. > >> >> > >> >> Cheers, > >> >> > >> >> Ian > >> >> > >> >> -----Original Message----- > >> >> From: Larry Akah [mailto:[email protected]] > >> >> Sent: 06 July 2015 17:52 > >> >> To: [email protected] > >> >> Subject: Re: GSOC Taverna Mobile: Uploading workflows to the > >> >> Taverna player > >> >> > >> >> What do the server logs reveal from the recent requests just few > >> >> moments ago? I could use some help from them. > >> >> > >> >> > >> >> Cheers > >> >> > >> >> 2015-07-06 12:22 GMT+01:00 alaninmcr <[email protected]>: > >> >> > >> >> > On 06/07/2015 12:03, Ian Dunlop wrote: > >> >> > > >> >> >> Hello, > >> >> >> > >> >> >> I just sent workflow 16 to the taverna player by base64 > >> >> >> encoding it on the command line and using curl and it all > >> >> >> worked ok. Here is the > >> >> >> base64 version > >> >> >> https://dl.dropboxusercontent.com/u/4958764/wf16.base64 Maybe > >> >> >> you need to ensure it is UTF-8 character set. > >> >> >> > >> >> > > >> >> > Also that it is not broken into lines. That file correctly keeps > >> >> > the > >> >> > base64 all in one line. Some base64 methods will, by default, > >> >> > break it into human-friendly lines which can be confusing for > >> >> > the reading > >> system. > >> >> > > >> >> > Cheers, > >> >> >> > >> >> >> Ian > >> >> >> > >> >> > > >> >> > Alan > >> >> > > >> >> > >> >> > >> >> > >> >> -- > >> >> *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. > >> > > > > > > > > -- > > *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.
