‎2009 May 12 4:15 PM
Hi, All,
I am using if_http_client to consume an external web service over https,
the following code works fine in a none-unicode system, but got a HTTP_INVALID_STATE exception from if_http_client->receive method call in an unicode activated system.
CALL METHOD cl_http_client=>create_by_destination
EXPORTING
destination = 'dest' "rfc_dest
IMPORTING
client = eo_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
destination_not_found = 4
destination_no_authority = 5.
CASE sy-subrc .
ENDCASE.
CALL METHOD eo_client->request->set_header_field
EXPORTING
name = '~request_method'
value = 'POST'.
CALL METHOD eo_client->request->set_header_field
EXPORTING
name = 'Content-Type'
value = 'text/xml; charset=utf-8'.
rlength = XSTRLEN( out_soap_stream ) .
MOVE: rlength TO txlen .
CALL METHOD eo_client->request->set_header_field
EXPORTING
name = 'Content-Length'
value = txlen.
CALL METHOD eo_client->request->set_header_field
EXPORTING
name = 'SoapAction'
value = 'exists'.
CALL METHOD eo_client->request->set_data
EXPORTING
data = out_soap_stream
offset = 0
length = rlength.
CALL METHOD io_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
http_invalid_timeout = 4.
CASE sy-subrc .
WHEN 0.
*******************************
ENDCASE.
CALL METHOD io_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.
CASE sy-subrc .
WHEN 0.
mv_error_code = 'S'.
WHEN 1.
msg = 'HTTP Communication Error at receiving data from dest'.
mv_error_code = 'E'.
WHEN 2.
msg = 'HTTP Communication with dest: Receiving Data: Invalid State'.
mv_error_code = 'E'.
WHEN 3.
msg = 'HTTP Communication with dest: Receiving Data: Processing Failed'.
mv_error_code = 'E'.
ENDCASE.
‎2009 May 13 1:32 AM