dongqie2010 2016-09-25 08:55
浏览 54

解析SOAP响应:空对象

I'm trying to parse a SOAP response from a server (Chronopost WebServices) but I really don't know what I am messing up. The question has been asked many times but I can't find any answer that works.

Here is the SOAP response

The response looks like below :

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:rechercheBtParCodeproduitEtCodepostalEtDateResponse xmlns:ns1="http://cxf.rechercheBt.soap.chronopost.fr/">
<return>
<adresse1>42 RUE SAINT DENIS</adresse1>
<codePostal>28100</codePostal>
<dateArriveColis>2016-09-25T10:46:30.778+02:00</dateArriveColis>
<horairesOuvertureDimanche>08:00-13:00 00:00-00:00</horairesOuvertureDimanche>
<horairesOuvertureJeudi>07:15-12:00 12:00-20:00</horairesOuvertureJeudi>
<horairesOuvertureLundi>07:15-12:00 12:00-20:00</horairesOuvertureLundi>
<horairesOuvertureMardi>07:15-12:00 12:00-20:00</horairesOuvertureMardi>
<horairesOuvertureMercredi>00:00-00:00 00:00-00:00</horairesOuvertureMercredi>
<horairesOuvertureSamedi>08:00-12:00 12:00-20:00</horairesOuvertureSamedi>
<horairesOuvertureVendredi>07:15-12:00 12:00-20:00</horairesOuvertureVendredi>
<identifiantChronopostPointA2PAS>2924P</identifiantChronopostPointA2PAS>
<localite>DREUX</localite>
<nomEnseigne>LE LONGCHAMP</nomEnseigne>
<coordGeoLatitude>48.7344444</coordGeoLatitude>
<coordGeoLongitude>1.37138888</coordGeoLongitude>
<urlGoogleMaps>http://maps.google.fr/maps?q=48.7344444,1.37138888</urlGoogleMaps>
</return>

I've tried to parse this file in PHP with :

$response = file_get_contents('https://ws.chronopost.fr/recherchebt-ws-cxf/PointRelaisServiceWS/rechercheBtParCodeproduitEtCodepostalEtDate?codePostal=28500&date=27/09/2016');
$clean_xml = str_ireplace(['SOAP-ENV:', 'SOAP:'], '', $response);
$xml = simplexml_load_string($clean_xml);
var_dump($xml);

Which returns me an empty object and I don't get why :

object(SimpleXMLElement)#287 (1) {
  ["Body"]=>
  object(SimpleXMLElement)#280 (0) {
  }
}

Edit : some more informations : working with Laravel 5.2 and its server (php artisan serve). No errors reported in the console log.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)