You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Samir Shaikh <ss...@worldres.com> on 2003/04/11 00:26:29 UTC
encoding
Hi all.
I am running axis1.0 on tomcat 4.1.12. I see a desparity in encoding (or
packaging) the strings in the soap message. I only spot this disparity in
the encoding of the extended ISO8859_1 charecterset (the charecters other
then ascii).
My problem is sometimes the axis server encodes a specific charecter to an
html entity eg. é and sometimes it just encodes it just display é the
UTF-8 representation. Both of them are representation of é charecter. What
can I do to make it consistent. Is there a property I can set to force it to
do that either way. One of my client programs in php can handle one type of
encoding in a document but is having problems handling both types of
encodings in the same document. Also, the é is not xml encoded when
transmitted on the wire, that is why the xml parser fails.
I have pasted below the soap response (got it through tcpmon) I recieve from
the server. If you look at the locationKeywords field
<locationKeywords xsi:type="xsd:string">Hôtel 3 etoiles
situé dans le quartier des musiciens au centre de Nice proche de la
gare et de l'avenue principale</locationKeywords>
<locationKeywords xsi:type="xsd:string">Au centre de Nice, près
de la plage, du casino et du Musée Massèna</locationKeywords>
In the same response document I see both in different places.
Please help. Any ideas will be great.
Thanks,
Samir
WorldRes Inc.
sshaikh@worldres.com
==== Response ====
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Date: Thu, 10 Apr 2003 22:03:04 GMT
Server: Apache Coyote/1.0
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getListOfHotelSummaryResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://scotty.worldres.com:9030/WebServices/services/ContentServi
ce">
<getListOfHotelSummaryReturn href="#id0"/>
</ns1:getListOfHotelSummaryResponse>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:ResultBean"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="urn:ContentService">
<errorCode xsi:type="xsd:int">0</errorCode>
<errorMsg xsi:type="xsd:string">Success</errorMsg>
<hotelSummary xsi:type="soapenc:Array"
soapenc:arrayType="ns2:HotelSummaryBean[2]">
<item href="#id1"/>
<item href="#id2"/>
</hotelSummary>
</multiRef>
<multiRef id="id1" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns3:HotelSummaryBean" xmlns:ns3="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<AAARating xsi:type="xsd:int">-1</AAARating>
<activities xsi:type="soapenc:Array"
soapenc:arrayType="ns3:Service1Bean[18]">
<item href="#id3"/>
<item href="#id4"/>
<item href="#id5"/>
<item href="#id6"/>
<item href="#id7"/>
<item href="#id8"/>
<item href="#id9"/>
<item href="#id10"/>
<item href="#id11"/>
<item href="#id12"/>
<item href="#id13"/>
<item href="#id14"/>
<item href="#id15"/>
<item href="#id16"/>
<item href="#id17"/>
<item href="#id18"/>
<item href="#id19"/>
<item href="#id20"/>
</activities>
<address xsi:type="xsd:string">58 rue herold </address>
<amenities xsi:type="soapenc:Array"
soapenc:arrayType="xsd:int[12]">
<item>28</item>
<item>31</item>
<item>36</item>
<item>39</item>
<item>40</item>
<item>41</item>
<item>50</item>
<item>57</item>
<item>58</item>
<item>59</item>
<item>61</item>
<item>62</item>
</amenities>
<chainId xsi:type="xsd:int">1</chainId>
<chainName xsi:type="xsd:string">Do Not Use - Was Chain ID
1</chainName>
<chainThumbnail xsi:type="ns3:PhotoBean" xsi:nil="true"/>
<cityName xsi:type="xsd:string">Nice</cityName>
<countryName xsi:type="xsd:string">France</countryName>
<errorCode xsi:type="xsd:int">0</errorCode>
<errorMsg xsi:type="xsd:string">Success</errorMsg>
<hotelId xsi:type="xsd:int">25105</hotelId>
<hotelThumbnail href="#id21"/>
<langId xsi:type="xsd:int">2</langId>
<latitude xsi:type="xsd:double">43.70220184326172</latitude>
<locationKeywords xsi:type="xsd:string">Hôtel 3 etoiles
situé dans le quartier des musiciens au centre de Nice proche de la
gare et de l'avenue principale</locationKeywords>
<longitude xsi:type="xsd:double">7.258999824523926</longitude>
<michelinRating xsi:type="xsd:int">13</michelinRating>
<mobilRating xsi:type="xsd:int">8</mobilRating>
<name xsi:type="xsd:string">Medicis</name>
<nonSmokingHotelInd xsi:type="xsd:string">N</nonSmokingHotelInd>
<nonSmokingRoomsInd xsi:type="xsd:string">Y</nonSmokingRoomsInd>
<numFloors xsi:type="xsd:int">4</numFloors>
<numRooms xsi:type="xsd:int">36</numRooms>
<postalCode xsi:type="xsd:string">06000</postalCode>
<propertyTypeId xsi:type="xsd:int">3</propertyTypeId>
<stateName xsi:type="xsd:string" xsi:nil="true"/>
<worldresRating xsi:type="xsd:int">3</worldresRating>
<yearBuilt xsi:type="xsd:string">1926</yearBuilt>
<yearRenovated xsi:type="xsd:string">1995</yearRenovated>
</multiRef>
<multiRef id="id2" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns4:HotelSummaryBean" xmlns:ns4="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<AAARating xsi:type="xsd:int">-1</AAARating>
<activities xsi:type="soapenc:Array"
soapenc:arrayType="ns4:Service1Bean[7]">
<item href="#id22"/>
<item href="#id23"/>
<item href="#id24"/>
<item href="#id25"/>
<item href="#id26"/>
<item href="#id27"/>
<item href="#id28"/>
</activities>
<address xsi:type="xsd:string">3 Rue Gounod </address>
<amenities xsi:type="soapenc:Array"
soapenc:arrayType="xsd:int[14]">
<item>31</item>
<item>32</item>
<item>35</item>
<item>40</item>
<item>41</item>
<item>44</item>
<item>48</item>
<item>51</item>
<item>53</item>
<item>56</item>
<item>57</item>
<item>58</item>
<item>62</item>
<item>64</item>
</amenities>
<chainId xsi:type="xsd:int">1</chainId>
<chainName xsi:type="xsd:string">Do Not Use - Was Chain ID
1</chainName>
<chainThumbnail xsi:type="ns4:PhotoBean" xsi:nil="true"/>
<cityName xsi:type="xsd:string">Nice</cityName>
<countryName xsi:type="xsd:string">France</countryName>
<errorCode xsi:type="xsd:int">0</errorCode>
<errorMsg xsi:type="xsd:string">Success</errorMsg>
<hotelId xsi:type="xsd:int">5793</hotelId>
<hotelThumbnail href="#id29"/>
<langId xsi:type="xsd:int">2</langId>
<latitude xsi:type="xsd:double">43.699100494384766</latitude>
<locationKeywords xsi:type="xsd:string">Au centre de Nice, près
de la plage, du casino et du Musée Massèna</locationKeywords>
<longitude xsi:type="xsd:double">7.260200023651123</longitude>
<michelinRating xsi:type="xsd:int">13</michelinRating>
<mobilRating xsi:type="xsd:int">-1</mobilRating>
<name xsi:type="xsd:string">Hotel Gounod Nice</name>
<nonSmokingHotelInd xsi:type="xsd:string">N</nonSmokingHotelInd>
<nonSmokingRoomsInd xsi:type="xsd:string">N</nonSmokingRoomsInd>
<numFloors xsi:type="xsd:int">5</numFloors>
<numRooms xsi:type="xsd:int">47</numRooms>
<postalCode xsi:type="xsd:string">06000</postalCode>
<propertyTypeId xsi:type="xsd:int">3</propertyTypeId>
<stateName xsi:type="xsd:string">French Riviera</stateName>
<worldresRating xsi:type="xsd:int">3</worldresRating>
<yearBuilt xsi:type="xsd:string">1911</yearBuilt>
<yearRenovated xsi:type="xsd:string">1997</yearRenovated>
</multiRef>
<multiRef id="id28" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns5:Service1Bean" xmlns:ns5="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">20</serviceType>
</multiRef>
<multiRef id="id16" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns6:Service1Bean" xmlns:ns6="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">21</serviceType>
</multiRef>
<multiRef id="id8" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns7:Service1Bean" xmlns:ns7="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">7</serviceType>
</multiRef>
<multiRef id="id24" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns8:Service1Bean" xmlns:ns8="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">4</serviceType>
</multiRef>
<multiRef id="id10" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns9:Service1Bean" xmlns:ns9="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">10</serviceType>
</multiRef>
<multiRef id="id17" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns10:Service1Bean" xmlns:ns10="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">22</serviceType>
</multiRef>
<multiRef id="id11" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns11:Service1Bean" xmlns:ns11="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">11</serviceType>
</multiRef>
<multiRef id="id25" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns12:Service1Bean" xmlns:ns12="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">5</serviceType>
</multiRef>
<multiRef id="id6" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns13:Service1Bean" xmlns:ns13="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">4</serviceType>
</multiRef>
<multiRef id="id27" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns14:Service1Bean" xmlns:ns14="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">15</serviceType>
</multiRef>
<multiRef id="id18" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns15:Service1Bean" xmlns:ns15="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">25</serviceType>
</multiRef>
<multiRef id="id3" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns16:Service1Bean" xmlns:ns16="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">1</serviceType>
</multiRef>
<multiRef id="id22" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns17:Service1Bean" xmlns:ns17="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">1</serviceType>
</multiRef>
<multiRef id="id26" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns18:Service1Bean" xmlns:ns18="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">8</serviceType>
</multiRef>
<multiRef id="id15" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns19:Service1Bean" xmlns:ns19="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">19</serviceType>
</multiRef>
<multiRef id="id13" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns20:Service1Bean" xmlns:ns20="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">15</serviceType>
</multiRef>
<multiRef id="id29" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns21:PhotoBean" xmlns:ns21="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<label xsi:type="xsd:string">Hotel Gounod Nice</label>
<url
xsi:type="xsd:string">/property/a5500/5793/hotel_tn.jpg</url>
</multiRef>
<multiRef id="id4" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns22:Service1Bean" xmlns:ns22="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">2</serviceType>
</multiRef>
<multiRef id="id21" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns23:PhotoBean" xmlns:ns23="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<label xsi:type="xsd:string">Medicis</label>
<url
xsi:type="xsd:string">/property/a25000/25105/hotel_tn.jpg</url>
</multiRef>
<multiRef id="id5" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns24:Service1Bean" xmlns:ns24="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">3</serviceType>
</multiRef>
<multiRef id="id7" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns25:Service1Bean" xmlns:ns25="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">5</serviceType>
</multiRef>
<multiRef id="id20" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns26:Service1Bean" xmlns:ns26="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">27</serviceType>
</multiRef>
<multiRef id="id9" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns27:Service1Bean" xmlns:ns27="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">8</serviceType>
</multiRef>
<multiRef id="id12" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns28:Service1Bean" xmlns:ns28="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">14</serviceType>
</multiRef>
<multiRef id="id23" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns29:Service1Bean" xmlns:ns29="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">2</serviceType>
</multiRef>
<multiRef id="id19" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns30:Service1Bean" xmlns:ns30="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">26</serviceType>
</multiRef>
<multiRef id="id14" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns31:Service1Bean" xmlns:ns31="urn:ContentService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<location xsi:type="xsd:string">N</location>
<serviceType xsi:type="xsd:int">18</serviceType>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
RE: encoding
Posted by Samir Shaikh <ss...@worldres.com>.
Hi Steve,
Thanks for your response.
I changed my locale to UTF-8 and I see the e with the acute. Sorry I doesn't
help to paste it here because my mail software doesn't support UTF-8 I
think.
I tried it with the Axis1.1RC still the same output.
It does look like a bug to me also. Looking for a work around thou.
Thank you.
Samir
WorldRes.com Inc.
-----Original Message-----
From: Steve Loughran [mailto:steve_l@iseran.com]
Sent: Thursday, April 10, 2003 5:03 PM
To: axis-user@ws.apache.org
Subject: Re: encoding
Samir Shaikh wrote:
> Hi all.
>
> I am running axis1.0 on tomcat 4.1.12. I see a desparity in encoding (or
> packaging) the strings in the soap message. I only spot this disparity in
> the encoding of the extended ISO8859_1 charecterset (the charecters other
> then ascii).
>
> My problem is sometimes the axis server encodes a specific charecter to an
> html entity eg. é and sometimes it just encodes it just display é
the
> UTF-8 representation. Both of them are representation of é charecter. What
> can I do to make it consistent. Is there a property I can set to force it
to
> do that either way. One of my client programs in php can handle one type
of
> encoding in a document but is having problems handling both types of
> encodings in the same document. Also, the é is not xml encoded when
> transmitted on the wire, that is why the xml parser fails.
>
> I have pasted below the soap response (got it through tcpmon) I recieve
from
> the server. If you look at the locationKeywords field
>
> <locationKeywords xsi:type="xsd:string">Hôtel 3 etoiles
> situé dans le quartier des musiciens au centre de Nice proche de la
> gare et de l'avenue principale</locationKeywords>
>
> <locationKeywords xsi:type="xsd:string">Au centre de Nice,
près
> de la plage, du casino et du Musée Massèna</locationKeywords>
Looks like defect. Nice hotel though. Musée would really be Musee with
an acute on the first e, so somthing is going wrong.
test on Axis1.1, if it is still there file the defect
-steve
Re: encoding
Posted by Steve Loughran <st...@iseran.com>.
Samir Shaikh wrote:
> Hi all.
>
> I am running axis1.0 on tomcat 4.1.12. I see a desparity in encoding (or
> packaging) the strings in the soap message. I only spot this disparity in
> the encoding of the extended ISO8859_1 charecterset (the charecters other
> then ascii).
>
> My problem is sometimes the axis server encodes a specific charecter to an
> html entity eg. é and sometimes it just encodes it just display é the
> UTF-8 representation. Both of them are representation of é charecter. What
> can I do to make it consistent. Is there a property I can set to force it to
> do that either way. One of my client programs in php can handle one type of
> encoding in a document but is having problems handling both types of
> encodings in the same document. Also, the é is not xml encoded when
> transmitted on the wire, that is why the xml parser fails.
>
> I have pasted below the soap response (got it through tcpmon) I recieve from
> the server. If you look at the locationKeywords field
>
> <locationKeywords xsi:type="xsd:string">Hôtel 3 etoiles
> situé dans le quartier des musiciens au centre de Nice proche de la
> gare et de l'avenue principale</locationKeywords>
>
> <locationKeywords xsi:type="xsd:string">Au centre de Nice, près
> de la plage, du casino et du Musée Massèna</locationKeywords>
Looks like defect. Nice hotel though. Musée would really be Musee with
an acute on the first e, so somthing is going wrong.
test on Axis1.1, if it is still there file the defect
-steve