‎2014 Jan 20 10:28 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/767710622/photos?access_token=CAAUnJCRRhVUBAPFMl8p53wH8qfSuZAUZBo1IZCWJIo... 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
���� FExif��II*� ��� �� � ���r �� � ���� �� � ������� � ��� ��� � ������� � ������� � ��� ��� � ��� ��� � ������� � �������( � ��� ���1 � �������2 � ��� ��i� � ��� ��@ �� � � �Canon�Canon EOS 5D Mark II���-� '����-� '��Adobe Photoshop CS5 Windows�2011:11:18 03:02:40�� ��� � ���� ���� � ���� ��"� � ��� ���'� � ��������� � ���0230 � � ���� �� � � ���� �� �
� ���� �� � � ���� �� �
� ���� �� � � ���� �� � � ���� �� � � ��� ��� � � ��� ���
� � ���� ���� � ���81���� � ���81�� � � ��� ��� � � ���� �� � � ���� �� � � ���� �� � � ���� �� � � ��� ��� � � ������� � � ��� ��� � � ������� � � �������1� �
���� ��2� � ��� ��4� � ���
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
‎2014 Jan 20 11:23 PM
‎2014 Jan 20 11:23 PM
‎2014 Jan 24 7:19 PM
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.