当前位置: 首页 > 工具软件 > PHP Soap > 使用案例 >

php soap 传递参数,PHP Soap非WSDL调用:如何传递参数?

颜哲彦
2023-12-01

我正在尝试在PHP(5.2.5)中进行非WSDL调用.我确定我错过了一些简单的事情.此调用有一个参数,一个名为“timezone”的字符串:

$URL = 'http://www.nanonull.com/TimeService/TimeService.asmx';

$client = new SoapClient(null, array(

'location' => $URL,

'uri' => "http://www.Nanonull.com/TimeService/",

'trace' => 1,

));

// First attempt:

// FAILS: SoapFault: Object reference not set to an instance of an object

$return = $client->__soapCall("getTimeZoneTime",

array(new SoapParam('ZULU', 'timezone')),

array('soapaction' => 'http://www.Nanonull.com/TimeService/getTimeZoneTime')

);

// Second attempt:

// FAILS: Generated soap Request uses "param0" instead of "timezone"

$return = $client->__soapCall("getTimeZoneTime",

array('timezone'=>'ZULU' ),

array('soapaction' => 'http://www.Nanonull.com/TimeService/getTimeZoneTime')

);

谢谢你的任何建议

戴夫

 类似资料: