‎2005 Oct 18 6:56 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.
‎2005 Oct 18 8:51 PM
May be you don't have the right code page. I am not an expert, but check on that aspect with your basis administrators.
Here is the documentation related to code pages.
SAP character set identification
Definition
The 4-character name of an SAP character set as defined
in SAP character set maintenance.
The following explains the naming convention in more detail:
First digit: Code
0 EBCDIC character sets
1 ASCII character sets
2 mixed single byte / double byte character sets
4 double-byte character sets
6 mixed character sets
8 double byte and multibyte character sets
9 reserved for code pages you define
Second digit: Country
1-3 countries that use the Latin alphabet (Western Europe, North and South America, Australia, Africa)
4-6 countries that use non-Latin alphabets and writing
systems (Eastern Europe, Asia, Arabic countries in Africa)
7-9 reserved for special languages
Third and fourth digits: Sequential number
Example
0100 IBM 00697/00273 (Latin 1 - Germany/Austria)
0401 SNI BS2000 8859-5 EHCLC (cyrillic - multiple languages)
The table is TCP00.
Message was edited by: Srinivas Adavi
‎2005 Dec 08 6:59 PM
I solved it by converting the code-page in the return of the webservice call...
* 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.