[英]Retrieve value from WSDL using SOAP - PHP
我的WSDL文件结构非常糟糕,无法理解如何从中检索信息。
无法从外部网络访问VM,因此无法共享整个WSDL文件
我想使用接受参数并返回具有多个值的字符串的getList
函数。
SOAP Request
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header/>
<S:Body>
<ns2:getList xmlns:ns2="http://Wishlist.eBookCafe/">
<arg0>2</arg0>
</ns2:getList>
</S:Body>
</S:Envelope>
SOAP Response
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getListResponse xmlns:ns2="http://Wishlist.eBookCafe/">
<return>[1]</return>
</ns2:getListResponse>
</S:Body>
</S:Envelope>
我的问题是,因为值包含在return
标记内,所以我不知道如何使用SOAP将其存储在PHP变量中。
$list = $service->getList(array('arg0'=>$id));
print_r($list);
即使我使用静态数字作为传递参数,它也始终会返回ID = 1的包含给用户的值。
从博客帖子( 现在已删除: ()>>
<?php
$url = 'your_url_orFilePath';
$client = new SoapClient($url);
$xmlr = new SimpleXMLElement("<main_key></main_key>");
$xmlr->addChild('childName1', $childName1);
$xmlr->addChild('childName2', $childName2);
------
----likewise---
$params = new stdClass();
$params->xml = $xmlr->asXML();
$result = $client->main_key_function($params);
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.