3

What I am trying to do is to send and receive files using MTOM with PHP and SOAP. There is a SOAP webservice written in JAVA that I can play without problem, except for files.

I tried almost everything (patching Nusoap, changing the __doRequest in SoapClient) without success.

Is there any implementation of the MTOM specification in PHP?


Edit: Here is what I did :

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);
}

Here is what I get :

--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
4

0 回答 0