【发布时间】:2018-06-18 14:51:06
【问题描述】:
我一直试图让它工作一段时间。我希望熟悉它的人碰巧遇到这个问题,并能解释为什么这不起作用以及代码有什么问题。到目前为止,埃斯蒂斯在帮助方面毫无用处。他们为我提供了很多信息,但没有一个有效。
下面的代码返回这个错误
致命错误:未捕获的 SoapFault 异常:[客户端] SOAP-ERROR: 编码:对象中没有“requestID”属性 /home/xxxxxxxxxx/public_html/inc/estes/estesapi.php:41 堆栈跟踪:#0 /home/xxxxxxxxxx/public_html/inc/estes/estesapi.php(41): SoapClient->__call('getQuote', Array) #1 {main} 抛出 /home/xxxxxxxxxx/public_html/inc/estes/estesapi.php 在第 41 行
$client = new SoapClient("https://www.estes-express.com/tools/rating/ratequote/v3.0/services/RateQuoteService?wsdl");
$request_object = array(
"header"=>array(
"auth"=>array(
"user"=>"xxxxxxxxx",
"password"=>"xxxx",
)
),
"rateRequest"=>array(
"requestID"=>"abc",
"account"=>"############",
"originPoint"=>array(
"countryCode"=>"US",
"postalCode"=>"28366",
"city"=>"Newton Grove",
"stateProvince"=>"NC",
),
"destinationPoint"=>array(
"countryCode"=>"US",
"postalCode"=>"28334",
),
"payor"=> "S",
"terms"=> "P",
"stackable"=> "N",
"baseCommodities"=>array(
"commodity"=>array(
"class"=>"50",
"weight"=>"1200",
)
)
)
);
$result = $client->getQuote($request_object);
var_dump($result);
print_r($result);
我不明白为什么 RequestID 没有被传递到soap请求中。
【问题讨论】:
-
为什么要将所有数据传递给`header'属性?
-
标题在第 9 行结束
-
是的,你说得对。我使用 SOAP 的经验是文档有时与 WSDL 文件不匹配。所以阅读 WSDL 文件并检查所需的参数
-
我希望有更多的文档。文档不是很好,没有详细说明,公司“不知道 php”,无法提供任何进一步的帮助。 ://
标签: php soap soap-client