使用SOAP从WSDL检索值 - PHP

问题描述:

我有一个很差的WSDL文件,我无法理解如何从中检索信息。使用SOAP从WSDL检索值 - PHP

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