PHP调用webservice,但取不到返回值,在网页上直接获取是可以拿到返回值的。
获取返回值的方法如下:
ini_set("soap.wsdl_cache_enabled",0);
function getSoapData($cardNo){
echo '##########################,';
echo $cardNo;
try {
// 示例webservice地址.
$client = new SoapClient ( "http://soap.org/wsdl?", array (
'encoding' => 'UTF-8'
) );
$strinfo = $client-> GetOpenID( array (
'CardNo'=>$cardNo
) );
echo ',##########################'.$client->GetOpenID($cardNo);
} catch ( Exception $e ) {
echo 'ERR\n\n\n';
Think\Log::record ( $e, 'ERR' );
}
return $strinfo;
}
网页上的返回值是:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<GetOpenIDResponse xmlns="http://www.xxxxxxxx.cn">
<GetOpenIDResult>fdlsakfjsdlafsdkllfk02943ielkdsjfalsdk12878</GetOpenIDResult>
</GetOpenIDResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
请问该怎么才能取到返回值??谢谢.
1 回答

慕田峪7331174
TA贡献1828条经验 获得超13个赞
$client = new SoapClient($host, array(
'trace' => true,
'cache_wsdl' => WSDL_CACHE_BOTH,
));
$functionName = 'funcname';
$response = $client->__soapCall($functionName, array(
$functionName => array('in0' => $params),
));
确认一下你的soap Server地址
- 1 回答
- 0 关注
- 513 浏览
添加回答
举报
0/150
提交
取消