XML Character Encoding Using UTL_DBWS

Hi,
I have a database with WINDOWS-1252 character encoding. I'm using UTL_DBWS to call a web service method which echoes a given string. For this purpose, I do the following:
DECLARE
    v_wsdl CONSTANT VARCHAR2(500) := 'http://myhost/myservice?wsdl';
    v_namespace CONSTANT VARCHAR2(500) := 'my.namespace';
    v_service_name CONSTANT UTL_DBWS.QNAME := UTL_DBWS.to_qname(v_namespace, 'MyService');
    v_service_port CONSTANT UTL_DBWS.QNAME := UTL_DBWS.to_qname(v_namespace, 'MySoapServicePort');
    v_ping CONSTANT UTL_DBWS.QNAME := UTL_DBWS.to_qname(v_namespace, 'ping');
    v_wsdl_uri CONSTANT URITYPE := URIFACTORY.getURI(v_wsdl);
    v_str_request CONSTANT VARCHAR2(4000) :=
'<?xml version="1.0" encoding="UTF-8" ?>
<ping>
    <pingRequest>
        <echoData>Dev Team üöäß</echoData>
    </pingRequest>
</ping>';
    v_service UTL_DBWS.SERVICE;
    v_call UTL_DBWS.CALL;
    v_request XMLTYPE := XMLTYPE (v_str_request);
    v_response SYS.XMLTYPE;
BEGIN
    DBMS_JAVA.set_output(20000);
    UTL_DBWS.set_logger_level('FINE');
    v_service := UTL_DBWS.create_service(v_wsdl_uri, v_service_name);
    v_call := UTL_DBWS.create_call(v_service, v_service_port, v_ping);
    UTL_DBWS.set_property(v_call, 'oracle.webservices.charsetEncoding', 'UTF-8');
    v_response := UTL_DBWS.invoke(v_call, v_request);
    DBMS_OUTPUT.put_line(v_response.getStringVal());
    UTL_DBWS.release_call(v_call);
    UTL_DBWS.release_all_services;
END;
/Here is the SERVER OUTPUT:
ServiceFacotory: oracle.j2ee.ws.client.ServiceFactoryImpl@a9deba8d
WSDL: http://myhost/myservice?wsdl
Service: oracle.j2ee.ws.client.dii.ConfiguredService@c881d39e
*** Created service: -2121202561 - oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy@afb58220 ***
ServiceProxy.get(-2121202561) = oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy@afb58220
Collection Call info: port={my.namespace}MySoapServicePort, operation={my.namespace}ping, returnType={my.namespace}PingResponse, params count=1
setProperty(oracle.webservices.charsetEncoding, UTF-8)
dbwsproxy.add.map: ns, my.namespace
Attribute 0: my.namespace: xmlns:ns, my.namespace
dbwsproxy.lookup.map: ns, my.namespace
createElement(ns:ping,null,my.namespace)
dbwsproxy.add.soap.element.namespace: ns, my.namespace
Attribute 0: my.namespace: xmlns:ns, my.namespace
dbwsproxy.element.node.child.3: 1, null
createElement(echoData,null,null)
dbwsproxy.text.node.child.0: 3, Dev Team üöäß
request:
<ns:ping xmlns:ns="my.namespace">
   <pingRequest>
      <echoData>Dev Team üöäß</echoData>
   </pingRequest>
</ns:ping>
Jul 8, 2008 6:58:49 PM oracle.j2ee.ws.client.StreamingSender _sendImpl
FINE: StreamingSender.response:<?xml version = '1.0' encoding = 'UTF-8'?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header/><env:Body><ns0:pingResponse xmlns:ns0="my.namespace"><pingResponse><responseTimeMillis>0</responseTimeMillis><resultCode>0</resultCode><echoData>Dev Team üöäß</echoData></pingResponse></ns0:pingResponse></env:Body></env:Envelope>
response:
<ns0:pingResponse xmlns:ns0="my.namespace">
   <pingResponse>
      <responseTimeMillis>0</responseTimeMillis>
      <resultCode>0</resultCode>
      <echoData>Dev Team üöäß</echoData>
   </pingResponse>
</ns0:pingResponse>As you can see the character encoding is broken in the request and in the response, i.e. the SOAP encoder does not take into consideration the UTF-8 encoding.
I tracked down the problem to the method oracle.jpub.runtime.dbws.DbwsProxy.dom2SOAP(org.w3c.dom.Node, java.util.Hashtable); and more specifically to the calls of oracle.j2ee.ws.saaj.soap.soap11.SOAPFactory11.
My question is: is there a way to make the SOAP encoder use the correct character encoding?
Thanks a lot in advance!
Greetings,
Dimitar

I found a workaround of the problem:
    v_response := XMLType(v_response.getBlobVal(NLS_CHARSET_ID('CHAR_CS')), NLS_CHARSET_ID('AL32UTF8'));Ugly, but I'm tired of decompiling and debugging Java classes ;)
Greetings,
Dimitar

Similar Messages

  • How to set XML character encoding for a SOAP response?

    Hi,
    We're using Oracle J2EE web services,
    and are quite happy with them.
    However, it's a problem that we need to have
    characters outside the standard English alphabet
    in our service responses. So far, we have not been
    able to find a way to specify what encoding to use.
    Our version (9.0.3 release) produces SOAP-responses
    without any encoding specification in the XML header.
    Any ideas?

    Hello,
    If you are using the "Paper Layout", check the Reports's "Before Report Value" property:
    Before Report Value :
    <meta http-equiv="Content-Type" content="text/html; charset=&Encoding">
    If you are using the "Web Layout", take a look to the document :
    http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b14048/pbr_nls.htm#i1006142
    18.3 Specifying a Character Set in a JSP or XML File
    Regards

  • What character encoding standard does tuxedo use

    Hi,
    I am trying to resolve a problem with communication between Tuxedo 6.4 and Vitria.
    It seems that there is a problem with the translation of special characters. Does
    anyone know what encoding standard that Tuxedo uses?
    Thanks.

    Thanks Scott, actually I was asked the following question by Vitria Technical Support,
    can you help?
    "XDR (External Data Representation) is a protocol used by BEA Tuxedo's
    communication engine. XDR handles data format transformations when passing
    messages across dissimilar processor architectures.
    This is not the equivalent of Character Encoding. I specifically need the
    Character Encoding used. I am not sure where your admin needs to check for
    this - it might even be set at the OS level. I suspect that it will be
    something like ISO-8859-1 or some derivative."
    Thanks.
    Scott Orshan <[email protected]> wrote:
    Within a machine, TUXEDO just sends the bytes that you give it. When
    it
    goes between machines, it uses XDR to encode the data values for
    transmission. There is no character set translation going on, unless
    you
    are going to an EBCDIC machine. (If you are using data encryption
    [tpseal] in TUXEDO 7.1 or 8.0 your data may be encoded even if it stays
    on the same machine type.)
         Scott Orshan
         BEA Systems
    Richard Astill wrote:
    Hi,
    I am trying to resolve a problem with communication between Tuxedo6.4 and Vitria.
    It seems that there is a problem with the translation of special characters.Does
    anyone know what encoding standard that Tuxedo uses?
    Thanks.

  • What's the difference of character encoding between 1.4.0and1.4.2 in Linux

    As i find, the character encoding about chinese in jdk1.4.2 no langer the same of jdk1.4.0.
    In jdk1.4.0, the character encoding used the "file.encoding" system property, we often set the
    property with "gb2312".
    But in jdk1.4.2, i find that the default character encoding no longer used the "file.encoding" system property.
    Who knows the reason?
    Test Program:
    public class B{
    public static void main(String args[]) throws Exception{
    byte [] bytes = new byte[]{(byte)0xD6,(byte)0xD0,(byte)0xCE,(byte)0xC4};
    String s1 = new String(bytes);
    String s2 = new String(bytes,System.getProperty("file.encoding"));
    System.out.println("s1="+s1+" , s2="+s2);
    System.out.println("s1.length=" + s1.length() + " , s2.length="+s2.length());
    run four times and the result list:
    [root@app15 component]# /usr/local/j2sdk1.4.0/bin/java -Dfile.encoding=ISO-8859-1 -cp . B
    s1=&#20013;&#25991; , s2=&#20013;&#25991;
    s1.length=4 , s2.length=4
    [root@app15 component]# /usr/local/j2sdk1.4.0/bin/java -Dfile.encoding=gb2312 -cp . B
    s1=&#20013;&#25991; , s2=&#20013;&#25991;
    s1.length=2 , s2.length=2
    [root@app15 component]# /usr/local/j2sdk1.4.2/bin/java -Dfile.encoding=ISO-8859-1 -cp . B
    s1=&#20013;&#25991; , s2=&#20013;&#25991;
    s1.length=4 , s2.length=4
    [root@app15 component]# /usr/local/j2sdk1.4.2/bin/java -Dfile.encoding=gb2312 -cp . B
    s1=&#20013;&#25991; , s2=??
    s1.length=4 , s2.length=2
    [root@app15 component]#

    I don't know for sure, but:
    -- The API documentation for String says that "new String(byte[])" uses "the platform's default charset".
    -- The API documentation for Charset says "The default charset is determined during virtual-machine startup and typically depends upon the locale and charset being used by the underlying operating system."
    You'll notice that it doesn't say anything about using the file.encoding system value, so presumably (based on your experiments) it doesn't. I did a search for "java default charset" and didn't find anything specific, but this site says "As of Java 1.4.1, the default Charset varies from platform to platform" and suggests you explicitly hard-code your charset. I would agree with that.

  • Setting Character encoding programmaticaly?

    Hi,
    I am using Sun J2ME wireless toolkit 2.1, and i have a problem with characer encoding. I am receiving text from a .NET web service, and after some processing in the client, i send the string back.
    The problem is, the string i am sending back includes Turkish characters. These are sent as question marks instead of characters.
    I have failed to find a method that changes the character encoding used while making a web service call.
    Actually, i could not see any way to change the encoding overall. For the emulator, property file can be used, but what about the devices i'll be deploying the app? It'd be really great if someone could point me in the right direction.
    Best Regards

    Hi,
    My situation is as follows. I have .NET web services on the server side, and i am using mobile devices as clients. When i get a string from method A in web service , i can display it on the device screen without a problem. after that, if i send the same string that i've received from method A as a parameter to method B, the .NET code receives garbage instead of turkish chars.
    At the moment i am encoding turkish chars at the client side, and decoding them at the .net web server processing code.
    I'd like to try setting the encoding to utf8, but as i have written, i have not seen any way of doing this. Changing properties file for emulator is possible, but how can i do it for the target devices. I have not seen an api call for this purpose in midp or cldc docs. Thanks for your answer
    Regards

  • XML parser not detecting character encoding

    Hi,
    I am using Jdeveloper 9.0.5 preview and the same problem is happening in our production AS 9.0.2 release.
    The character encoding of an xml document is not correctly being detected by the oracle v2 parser even though the xml declaration correctly contains
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    instead it treats the document as UTF8 encoding which is fine until a document comes along with an extended character which then causes a
    java.io.UTFDataFormatException: Invalid UTF8 encoding.
    at oracle.xml.parser.v2.XMLUTF8Reader.checkUTF8Byte(XMLUTF8Reader.java:160)
    at oracle.xml.parser.v2.XMLUTF8Reader.readUTF8Char(XMLUTF8Reader.java:187)
    at oracle.xml.parser.v2.XMLUTF8Reader.fillBuffer(XMLUTF8Reader.java:120)
    at oracle.xml.parser.v2.XMLByteReader.saveBuffer(XMLByteReader.java:448)
    at oracle.xml.parser.v2.XMLReader.fillBuffer(XMLReader.java:2023)
    at oracle.xml.parser.v2.XMLReader.tryRead(XMLReader.java:972)
    at oracle.xml.parser.v2.XMLReader.scanXMLDecl(XMLReader.java:2589)
    at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:485)
    at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:192)
    at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:144)
    as you can see it is explicitly casting the XMLUTF8Reader to perform the read.
    I can get around this by hard coding the xml input stream to be processed by a reader
    XMLSource = new StreamSource(new InputStreamReader(XMLInStream,"ISO-8859-1"));
    however the manual documents that the character encoding is automatically picked up from the xml file and casting into a reader is not necessary, so I should be able to write
    XMLSource = new StreamSource(XMLInStream)
    Does anyone else experience this same problem?
    having to hardcode the encoding causes my software to lose flexibility.
    Jarrod Sharp.

    An XML document should be created with 'ISO-8859-1' encoding to be parsed as 'ISO-8859-1' encoding.

  • XML Server character encoding

    Hi, I'm using the proxy generated by UDS for XML Server published service object. I have some problems with strings return types with some locales ( e.g:spanish ).
    How can I set the XML Server response character encoding to avoid this problem?

    This tech note will help:
    http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsunone%2F7717&zone_110=7717%2A%20
    ka

  • Character Encoding in XML

    Hello All,
    I am not clear about solving the problem.
    We have a Java application on NT that is supposed to communicate with the same application on MVS mainframe through XML.
    We have a character encoding for these XML commands we send for communication.
    The problem is, on MVS the parser is not understaning the US-ASCII character encoding. And so we are getting the infamous "illegal character error".
    The main frame file.encoding=CP1047 and
    NT's file.encoding = us-ascii.
    Is there any character encoding that is common to these two machines: mainframe and NT.
    IF it is Unicode, what is the correct notation for it.
    Or is there any way for specifying the parsers to which character encoding should be used.
    thanks,
    Sridhar

    On the mainframe end maybe something like-
    FileInputStream fris = new FileInputStream("C:\\whatever.xml");
    InputStreamReader is= new InputStreamReader(fris, "ASCII");//or maybe "us-ascii" "US-ASCII"
    BufferedReader brin = new BufferedReader(is);
    Or give inputstream/buffered reader to whatever application you are using to parse the xml. The input stream reader should allow you to set your encoding even if the system doesnt have the native encoding. Depends though on which/whose jvm using you are using jdk1.2 at least supports following on this page http://as400bks.rochester.ibm.com/pubs/html/as400/v4r4/ic2924/info/java/rzaha/javaapi/intl/encoding.doc.html

  • XML special character/encoding problem

    Hi
    I would like to store XML in a MSSQL database into a column with the datatype xml.
    It seems like the xml datatype in an xMII transaction allways is stored with encoding type UTF-8
    and the MSSQL xml datatype is UTF-16. This gives me some problem with special characters when inserting into the MSSQL database (in the example below is the MSSQL datatype xml):
    INSERT INTO
         VALUES
    The error returned is this:
    "com.microsoft.sqlserver.jdbc.SQLServerException: XML parsing: line 1, character 62, illegal xml character"
    If I replace the 'ä' with a normal 'a' the command executes ok.
    I am currently using a workaround that looks like this, when setting the parameter in my transaction:
    stringreplace(Local.test, " encoding=" & doublequote & "UTF-8" & doublequote, "")
    But I was hoping I could get rid of the stringreplace.
    Is there a solution / recommended way of doing this?
    Best Regards
    Simon Bruun
    Edited by: Simon Bruun on Mar 4, 2011 10:43 AM

    I solved this. I convert to Unicode UTF-8

  • When I load certain websites the the writing is all squashed up. I correct this by changing the character encoding setting. I am using the latest Apple Mac machine. Thanks in advance

    When I load certain websites the the writing is all squashed up. I correct this by changing the character encoding setting. I am using the latest Apple Mac machine. Thanks in advance

    Thanks for that information!
    I'm sure I will be calling AppleCare, but the problem is, they charge for the phone calls don't they? Because I don't have money to be spending to be on the phone with a support service.
    In other things, it seemed like the only time my MacBook was working was when I had Snow Leopard without the 10.6.8 update download that was supposed to be done to prepare for OS X Lion.
    When I look at the information of my HD it says that I have 10.6.8 but that was the install that it claimed to have failed and caused me to restart resulting in all of the repeated problems.
    Also, because my computer is currently down, and I've lost all files how would that effect the use of my iPhone? Because if it doesn't get fixed by the time OS 5 is released, how would I be able to upgrade?!

  • Quotation marks display as &quot in web pages, I'm using Unicode UTF-8 character encoding.

    On many web pages, where a quotation mark character should appear, instead the page displays the text &quot. I believe this happens with other punctuation characters as well such as apostrophes although the text displayed in these other cases is different, of course. I'm guessing this is a problem with character encoding. I'm currently set to Unicode (UTF-8) encoding. Have tried several others without success.

    Here's a link where the problem occurs. Note the second line of the main body of text.
    http://www.sierratradingpost.com/lp2/snowshoes.html
    BTW, I never use IE, but I checked this site in IE and it shows the same problem, so maybe it is the page encoding after all rather than what I thought.
    In any case, my thanks for your help and would appreciate any solution you can suggest.

  • How to use the character encoding model to use ' �'  in java

    hi
    I have to use the special characters like '�' using java.but when '�' character is transferred to data base or is displayed in my form,it is shown as '?'.but i need to display the original characters in the form of what it is.
    what can i do as i expects the result .i needs it very urgently.so reply to me as soon as possible.
    advance thank you
    rgds
    Oasisdeserts

    Java stores all characters as 16 bit UNICODE (which has plenty of room far more exotic characters than Greek). Every time character data is brought into, or stored from the Java environment it passes through a specific character encoding. If you don't state the encoding explicitly it uses the default encoding of the machine it's running on (which is typically oriented to the language set in the locale.).
    With a database the database driver is supposed to do any necessary translation. The non-latin character could be stored wrongly, the database could be returning it wrongly or whatever's creating your form could be interpretting it wrongly, or lack the capacity to display the character.
    If it's, say, a JSP try setting the page encoding to UTF-8. Try dumping the characters read from the database in HEX and look them up at www.unicode.org.
    Take a look at the database setup information, some have an option of storing characters as UNICODE or ASCII.
    The "?" is substituted whenever a codec can't make sense of the codes it's translating, either the byte array is invalid or the UNICODE character can't be represented.

  • Which character encoding do Adobe ExportPDF use when converting to word document?

    Which character encoding do Adobe ExportPDF use when converting to word document?

    Hi Ram,
    Sorry for the long delay. I've been trying to track down this answer for you.
    We're using UTF-8 character encoding for our files.
    -David

  • Problem using character encoding....

    Hi,
    I have written an app which constructs an email and sends it to subscribers. The data is read from the database (oracle 9) and its running on UNIX.
    The subject title (read from the email) however does not appear correctly in the email. I think the encoding character set is incorrect.
    When my subject title (a string) is:
    test � $
    i get something like this
    test =?ANSI_X3.4-1968?Q?
    I checked and the data is stored correctly in the database.
    So i changed my method which reads the subject title from the database to:
    for (int i = 0; i < o.length; i++) {
    strArray[i] = new String(((String) o).getBytes(), "ISO-8859-1");
    which basically changes the character encoding to ISO-8859-1 for the text. But now in the subject title i get
    test $��
    (the � shouldnt be there)
    Any ideas? Which character set should i use?

    You should use the character set that the database uses. Looks like it could be UTF-8.

  • Using Direct Input mode: UTF-8 character encoding assumed

    When I validate a web page in dreamweaver CS5 (using Jeffrey Zeldman's Web Standards Advisor ) I receive the following warning; Using Direct Input mode: UTF-8 character encoding assumed.
    However if I validate using W3C either as a file upload or via the live site the page validates correctly.
    Can anybody please help, as it is driving me insane.

    Hi John
    Thank you for your swift response,
    As I said before this only happens locally within Dreamweaver CS5.
    However The web address is www.countryimage.co.uk/index.htm
    As you will see from the code I have included <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> within the head

Maybe you are looking for

  • Partner function at shipment

    Hi Experts, Kindly advise on the below issue. Currently in VT01N(create shipment) when we enter FwdAgent and other details like shipping cond. ,at "Partner tab" partner function SP Transporter comes by default/automatically that is nothing but my Fwd

  • "game controllers" won't function

    Asking help for this problem everywhere, figured I'd come to MSI because it is their fault.... Anyways I have a USB gamepad which I'm trying to connect to my computer.  This gamepad needs "game controllers" in control panel to function.  Everytime I

  • Why is "POP or IMAP" grayed out in setting up a new email account in Outlook 2013?

    Can anyone share with me how to make it avail?  Thanks.

  • Is it possible to open multiple subvi's at the same time?

    Hi All, I have a main vi that calls many subvis like real time display,graph... Suppose i have to view the real time display and without closing the window i have to view graph also. But when i am trying to do like that its not seems to be working. I

  • Converter for MTS File?

    Is any converter for convert MTS file to quick time? do anyone know it? Thx...