ID:               45934
 Updated by:       j...@php.net
 Reported By:      fjas at free dot fr
-Status:           Open
+Status:           Feedback
 Bug Type:         SOAP related
 Operating System: Windows XP
 PHP Version:      5.2.6
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------

[2008-08-27 14:33:54] fjas at free dot fr

Description:
------------
PHP5 SOAPClient is very slow to decode xsd:string return values
containing utf8 accented characters sent by a Perl SOAP::Lite server.

Strangely enough, I could not reproduce the problem using a PHP5
SOAPServer, so I first suspected the SOAP::Lite server to be slow to
respond, for some reason.

But it turned out that a nuSOAP client got the answer instantly, and so
did a SOAP::Lite client (with the same configuration, in terms of
machines, network, load...)

This is the envelope sent back by SOAP::Lite:
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";><SOAP-ENV:Body><namesp1:getImageResponse
xmlns:namesp1="http://www.curie.fr/hermes/";><s-gensym3
xsi:type="xsd:string">Séverine est
là.</s-gensym3></namesp1:getImageResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
I don't see anything wrong in it, compared to what a PHP5 SOAPServer
would send.
It took 5 or 6 seconds for a PHP5 SOAPClient to get it.
It took 1 second for a nuSOAP or a SOAPLite client to do the same job.

More annoying, if the return value is a bit larger (say, 400
characters), the difference of execution time between a PHP5 SoapClient
and a nuSOAP client can become very important: PHP5 SOAPClient does the
job in more than 30 seconds (I had to increase the default
set_time_limit), while nuSOAP or SOAP::Lite clients reply in 2 or 3
seconds.

Additional remarks:
1. If you replace the accented characters by unaccented ones, the
performance hit disappears immediately.
2. If the server sends the same message in base64Binary characters, the
performance hit disappears too (that's the workaround I used).
3. The presence of just one accented character is enough to suddenly
increase the execution time significantly.

----
My PHP Configure (where the SOAPClient is executed):
"--enable-snapshot-build" "--with-gd=shared"
"--with-extra-includes=C:\Program Files (x86)\Microsoft
SDK\Include;C:\PROGRA~2\MICROS~2\VC98\ATL\INCLUDE;C:\PROGRA~2\MICROS~2\VC98\INCLUDE;C:\PROGRA~2\MICROS~2\VC98\MFC\INCLUDE"
"--with-extra-libs=C:\Program Files (x86)\Microsoft
SDK\Lib;C:\PROGRA~2\MICROS~2\VC98\LIB;C:\PROGRA~2\MICROS~2\VC98\MFC\LIB"

Apache Version : Apache/2.2.8 (Win32) PHP/5.2.6  


Reproduce code:
---------------
Expose that SOAP::Lite server:

package hermes;

use strict;
use Encode;

sub getImage
{
        my $str = 'Séverine est là.';
        my $str = encode("utf8", $str);
        return SOAP::Data->type(string => $str);
}
1;

Request it with:
$client = new SoapClient('ws.wsdl', array('trace'=>1));
$r = $client->getImage();
exit($client->__getLastResponse());

--
You can use, for "ws.wsdl":

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions name="hermes"
targetNamespace="http://www.foo.com/hermes/";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
        xmlns:tns="http://www.foo.com/hermes/";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
        <wsdl:types />
        <wsdl:message name="getImageRequest"></wsdl:message>
        <wsdl:message name="getImageResponse">
                <wsdl:part name="return" type="xsd:string"></wsdl:part>
        </wsdl:message>
        <wsdl:portType name="hermes">
                <wsdl:operation name="getImage">
                        <wsdl:input message="tns:getImageRequest"></wsdl:input>
                        <wsdl:output 
message="tns:getImageResponse"></wsdl:output>
                </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="hermesSOAP" type="tns:hermes">
                <soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"; />
                <wsdl:operation name="getImage">
                        <soap:operation 
soapAction="http://www.foo.com/hermes/getImage"; />
                        <wsdl:input>
                                <soap:body use="encoded" 
namespace="http://www.foo.com/hermes/";
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; />
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body use="encoded"
namespace="http://www.foo.com/hermes/";          
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
/>
                        </wsdl:output>
                </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="hermes_bioinfo">
                <wsdl:port binding="tns:hermesSOAP" name="hermesSOAP">
                        <soap:address 
location="http://host/your_dispatcher.cgi"; />
                </wsdl:port>
        </wsdl:service>
</wsdl:definitions>



Expected result:
----------------
A response in a reasonable time.

Actual result:
--------------
A response with a large delay


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45934&edit=1

Reply via email to