2 Replies Latest reply: Jan 14, 2013 4:41 PM by user1099620 RSS

    encoding problem

    user1099620
      Hi,

      My webservice function returns the data as XML from PL/SQL package/function.
      The database encoding is CL8MSWIN1251 .

      The PL/SQL function webservice code is:

      <pre class="jive-pre">
      R Xmltype;
      begin
      Select
      Xmlelement("Member",
      XMLAttributes(id_num as "id_num")
      , XMLForest(
      Name as "Name"
      , Surname as "Surname"
      , field1 as "field1"
      , date2 as "date2"
      , mode3 as "mode3"
      )
      )
      into R
      FROM TABLE1
      where id_num = '123456789';

      RETURN R;
      </pre>

      Using webservice thru browser returns:

      <pre class="jive-pre">

      <?xml version="1.0" encoding="UTF-8" ?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <SOAP-ENV:Body>
      <ns1:member3Response xmlns:ns1="http://MZFZO121JAVA/MZFZO121.wsdl" SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
      <return>
      <Member id_num="123456789">
      <Name>????????</Name>
      <Surname>????????</Surname>
      <field1>1</field1>
      <date2>2012-12-01</date2>
      <mode3>D</mode3>
      </Member>
      </return>
      </ns1:member3Response>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      </pre>


      The question marks are result from different encoding:
      UTF-8 (entire XML) and database query results from CL8MSWIN1251 encoding.

      Any help how to pass Name and Surname from database with encoding CL8MSWIN1251
      into SOAP message with encoding UTF-8.

      The webservice was created with Jdeveloper 10.1.3.5 and deployed on OC4J 10.1.3.5 .

      Regards,
      Kostadin
        • 1. Re: encoding problem
          AlexAnd
          try to use convert function like
          select convert('Привет', 'UTF8') from dual
          or
          for your case
          , XMLForest(
                             convert(Name, 'UTF8')      as "Name"            
                           , convert(Surname, 'UTF8')   as "Surname"
                           , field1    as "field1"
                           , date2     as "date2"                
                           , mode3     as "mode3"           
                           )
          also you can add convert to field1 and ...
          • 2. Re: encoding problem
            user1099620
            I have to correct my statement
            "The webservice was created with Jdeveloper 10.1.3.5 and deployed on OC4J 10.1.3.5"

            The web service based on the same procedure/function
            I have built, deployed and tested with Jdev/OC4J version 9.0.4
            and in another variant with Jdev/OC4J version 10.1.3.5.

            The encoding problem exist in 9.0.4 operating environment, and
            cann't be fixed with usage od CONVERT function.

            The environment 10.1.3.5 works perfect regarding the encoding.

            Edited by: user1099620 on 14.1.2013 14:41