Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Request PUT Method REST service

Former Member
0 Likes
1,723

Hi expert,

I try to send a put request to a REST service :

lv_url = 'muurl'.

  • *Create Client

call method cl_http_client=>create_by_url

exporting

url = lv_url

importing

client = http_client.

*

call method http_client->request->set_method('PUT').

CALL METHOD HTTP_CLIENT->REQUEST->SET_HEADER_FIELD

EXPORTING

NAME = 'accept'

VALUE = 'application/xml'.

  • Send

call method http_client->send

exceptions

http_communication_failure = 1

http_invalid_state = 2.

  • Receive

call method http_client->receive

exceptions

http_communication_failure = 1

http_invalid_state = 2

http_processing_failed = 3.

if sy-subrc ne 0.

http_client->response->get_status(

importing

code = lv_ret_code

reason = lv_err_string

).

message lv_err_string type 'I'.

endif.

  • Now we have the response , parse , display

  • do what you like

ret = http_client->response->get_cdata( ).

  • close

call method http_client->close

exceptions http_invalid_state = 1

others = 2.

The rt contains the value JAXBException occurred : Premature end of file.. Premature end of file..

Does ABAP support the PUT method ?

Thanks in advance

1 REPLY 1
Read only

Former Member
0 Likes
689

Problem solved , header authentication problem