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

Bug #14756 multipart/related response is not parsed
Submitted: 2008-10-08 02:12 UTC
From: maya Assigned: yunosh
Status: Closed Package: SOAP (version 0.12.0)
PHP Version: 4.3.9 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2008-10-08 02:12 UTC] maya (Nagata Shinya)
Description: ------------ I'm accessing to Amazon seller API with SOAP. When I called "getDocument" soap method, following error is occuerd: "XML error on line 2 col 0 byte 525 junk after document element" I checked Transport/HTTP.php. It calls _decodeMimeMessage with only a body of the resoponse of SOAP. I think _decodeMimeMessage requires "boundary" for parse as multipart. Amazon SOAP server returns a response like this: Content-Type: multipart/related; boundary="xxx-WASP-CPP-MIME-Boundary-xxx-yyyyyyyyy-zzzzzzzz-xxx-END-xxx"; type="text/xml" --xxx-WASP-CPP-MIME-Boundary-xxx-yyyyyyyyy-zzzzzzzz-xxx-END-xxx Content-Type: text/xml; charset="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:SE="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns0:string_Response xsi:type="xsd:string" xmlns:ns0="http://systinet.com/xsd/SchemaTypes/"><snip></snip></ns0:string_Response><ns1:doc href="cid:0xad86d30-0xae618b8-0xae037c0-0xaffa268-0xae62400" xmlns:ns1="http://systinet.com/xsd/SchemaTypes/"/></SOAP-ENV:Body></SOAP-ENV:Envelope> --xxx-WASP-CPP-MIME-Boundary-xxx-yyyyyyyyy-zzzzzzzz-xxx-END-xxx Content-ID: <0xad86d30-0xae618b8-0xae037c0-0xaffa268-0xae62400> Content-Type: application/binary <?xml version="1.0"?> <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd"> <snip></snip> </AmazonEnvelope> --xxx-WASP-CPP-MIME-Boundary-xxx-yyyyyyyyy-zzzzzzzz-xxx-END-xxx-- But Transport/HTTP.php put only this to _decodeMimeMessage. --xxx-WASP-CPP-MIME-Boundary-xxx-yyyyyyyyy-zzzzzzzz-xxx-END-xxx Content-Type: text/xml; charset="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:SE="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns0:string_Response xsi:type="xsd:string" xmlns:ns0="http://systinet.com/xsd/SchemaTypes/"><snip></snip></ns0:string_Response><ns1:doc href="cid:0xad86d30-0xae618b8-0xae037c0-0xaffa268-0xae62400" xmlns:ns1="http://systinet.com/xsd/SchemaTypes/"/></SOAP-ENV:Body></SOAP-ENV:Envelope> --xxx-WASP-CPP-MIME-Boundary-xxx-yyyyyyyyy-zzzzzzzz-xxx-END-xxx Content-ID: <0xad86d30-0xae618b8-0xae037c0-0xaffa268-0xae62400> Content-Type: application/binary <?xml version="1.0"?> <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd"> <snip></snip> </AmazonEnvelope> --xxx-WASP-CPP-MIME-Boundary-xxx-yyyyyyyyy-zzzzzzzz-xxx-END-xxx-- Test script: --------------- --- HTTP.php.orig 2008-10-08 11:02:16.000000000 +0900 +++ HTTP.php 2008-10-08 10:53:08.000000000 +0900 @@ -393,7 +393,8 @@ $this->result_content_type = $this->headers['content-type']; } elseif (stristr($this->result_content_type, 'multipart/related')) { $this->response = $this->incoming_payload; - if (PEAR::isError($this->_decodeMimeMessage($this->response, $this->headers, $this->attachments))) { + $res_data = "Content-Type: ".$this->result_content_type."\n\n".$this->response; + if (PEAR::isError($this->_decodeMimeMessage($res_data, $this->headers, $this->attachments))) { // _decodeMimeMessage already raised $this->fault return false; }

Comments

 [2008-10-09 12:21 UTC] doconnor (Daniel O'Connor)
Hey Nagata, any chance of a small executable test script which can prove this is broken? At the moment, not knowing much about SOAP package, it's impossible to know what behavior will actually change if it gets applied...
 [2008-10-09 15:53 UTC] maya (Nagata Shinya)
 [2008-12-28 01:18 UTC] doconnor (Daniel O'Connor)
Bug #14854 looks like a duplicate of this
 [2010-01-06 16:56 UTC] yunosh (Jan Schneider)
-Status: Open +Status: Closed -Assigned To: +Assigned To: yunosh
This bug has been fixed in SVN. 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.