‎2009 Oct 08 9:58 PM
I'm trying to use a web service implementation that doesn't come with a WSDL file - so, no generated proxy for me to use. It also needs me to send an XML file via an HTTP POST - not in a SOAP envelope.
Does anyone know of a way of manually posting something via HTTP in ABAP? I'm sure there must be some function module or class that exposes that functionality - I just can't find it! Any ideas anyone?
I have noticed a similar kind of post on SDN, the only difference in this case is the URL is HTTPS one. The vendor webservice works in two steps;
1. Login to the HTTPS service via login url(https://.../login.aspx), using uid and pwd.
2. Call the actual url(https://.../webservice/webser1.aspx) using which the xml data needs to be transmitted.
I have a sample code(C#), which works this way. Not sure how do we get this done in ABAP.
‎2009 Oct 09 3:42 AM
The following code is ABAP for a direct HTTP Post (not tested) I think. Also try looking at function module HTTP2_POST and programs that use it.
REPORT Z_HTTP_POST .
parameters : p_uri(100) lower case.
data: g_status_code(5),
g_status_text(300),
g_len type i.
data: gt_request_header type table of sbcheader with header line,
gt_request_body type table of sbcbody with header line,
gt_response_header type table of sbcheader with header line,
gt_response_body type table of sbcbody with header line .
*&---------------------------------------------------------------------*
*& Form post_it
*&---------------------------------------------------------------------*
form post_it.
call function 'HTTP_POST'
exporting
absolute_uri = p_uri
request_entity_body_length = 300
* RFC_DESTINATION =
* PROXY =
* PROXY_USER =
* PROXY_PASSWORD =
* USER =
* PASSWORD =
blankstocrlf = 'X'
importing
status_code = g_status_code
status_text = g_status_text
response_entity_body_length = g_len
tables
request_entity_body = gt_request_body
response_entity_body = gt_response_body
response_headers = gt_response_header
request_headers = gt_request_header
exceptions
connect_failed = 1
timeout = 2
internal_error = 3
tcpip_error = 4
system_failure = 5
communication_failure = 6
others = 7.
write: / 'the header data :'.
loop at gt_response_header.
write: / gt_response_header.
endloop.
skip.
write:/ 'the body data :' .
loop at gt_response_body.
write: / gt_response_body.
endloop.
endform. "post_it