01-18-2008 11:06 PM
Hi all,
I am using function module HTTP_POST to get xml from web. My object is working perfectly fine when I execute it in foreground (online) but the same when executed as a background job is not returning me anything.
Questions:
1. Is it possible to use this function module in a background job?
2. What can be errors in this case?
3. Solution please....
Points guranteed for the solution or helpful replies.
My code for reference:
CALL FUNCTION 'HTTP_POST'
EXPORTING
ABSOLUTE_URI = urlstring
REQUEST_ENTITY_BODY_LENGTH = reqlen
RFC_DESTINATION = 'SAPHTTP'
PROXY =
PROXY_USER =
PROXY_PASSWORD =
USER =
PASSWORD =
BLANKSTOCRLF =
IMPORTING
STATUS_CODE =
STATUS_TEXT =
RESPONSE_ENTITY_BODY_LENGTH =
TABLES
REQUEST_ENTITY_BODY = xmldoc[]
RESPONSE_ENTITY_BODY = response_body[]
RESPONSE_HEADERS = response_header[]
REQUEST_HEADERS = request_header[]
EXCEPTIONS
CONNECT_FAILED = 1
TIMEOUT = 2
INTERNAL_ERROR = 3
TCPIP_ERROR = 4
SYSTEM_FAILURE = 5
COMMUNICATION_FAILURE = 6
OTHERS = 7.
Thanks- Ags.
01-19-2008 4:56 AM
Hi Agasti,
Use class CL_HTTP_CLIENT. there is a method SET_HEADER_FIELD , u can use POST in that.
It will be something like below:
data: client type ref to if_http_client.
ur code to call the webservice API (method CREATE or CREATE_BY_URL
CALL METHOD client->request->set_header_field
EXPORTING
name = '~request_method'
value = 'POST'.
It will work.
cheers,
Hema.