2012-02-01 88 views
1

我通過Tomcat服務器中的Apache Axis Client調用Web服務。我得到ISO-8859-1編碼響應xml而不是UTF-8。當我簡單地運行這個客戶端表單的主要方法時,一切工作都是例外。下面是一個示例請求和響應xml日誌。請幫忙!Apache Axis Charset在Tomcat上編碼錯誤?

在消息:

<?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:getContactInformation 
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      xmlns:ns1="http://extranet.turkcell.com.tr/webServices/toskaWebService"> 
      <longVal href="#id0" /> 
      <longVal0 href="#id1" /> 
      <longVal1 href="#id2" /> 
      <longVal2 href="#id3" /> 
      <integer href="#id4" /> 
      <integer0 href="#id5" /> 
      <integer1 href="#id6" /> 
      <integer2 href="#id7" /> 
     </ns1:getContactInformation> 
     <multiRef id="id1" soapenc:root="0" 
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">-1</multiRef> 
     <multiRef id="id6" soapenc:root="0" 
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">408</multiRef> 
     <multiRef id="id0" soapenc:root="0" 
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">-1</multiRef> 
     <multiRef id="id2" soapenc:root="0" 
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">5322067832</multiRef> 
     <multiRef id="id3" soapenc:root="0" 
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">-1</multiRef> 
     <multiRef id="id5" soapenc:root="0" 
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">100</multiRef> 
     <multiRef id="id7" soapenc:root="0" 
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef> 
     <multiRef id="id4" soapenc:root="0" 
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef> 
    </soapenv:Body> 
</soapenv:Envelope> 

出的消息:

<?xml version="1.0" encoding="ISO-8859-9" standalone="yes"?> 
<env:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <env:Header></env:Header> 
    <env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
     <m:getContactInformationResponse 
      xmlns:m="http://extranet.turkcell.com.tr/webServices/toskaWebService"> 
      <result xmlns:n1="java:com.turkcell.toska.model" xsi:type="n1:WSContactList"> 
       <addresslist soapenc:arrayType="n1:WSAddress[1]"> 
        <WSAddress xsi:type="n1:WSAddress"> 
         <address1 xsi:type="xsd:string">7-8 Mah. I 9 C Kap�s�</address1> 
         <address2 xsi:type="xsd:string">�orak�� Sok. No:111</address2> 
         <address3 xsi:type="xsd:string">Gazzosmanpa�a</address3> 
         <addressID xsi:type="xsd:long">0</addressID> 
         <addressStatus xsi:type="xsd:int">0</addressStatus> 
         <addresstype xsi:type="xsd:int">0</addresstype> 
         <addressusage xsi:type="xsd:int">1</addressusage> 
         <cityCode xsi:type="xsd:int">72</cityCode> 
         <cityName xsi:nil="true"></cityName> 
         <countryCode xsi:type="xsd:int">1</countryCode> 
         <usageStatus xsi:type="xsd:int">0</usageStatus> 
         <zipCode xsi:type="xsd:string">72439</zipCode> 
        </WSAddress> 
       </addresslist> 
       <emaillist soapenc:arrayType="n1:WSEmailInfo[0]"></emaillist> 
       <errMessage xsi:type="xsd:string"></errMessage> 
       <phonelist soapenc:arrayType="n1:WSPhone[1]"> 
        <WSPhone xsi:type="n1:WSPhone"> 
         <addressID xsi:type="xsd:long">0</addressID> 
         <addressStatus xsi:type="xsd:int">0</addressStatus> 
         <extension xsi:nil="true"></extension> 
         <generationDate xsi:nil="true"></generationDate> 
         <modificationDate xsi:nil="true"></modificationDate> 
         <phonenumber xsi:type="xsd:string">2125487549</phonenumber> 
         <phonenumbertype xsi:type="xsd:int">100</phonenumbertype> 
         <usageStatus xsi:type="xsd:int">0</usageStatus> 
        </WSPhone> 
       </phonelist> 
       <resultcode xsi:type="xsd:int">0</resultcode> 
      </result> 
     </m:getContactInformationResponse> 
    </env:Body> 
</env:Envelope> 
+0

我沒有看到任何示例請求/響應。 – 2012-02-01 23:08:29

+0

這是我的軸日誌 – 2012-02-02 17:19:50

回答

0

你可以試試下面的代碼。

Stub._setProperty(Call.CHARACTER_SET_ENCODING, "ISO-8859-9");