Flickr + Outsystems IMPOSSIBLE

Flickr + Outsystems IMPOSSIBLE

  

For at least 5 months I'm trying to integrate with Flickr, which still uses oAuth1.0a, I was able to implement all methods that use GET and POST (simple), but when trying to perform the call to the photo upload API, which uses multipart/form-data by merging text and binary parameters into the request body, the API simply rejects any and all submissions.


I have successfully with a sample request in SoapUI. I've replicated the same header and body using OnBeforeRequest but all requests coming from Outsystems return the same error message, I have exhausted all my possibilities and need help.


Except header parameter "Content-Length" all header parameters are the same.


Tests than I've tried:

  • Convert image from binary to text and send Body as Text
  • Convert all text to binary and concat with image file with BinaryConcat
  • Reorder parameters
  • Send all as binary
  • Send all as text


SoapUI POST Request (Success)

POST https://up.flickr.com/services/upload/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/form-data; boundary="----=_Part_25_29698294.1525876911842"
MIME-Version: 1.0
Content-Length: 46589
Host: up.flickr.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


------=_Part_25_29698294.1525876911842
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_consumer_key"

d8f96e6a197aa221229f14f00fd384e2
------=_Part_25_29698294.1525876911842
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_nonce"

2d8698c9b706def4
------=_Part_25_29698294.1525876911842
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_timestamp"

1525824000
------=_Part_25_29698294.1525876911842
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_signature_method"

HMAC-SHA1
------=_Part_25_29698294.1525876911842
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_token"

72157680396141572-91794de4471c83cf
------=_Part_25_29698294.1525876911842
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_signature"

9PlnZ+DbY192XuQtKWp2tNdivek=
------=_Part_25_29698294.1525876911842
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="photo"; filename="Teste.jpg"

<BINARY>

------=_Part_25_29698294.1525876911842


Outsystems HTTP Trace

(error: <?xml version="1.0" encoding="utf-8" ?>
<rsp stat="fail">
<err code="93" msg="POST size too large! Try something smaller, mmkay?" />
</rsp>)

POST https://up.flickr.com/services/upload/ HTTP/1.1
User-Agent: Apache-HttpClient/4.1.1
Content-Type: multipart/form-data; boundary="------=_Part_71_72122614.5288480520689"
MIME-Version: 1.0
Host: up.flickr.com
Content-Length: 35941

------=_Part_71_72122614.5288480520689
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_consumer_key"

d8f96e6a197aa221229f14f00fd384e2
------=_Part_71_72122614.5288480520689
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_nonce"

65024209646DDD8E3D570BF05F32A5EC
------=_Part_71_72122614.5288480520689
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_timestamp"

1525897297
------=_Part_71_72122614.5288480520689
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_signature_method"

HMAC-SHA1
------=_Part_71_72122614.5288480520689
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_token"

72157680396141572-91794de4471c83cf
------=_Part_71_72122614.5288480520689
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="oauth_signature"

FLucNWT3OT4Uyijisnh+2AlhWI4=
------=_Part_71_72122614.5288480520689
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="photo"; filename="Teste.jpg"

ÿØÿà JFIF  ` `  ÿÛ C  



  ÿÛ C  ÿÀ è7" ÿÄ           
ÿÄ µ   } !1AQa"q2‘¡#B±ÁRÑð$3br‚


Are you using the same image in both the successful and unsuccessful posts above? If so then one thing I can see is that the content length is around 10k different between them. Maybe there is a length calculation issue?

John Williams wrote:

Are you using the same image in both the successful and unsuccessful posts above? If so then one thing I can see is that the content length is around 10k different between them. Maybe there is a length calculation issue?

Yes, in both case the images are the same, the text binary data can't be pasted here due to this form restricions.


Maybe a Content-Length issue, I think, but this header param is assigned by Outsystems Server, even I setup in a same name param on Webservice config.


SoapUI


Outsystems HTTP Trace

Hi Saulo,

Have you had chance to look at the Asana Connector in the forge? They're uploading binaries with multipart/form-data  in the multipart/form-data in the Attachment_AddToTask?

Cheer,
Miguel

Solution

Miguel 'Kelter' Antunes wrote:

Hi Saulo,

Have you had chance to look at the Asana Connector in the forge? They're uploading binaries with multipart/form-data  in the multipart/form-data in the Attachment_AddToTask?

Cheer,
Miguel

Finally worked !!!!!!


The only difference I made to the method used by the Asana connector is the line break.


I used NewLine(), in Asana the developer used Chr (13) + Chr (10)


Thanks!!!

Solution

That's awesome Saulo! Glad to know.

Cheers,
Miguel