Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Manual HTTP POST from ABAP

I'm trying to use a kind of botched 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. This presents a problem for me - understandably, this isn't part of WebAS 6.40's web services stuff.

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?

Tags:
Former Member
Former Member replied

Hi Robert,

Yes I ahve done manual ABAP HTTP_POST from ABAP.

Check this blog , I have mentioned this in it.

/people/ankur.jain3/blog/2005/07/27/abap-java-marriage-made-in-heaven

***********The sample code **************

REPORT Z_HTTP_POST .

PARAMETERS : uri(100) lower case

default 'http://192.168.1.1:8181/ankur/testServlet' .

DATA: Status_code(5),

Status_text(300),

Len type I.

DATA: t_request_header type table of sbcheader with header line,

t_request_body type table of sbcbody with header line,

t_response_header type table of sbcheader with header line,

t_response_body type table of sbcbody with header line .

CALL FUNCTION 'HTTP_POST'

EXPORTING

ABSOLUTE_URI = Uri

REQUEST_ENTITY_BODY_LENGTH = 300

  • RFC_DESTINATION =

  • PROXY =

  • PROXY_USER =

  • PROXY_PASSWORD =

  • USER =

  • PASSWORD =

BLANKSTOCRLF = 'X'

IMPORTING

STATUS_CODE = Status_code

STATUS_TEXT = Status_text

RESPONSE_ENTITY_BODY_LENGTH = Len

TABLES

REQUEST_ENTITY_BODY = t_request_body

RESPONSE_ENTITY_BODY = t_response_body

RESPONSE_HEADERS = t_response_header

REQUEST_HEADERS = t_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 t_response_header.

Write:/ t_response_header.

Endloop.

Skip(2).

Write:/ ‘the Body data : ‘ .

Loop at t_response_body.

Write:/ t_response_body.

Endloop.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question