Я вызываю веб-сервис через Apache Axis Client на сервере Tomcat. Я получаю XML-ответ ISO-8859-1 вместо UTF-8. Когда я просто запускаю этот метод формы клиента, все работает как исключение. Ниже приведен пример журнала запросов и ответов в формате XML. Пожалуйста, помогите!
В сообщении:
<?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>
Вы можете попробовать следующие коды.
Stub._setProperty(Call.CHARACTER_SET_ENCODING, "ISO-8859-9");