在php中调用soap函数时出错
Posted
技术标签:
【中文标题】在php中调用soap函数时出错【英文标题】:error in calling soap function in php 【发布时间】:2013-11-28 13:06:33 【问题描述】:我如何从这个站点获取 php 中的肥皂数据 http://www2.rlcarriers.com/freight/shipping-resources/rate-quote-instructions
他们有“GetRateQuote(string APIKey, RequestObjects.RateQuoteRequest request)” 这个函数我怎么能从 php soap 调用这个
$client = new SoapClient('http://api.rlcarriers.com/1.0.1/RateQuoteService.asmx?WSDL'); //print_r($client); //$result = $client->GetRateQuote('xxxxxxxxxxxxxxxxxxxxxx.......',);
print_r($result); ?> 我应该在第二个参数中传递什么
【问题讨论】:
【参考方案1】:尝试以下方法:
$client = new SoapClient("http://api.rlcarriers.com/1.0.1/ShipmentTracingService.asmx?WSDL", array("trace" => 1));
$request = array(
"APIKey" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"request" => array(
"TraceNumbers" => array(
0 => "xxxxxxxxx"
),
"TraceType" => "PRO",
"FormatResults" => "true",
"IncludeBlind" => "true",
"OutputFormat" => "Standard"
)
);
try
$response = $client->TraceShipment($request);
print_r($response);
catch (SoapFault $exception)
print_r($exception);
【讨论】:
以上是关于在php中调用soap函数时出错的主要内容,如果未能解决你的问题,请参考以下文章