on 01-20-2014 10:03 PM
Hi guys, i´m implementing a Facebook Photo Request from ABAP, using fiddler I create this message that was succesfully posted in facebook page, now I´m trying to copy this post using if_http_client and if_http_entity multipart methods.
POST https://graph.facebook.com/xxxxxxxx/photos?access_token=CAAUnJCRRhVUBAPFMl8p53wH8qfSuZAUZBo1IZCWJIo4... HTTP/1.1
Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
User-Agent: Fiddler
Host: graph.facebook.com
Content-Length: 758192
---------------------------acebdf13572468
Content-Disposition: form-data; name="fieldNameHere"; filename="2012-Fiat-500-Abarth-Rear-Angle-Speed-Tilt-1920x1440.jpg"
Content-Type: image/jpeg
I already set the header fields Content-Type / Content-length but I´m having some issues trying to replicate the boundary in the body in line 08. Here is my code in ABAP that represents the line 08 to 10 + the content of the photo to upload.
lr_part = lr_client->request->if_http_entity~add_multipart( ).
CONCATENATE 'form-data; name="fieldNameHere"; filename="' iv_file_name '";' INTO lv_file_header.
CALL METHOD lr_part->set_header_field
EXPORTING
name = 'content-disposition'
value = lv_file_header.
CALL METHOD lr_part->set_content_type
EXPORTING
content_type = 'image/jpeg'.
lv_len = XSTRLEN( iv_file_xstring ).
CALL METHOD lr_part->append_data
EXPORTING
data = iv_file_xstring
length = lv_len.
The facebook response is : "(#324) Requires upload file"
Any help will be appreciated
I resolve by myself, the boundary is set by standard I didn´t have to set in the header values, the other thing is that the content-length at header level is set by SAP, i delete that header field in my code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.