#38067 [Opn->Asn]: Parameters are not decoded from utf-8 when using encoding option
| From: | tony2001@php.net | Date: | Tue, 11 Jul 2006 23:15:38 +0000 |
| Subject: | #38067 [Opn->Asn]: Parameters are not decoded from utf-8 when using encoding option | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99373@lists.php.net to get a copy of this message | ||
ID: 38067
Updated by: tony2001@php.net
Reported By: afalak at poczta dot onet dot pl
-Status: Open
+Status: Assigned
Bug Type: SOAP related
Operating System: Windows 2000
PHP Version: 5CVS-2006-07-11 (CVS)
-Assigned To:
+Assigned To: dmitry
Previous Comments:
------------------------------------------------------------------------
[2006-07-11 15:42:28] afalak at poczta dot onet dot pl
Description:
------------
When encoding is set for both SoapClient and SoapServer (i.e.
ISO-8859-1) parameters are encoded properly to UTF-8 but not decoded on
the other side.
Note: this error may be related to bug #38005 (SoapFault faultstring
doesn't follow encoding rules) because before correction of this bug
parameters were endoced/decoded properly, and now SoapFault parameters
work fine but not method parameters.
Reproduce code:
---------------
[client]
<?php
$client = new SoapClient('a.wsdl'
,array('encoding' => 'ISO-8859-1'));
$str = 'test: Ä';
$res = $client->Test(array('str'=>$str));
?>
[server]
<?php
function Test($param) {
file_put_contents('test.txt', $param->str);
return 1;
}
$server = new SoapServer('a.wsdl'
,array('encoding' => 'ISO-8859-1'));
$server->addFunction('Test');
$server->handle();
?>
[a.wsdl]
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://test.pl"
targetNamespace="http://test.pl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
>
<types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://test.pl">
<s:complexType name="Test">
<s:attribute use="required" name="str" type="s:string"/>
</s:complexType>
<s:element type="s0:Test" name="Test"/>
<s:element type="s:int" name="Ret"/>
</s:schema>
</types>
<message name="TestSoapIn">
<part name="parameters" element="s0:Test"/>
</message>
<message name="TestSoapOut">
<part name="parameters" element="s0:Ret"/>
</message>
<portType name="TestSoap">
<operation name="Test">
<input message="s0:TestSoapIn"/>
<output message="s0:TestSoapOut"/>
</operation>
</portType>
<binding name="TestSoap" type="s0:TestSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<operation name="Test">
<soap:operation soapAction="http:/Test/Test"
style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="Test">
<port name="TestSoapPort" binding="s0:TestSoap">
<soap:address location="http://localhost/server.php"/>
</port>
</service>
</definitions>
Expected result:
----------------
File text.txt shall contain exactly the same value as calling
parameter:
test: Ä
Actual result:
--------------
Parameter isn't decoded from UTF-8:
test: Ă
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38067&edit=1