php xsd 转换 对象,SOAP的XML响应转换为PHP对象或数组

博主在尝试使用cURL向SOAP服务发送带有参数的XML请求并接收响应。遇到的问题是无法将接收到的SOAP XML响应成功转换为PHP对象或数组。尽管已经尝试注册了XML命名空间并尝试解析Body内的SearchResponse,但仍然未能读取到所有的PropertyResults。博客内容涉及到PHP、XML解析和SOAP服务交互。
摘要由CSDN通过智能技术生成

我使用卷曲发送给SOAP服务的请求,在我POST体发送包含参数的XML中,响应予接收:SOAP的XML响应转换为PHP对象或数组

true

http://www.lowcostholidays.fr/dl.aspx?p=0,8,5,0&date=10/05/2013&duration=15&room1=2,1,0_5&regionid=9

215

1795

Hotel Gaddis

3.0

Egypte

Louxor

Cet établissement confortable propose un très bon service à un bon rapport qualité-prix. Cet hôtel de 6 étages compte 55 chambres et comprend une terrasse, une réception avec coffre-fort et ascenseur,

Cet établissement confortable propose un très bon service à un bon rapport qualité-prix. Cet hôtel de 6 étages compte 55 chambres et comprend une terrasse, une réception avec coffre-fort et ascenseur,...

http://lcbtestxml1.ivector.co.uk/content/DataObjects/Property/Image/

image_1795_v1.jpg

imagethumb_1795_v1.jpg

http://www.lowcostholidays.fr/dl.aspx?p=0,8,5,0&date=10/05/2013&duration=15&room1=2,1,0_5&regionid=9&propertyid=1795

1

690039000

3

Twin/double Room

Petit Déjeuner

false

150.58

0

150.58

2

1

0

1

690039001

7

Twin/double Room

Demi-Pension

false

291.64

0

291.64

2

1

0

1

690039002

5

Double/twin Room

Pension Complète

false

529.22

0

529.22

2

1

0

我没有足够的XML数据经验。我花了数小时试图将XML响应转换为PHP对象或数组,但没有取得任何成功。

我需要读取所有PropertyResults。

PHP代码:

$xml = simplexml_load_string($soap_xml_result);

$xml->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');

$xml->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');

$xml->registerXPathNamespace('xsd', 'http://www.w3.org/2001/XMLSchema');

$test = (string) $xml->Body->SearchResponse->SearchResult->SearchURL;

var_export($test);

2013-04-09

Hamza

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值