Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.14.0

Request #14343 Don't sent body encoded when using MIME attachments
Submitted: 2008-07-14 02:52 UTC
From: lhng Assigned: yunosh
Status: Closed Package: SOAP (version 0.11.0)
PHP Version: 5.2.6 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2008-07-14 02:52 UTC] lhng (Lh Ng)
Description: ------------ When attachment option is set to 'Mime', SOAP_Client's getLastRequest() method returned SOAP XML request messages(soap envelope) which is not decoded. Test script: --------------- $client = new SOAP_Client('http://localhost/test/soapServer.php'); $options = array('namespace' => 'urn:CRSAPINameSpace', 'attachments' => 'Mime', 'trace' => 1, 'use' => 'literal', 'soapaction' => 'depositFile', 'encoding' => SOAP_ENC_OBJECT); $filename = 'D:\abc.txt'; $v = new SOAP_Attachment('depositFile','plain/text',$filename); $resp = $client->call('depositFile',$param=array('attachfile'=>$v, 'type'=>0, 'file'=>'hello123.txt'), $options); echo '<pre>'.htmlspecialchars($client->getLastRequest()).'</pre>'; Expected result: ---------------- POST /test/soapServer.php HTTP/1.0 User-Agent: PEAR-SOAP 0.11.0-beta Host: localhost Content-Type: multipart/related; type="text/xml"; boundary="=_13dc3c7f5fb858230e9350201de2b15f" Content-Length: 1117 SOAPAction: "depositFile" Connection: close --=_13dc3c7f5fb858230e9350201de2b15f Content-Transfer-Encoding: base64 Content-Type: text/xml; charset="UTF-8" <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="urn:CRSAPINameSpace" > <SOAP-ENV:Body> <ns4:depositFile> <depositFile href="cid:612553dabd9237ab47804e66a91fab70"/> <ns4:type>0</ns4:type> <ns4:file>hello123.txt</ns4:file></ns4:depositFile> </SOAP-ENV:Body> </SOAP-ENV:Envelope> --=_13dc3c7f5fb858230e9350201de2b15f Content-Transfer-Encoding: base64 Content-ID: <612553dabd9237ab47804e66a91fab70> Content-Type: plain/text Content-Disposition: abc.txt SSB3YW50IHRvIHJlcGxhY2UgdGhpcyBmaWxlIQ== --=_13dc3c7f5fb858230e9350201de2b15f-- Actual result: -------------- POST /test/soapServer.php HTTP/1.0 User-Agent: PEAR-SOAP 0.11.0-beta Host: localhost Content-Type: multipart/related; type="text/xml"; boundary="=_13dc3c7f5fb858230e9350201de2b15f" Content-Length: 1117 SOAPAction: "depositFile" Connection: close --=_13dc3c7f5fb858230e9350201de2b15f Content-Transfer-Encoding: base64 Content-Type: text/xml; charset="UTF-8" PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCg0KPFNPQVAtRU5WOkVudmVs b3BlICB4bWxuczpTT0FQLUVOVj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZl bG9wZS8iDQogeG1sbnM6eHNkPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSINCiB4 bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIg0KIHht bG5zOlNPQVAtRU5DPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VuY29kaW5nLyIN CiB4bWxuczpuczQ9InVybjpDUlNBUElOYW1lU3BhY2UiDQo+DQo8U09BUC1FTlY6Qm9keT4NCg0K PG5zNDpkZXBvc2l0RmlsZT4NCjxkZXBvc2l0RmlsZSBocmVmPSJjaWQ6NjEyNTUzZGFiZDkyMzdh YjQ3ODA0ZTY2YTkxZmFiNzAiLz4NCjxuczQ6dHlwZT4wPC9uczQ6dHlwZT4NCjxuczQ6ZmlsZT5o ZWxsbzEyMy50eHQ8L25zNDpmaWxlPjwvbnM0OmRlcG9zaXRGaWxlPg0KPC9TT0FQLUVOVjpCb2R5 Pg0KPC9TT0FQLUVOVjpFbnZlbG9wZT4NCg== --=_13dc3c7f5fb858230e9350201de2b15f Content-Transfer-Encoding: base64 Content-ID: <612553dabd9237ab47804e66a91fab70> Content-Type: plain/text Content-Disposition: abc.txt SSB3YW50IHRvIHJlcGxhY2UgdGhpcyBmaWxlIQ== --=_13dc3c7f5fb858230e9350201de2b15f--

Comments

 [2008-07-15 00:32 UTC] yunosh (Jan Schneider)
Thank you for taking the time to write to us, but this is not a bug. Of course not. The method does exactly what it is supposed to do: returning the last request as sent to the server.
 [2008-07-15 05:09 UTC] lhng (Lh Ng)
WITHOUT Mime Attachment, the method works fine, i.e. returning soap request message without being encoded. WITH Mime Attachment, soap request message was being encoded. Would it be correct to say : only attachment portion of the request trace should be encoded, and soap envelope portion should remain not encoded ? Is there any workaround to get the non-encoded soap envelope portion?(from <SOAP-ENV:Envelope>...to...</SOAP-ENV:Envelope>)?
 [2008-07-15 08:34 UTC] yunosh (Jan Schneider)
Technically it doesn't matter if the SOAP messages is sent base64 encoded or as plain text. But it's not necessary either. I take this as feature request to sent the message body as plain text, even is using mime attachments. You can parse the message yourself using the Mail_Mime PEAR package.
 [2008-07-15 17:37 UTC] yunosh (Jan Schneider)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.