on 10-18-2005 6:55 PM
Hi!
I have an scenario where i have one RFC Function module that call a WebService (Java/EJB) that brings the information from a Oracle DB. The RFC parse the results and populate my return tables.
When i call the WebService from wsnavigator in portal(http://url:port/wsnavigator), it returns the words with the special characters OK, eg: "Pend
ê
ncia".ê
ncia". The same happens with the following characters: áéíóúãàòìùäëïöüãõâêîôûçñ...This situation only happens when i call the WebService from ABAP using the interface if_http_client, and it looks like the charset is wrong, but when i set the header of the HTTP REQUEST, i set the charset to iso-8859-1, as follows:
-
-
...
CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~request_method'
value = 'POST'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~server_protocol'
value = 'HTTP/1.1'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'Content-Type'
value = 'text/xml; charset=iso-8859-1;'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'Content-Length'
value = txlen.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'SOAPAction'
value = ''.
...
-
-
Any idea?
Thanks in advance.
I solved it converting the code-page from the return of the web-service:
* After receive the return from the WebService,
* move the result to the string wf_string1.
clear wf_string1 .
wf_string1 = http_client->response->get_cdata( ).
* Some variables
data: conv type ref to cl_abap_conv_in_ce,
wf_stringx type xstring,
viewoff type ref to cl_abap_view_offlen,
len type i,
content type string.
* Convert the return string of the webservice to Hexadecimal
call function 'SCMS_STRING_TO_XSTRING'
exporting
text = wf_string1
mimetype = ''
importing
buffer = wf_stringx.
* call the method to convert UTF-8(Code-page 4110) to ISO-8859-1(1100)
conv = cl_abap_conv_in_ce=>create(
encoding = '4110'
endian = 'L'
input = wf_stringx ).
* Read the conversion result
conv->read(
exporting
view = viewoff
importing
data = content
len = len ).
* Result string...
wf_string1 = content.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.