From: rtroll at yahoo-inc dot com Operating system: PHP version: 5CVS-2005-02-28 (dev) PHP Bug Type: SOAP related Bug description: dateTime decoding: not present
Description: ------------ When building a SOAP client or server that uses the "base64Binary" XML datatype, PHP is not performing the appropriate B64 encoding/decoding. When generating a SOAP client based on a WSDL, the PHP SOAP extension builds a collection of methods for me. These methods take args (as defined by the WSDL), and send them over the wire to the appropriate service. The extension takes care of encoding arrays as arrays, decimals as decimals, etc. If the item datatype is "base64Binary", the extension does not b64 encode the value - it merely places it in the XML. This may be a feature, requiring client authors to read through the WSDL to determine what datatypes are being used, in order to adequately encode things before passing them into the autogenerated methods. If this is the appropriate functionality, the "time_t -> dateTime" mapping should also be removed, providing a consistent, "PHP does no data munging" approach to generated interfaces. However, I'd much rather see the extension do the B64 encoding for me. :) Consider a service that returns an image: getImage(). It could be implemented such that the image is transmitted in b64 - but the client author shouldn't need to know that. Reproduce code: --------------- <?php $WSDL = "http://ws1.api.re2.yahoo.com/ws/soap-demo/full.wsdl"; $SRCBUF = "1234567890abcdefghijklmnopqrstuvwxyz"; $client = new SoapClient( $WSDL, array( "trace" => true, "exceptions" => 0, )); function dump_xml( $title, $body ) { $nl = preg_replace( "/\>\</", ">\n<", $body ); $clean = htmlspecialchars( $nl ); print "\n<b>$title</b>\n<pre>$clean</pre>\n"; } $r = $client->echoViaBase64( array( 'src' => $SRCBUF )); dump_xml( "Request", $client->__getLastRequest() ); dump_xml( "Response", $client->__getLastResponse() ); ?> Expected result: ---------------- The request generated by this PHP5 SOAP client contains the following body: <SOAP-ENV:Body> <ns1:echoViaBase64> <ns1:src>1234567890abcdefghijklmnopqrstuvwxyz</ns1:src> </ns1:echoViaBase64> </SOAP-ENV:Body> Actual result: -------------- The request should look something like this: <SOAP-ENV:Body> <ns1:echoViaBase64> <ns1:src>MTIzNDU2Nzg5MGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6</ns1:src> </ns1:echoViaBase64> </SOAP-ENV:Body> -- Edit bug report at http://bugs.php.net/?id=32139&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32139&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32139&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32139&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32139&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32139&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32139&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32139&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32139&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32139&r=support Expected behavior: http://bugs.php.net/fix.php?id=32139&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32139&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32139&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32139&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32139&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32139&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32139&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32139&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32139&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32139&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32139&r=mysqlcfg