Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Encoding problems when calling webservice

PeterValencicJun 9 2017 — edited Jun 9 2017

Hi,

In my case I call a webservice which expect UTF-8 charset.

My database is in ISO8859_2 format

obrocno.jpg

I have problems when this kind of characters are used in my envelope: ŠĐČĆŽčćžšđ..

Envelope is like this:

<pol:SearchPoliceReport>

  <com:ServiceRequestInfo>

  <com:ClientName>TEST</com:ClientName>

  <com:SessionIdentifier>AHIGGJWKVWRTBUODLBRZ</com:SessionIdentifier>

  <com:RequestIdentifier>BFPONEGEKZMFWAXPKZST</com:RequestIdentifier>

  </com:ServiceRequestInfo>

  <pol:RequestParameters>

  <pol:AccidentDateFrom>2014-09-13</pol:AccidentDateFrom>

  <pol:AccidentDateTo>2014-10-11</pol:AccidentDateTo>

  <pol:FirstName>JOHNYY</pol:FirstName>

  <pol:LastName>ŠČĆŽŠĐčćžšđ</pol:LastName>

  <pol:SocialSecurityNumber>0511976505039</pol:SocialSecurityNumber>

  <pol:VehicleRegistrationNumber>IZH_CSV_SZZ</pol:VehicleRegistrationNumber>

  <pol:DateOfBirth>1976-11-05</pol:DateOfBirth>

  </pol:RequestParameters>

</pol:SearchPoliceReport>

My code to send envelope is like this:

v_request := utl_http.begin_request(p_url_ws, 'POST','HTTP/1.1');

   utl_http.set_body_charset(v_request, 'UTF-8');

   utl_http.set_header(V_REQUEST, 'User-Agent', 'Mozilla/4.0');

   utl_http.set_header (R => v_request, name => 'Content-Length', value => DBMS_LOB.GETLENGTH(v_soap_request_text));

   utl_http.set_header (R => v_request, name => 'SOAPAction', value => 'http://www.zav-zdruzenje.si/wsdl/PoliceReportService/IPoliceReportService/SearchPoliceReports');

   utl_http.write_raw  (R => v_request, data => UTL_RAW.CAST_TO_RAW(v_soap_request_text));

   v_response := utl_http.get_response(v_request);

when ŠĐČĆŽšđčćž characters are present I get back http error code 400 (400 Bad Request)

I have resolved the problem if I pass a envelope parameter trough java function:

public static String convert(String input) throws Exception {

             byte[] t = input.getBytes("UTF-8");

             return new String(t,"8859_2");

        }

Is there a way to convert those charaters only with plsql? I would like to avoid "java" for conversion process?

regards

Peter

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 7 2017
Added on Jun 9 2017
3 comments
482 views