on 03-12-2010 9:18 AM
Hi,
I am trying to fetch an image using the CL_HTTP_CLIENT class. My coding looks something like this:
TRY.
" Create the HTTP client
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = lv_img_url
IMPORTING
client = lo_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3.
IF sy-subrc = 0.
" Set header fields.
CALL METHOD lo_client->request->set_header_field
EXPORTING
name = '~request_method'
value = 'POST'.
CALL METHOD lo_client->request->set_header_field
EXPORTING
name = '~server_protocol'
value = 'HTTP/1.1'.
CALL METHOD lo_client->request->set_header_field
EXPORTING
name = 'Content-Type'
value = 'image/tiff'.
"send and receive
lo_client->send( ).
lo_client->receive( ).
"get status
lo_client->response->get_status( IMPORTING code = lv_return_code ).
"get the response as binary data
lv_img_xstring = lo_client->response->get_data( ).
"close connection
lo_client->close( ).
ENDIF. "sy-subrc = 0
CATCH cx_root.
ENDTRY.
The code is working fine when the url is pointing to a .jpeg file (and removing the set_header_field part). However, with an .tiff image url it does not work. Any help is greatly appreciated.
I am using the code in an assistance class to get the xstring representation of .tiff images. The xstring is converted using IGS and finally displayed in Web Dynpro ABAP.
Thanks.
Hi again,
this is one of the questions that I would have liked to avoid posting. It turned out that my links where copied from another system and therefore there was no document/image behind the link. Unfortunately, some of the jpeg images were real in the development system and that caused the differing behaviour.
The answer is therefore that the coding posted in this question works fine with .tiff images.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again,
this is one of the questions that I would have liked to avoid posting. It turned out that my links where copied from another system and therefore there was no document/image behind the link. Unfortunately, some of the jpeg images were real in the development system and that caused the differing behaviour.
The answer is therefore that the coding posted in this question works fine with .tiff images.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.