我要做的是使用带有PHP和SOAP的MTOM发送和接收文件。 有一个用JAVA编写的SOAP Web服务,我可以毫无问题地播放,除了文件。
我几乎尝试了所有内容(修补Nusoap,更改SoapClient
中的__doRequest
)但未成功。
PHP中是否有MTOM规范的实现?
编辑:以下是我的所作所为:
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
$response = parent::__doRequest($request, $location, $action, $version, $one_way);
// parse $response, extract the multipart messages and so on
// this part removes stuff
$start = strpos($response, '<?xml');
$end = strrpos($response, '>');
$response_string = substr($response, $start, $end - $start + 1);
return ($response_string);
}
这是我得到的:
--uuid:06cccc9f-7827-40f4-ad42-ccd60a85fba2
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary
Content-ID: <root.message@cxf.apache.org>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:telechargerRelevesResponse xmlns:ns2="http://xxx/GestionReception/v1.0"><return><attachmentFile><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:98c24cf6-c72d-45f0-8b66-bf72e53670fb-168@cxf.apache.org"/></attachmentFile><dateReception>2013-05-30T14:04:08.000+02:00</dateReception><fileName>TEST-RELEVE2013053014041310846.RLV</fileName><idReception>36</idReception></return><return><attachmentFile><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:98c24cf6-c72d-45f0-8b66-bf72e53670fb-169@cxf.apache.org"/></attachmentFile><dateReception>2013-05-30T14:03:42.000+02:00</dateReception><fileName>TEST-RELEVE2013053014034873259.RLV</fileName><idReception>35</idReception></return></ns2:telechargerRelevesResponse></soap:Body></soap:Envelope>
--uuid:06cccc9f-7827-40f4-ad42-ccd60a85fba2
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID: <98c24cf6-c72d-45f0-8b66-bf72e53670fb-168@cxf.apache.org>
0111311 00001EUR2 00000000001 030113 0000000384770G 0411311 00001EUR2E0000000000106060113 060113VIREMENT EMIS 00000000 0000000005446NVIREMENT EMIS 0411311 00001EUR2E0000000000162060113 060113FRAIS SUR VIREMENT EMIS 00000000 0000000000001QFRAIS SUR VIREME0411311 00001EUR2E0000000000106060113 060113VIREMENT EMIS 00000000