<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Wrong Characters returned by the WebService in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/wrong-characters-returned-by-the-webservice/m-p/1028538#M83082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I solved it by converting the code-page in the return of the webservice call...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* After receive the return from the WebService,
* move the result to the string wf_string1.
  clear wf_string1 .
  wf_string1 = http_client-&amp;gt;response-&amp;gt;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=&amp;gt;create(
                        encoding = '4110'
                          endian = 'L'
                           input = wf_stringx ).

* Read the conversion result
  conv-&amp;gt;read(
   exporting
     view = viewoff
   importing
     data = content
     len  = len ).
* Result string...
  wf_string1 = content.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Dec 2005 18:59:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-12-08T18:59:12Z</dc:date>
    <item>
      <title>Wrong Characters returned by the WebService</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/wrong-characters-returned-by-the-webservice/m-p/1028536#M83080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i call the WebService from wsnavigator in portal(http://url:port/wsnavigator), it returns the words with the special characters OK, eg: "Pend&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;ê&lt;/P&gt;ncia".&lt;BR /&gt;But, when i call the WebService from the RFC Module in ABAP, using the interface if_http_client to make the WebService Call, it returns bogus characters, eg: "PendÃªncia".&lt;BR /&gt;So, if my table in Oracle DB have the word "Pendência", the RFC call result will be "Pend&lt;B&gt;&lt;P&gt;Ãª&lt;/P&gt;&lt;/B&gt;ncia". The same happens with the following characters:  áéíóúãàòìùäëïöüãõâêîôûçñ...&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD http_client-&amp;gt;request-&amp;gt;set_header_field&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      name  = '~request_method'&lt;/P&gt;&lt;P&gt;      value = 'POST'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD http_client-&amp;gt;request-&amp;gt;set_header_field&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      name  = '~server_protocol'&lt;/P&gt;&lt;P&gt;      value = 'HTTP/1.1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD http_client-&amp;gt;request-&amp;gt;set_header_field&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      name  = 'Content-Type'&lt;/P&gt;&lt;P&gt;      value = 'text/xml; charset=iso-8859-1;'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD http_client-&amp;gt;request-&amp;gt;set_header_field&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      name  = 'Content-Length'&lt;/P&gt;&lt;P&gt;      value = txlen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD http_client-&amp;gt;request-&amp;gt;set_header_field&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      name  = 'SOAPAction'&lt;/P&gt;&lt;P&gt;      value = ''.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2005 17:56:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/wrong-characters-returned-by-the-webservice/m-p/1028536#M83080</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-18T17:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong Characters returned by the WebService</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/wrong-characters-returned-by-the-webservice/m-p/1028537#M83081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be you don't have the right code page. I am not an expert, but check on that aspect with your basis administrators.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the documentation related to code pages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP character set identification&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Definition&lt;/P&gt;&lt;P&gt;The 4-character name of an SAP character set as defined&lt;/P&gt;&lt;P&gt;in SAP character set maintenance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following explains the naming convention in more detail:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First digit: Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0 EBCDIC character sets &lt;/P&gt;&lt;P&gt;1 ASCII character sets &lt;/P&gt;&lt;P&gt;2 mixed single byte / double byte character sets &lt;/P&gt;&lt;P&gt;4 double-byte character sets &lt;/P&gt;&lt;P&gt;6 mixed character sets &lt;/P&gt;&lt;P&gt;8 double byte and multibyte character sets &lt;/P&gt;&lt;P&gt;9 reserved for code pages you define &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second digit: Country&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1-3 countries that use the Latin alphabet (Western Europe, North and South America, Australia, Africa)&lt;/P&gt;&lt;P&gt;4-6 countries that use non-Latin alphabets and writing&lt;/P&gt;&lt;P&gt;systems (Eastern Europe, Asia, Arabic countries in Africa) &lt;/P&gt;&lt;P&gt;7-9 reserved for special languages &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Third and fourth digits: Sequential number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;0100 IBM 00697/00273 (Latin 1 - Germany/Austria)&lt;/P&gt;&lt;P&gt;0401 SNI BS2000 8859-5 EHCLC (cyrillic - multiple languages)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table is TCP00.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Srinivas Adavi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2005 19:51:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/wrong-characters-returned-by-the-webservice/m-p/1028537#M83081</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-18T19:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong Characters returned by the WebService</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/wrong-characters-returned-by-the-webservice/m-p/1028538#M83082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I solved it by converting the code-page in the return of the webservice call...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* After receive the return from the WebService,
* move the result to the string wf_string1.
  clear wf_string1 .
  wf_string1 = http_client-&amp;gt;response-&amp;gt;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=&amp;gt;create(
                        encoding = '4110'
                          endian = 'L'
                           input = wf_stringx ).

* Read the conversion result
  conv-&amp;gt;read(
   exporting
     view = viewoff
   importing
     data = content
     len  = len ).
* Result string...
  wf_string1 = content.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Dec 2005 18:59:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/wrong-characters-returned-by-the-webservice/m-p/1028538#M83082</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-08T18:59:12Z</dc:date>
    </item>
  </channel>
</rss>

