SoapClient gettting注意:数组转换为字符串和

时间:2016-03-05 00:34:10

标签: php wsdl soap-client

我已编写此代码并收到错误

注意:第12行/home/content/09/13963009/html/coupon/api/dgmwsdl1.php中的数组到字符串转换

错误:内部服务器错误

<?php   
error_reporting(E_ALL);
ini_set("display_errors", 1);
$soapClient = new SoapClient('http://webservices.dgperform.com/dgmpublisherwebservices.cfc?wsdl');
echo '<pre>';
// shows the methods coming from the service 
print_r($soapClient->__getFunctions());
print_r($soapClient->__getTypes());
$params = array('Dg-Affiliate-Id'   => 'xxxx','Dg-Affiliate-Token'  => 'xxxx','fromDate'  => '2015-01-31','toDate'  => '2016-03-04');
//  $params = array('username'  => 'xxxx','password'    => 'xxxx','fromDate'  => '2015-01-31','toDate'  => '2016-03-04');
try {
$auth_call=$soapClient->GetSales($params);
//          $auth_call=$soapClient->__soapCall("GetSales", $params);
print_r($auth_call);
die();      
} 
catch (SoapFault $fault) {
die('Error : ' . $fault->faultstring);
}
?>

第二个不同来电的脚本

<?php   
error_reporting(E_ALL);
ini_set("display_errors", 1);
$soapClient = new SoapClient('http://webservices.dgperform.com/dgmpublisherwebservices.cfc?wsdl');
echo '<pre>';
// shows the methods coming from the service 
print_r($soapClient->__getFunctions());
print_r($soapClient->__getTypes());
$params = array('Dg-Affiliate-Id'   => 'xxxx','Dg-Affiliate-Token'  => 'xxxx','fromDate'  => '2015-01-31','toDate'  => '2016-03-04');
//  $params = array('username'  => 'xxxx','password'    => 'xxxx','fromDate'  => '2015-01-31','toDate'  => '2016-03-04');
try {
//$auth_call=$soapClient->GetSales($params);
$auth_call=$soapClient->__soapCall("GetSales", $params);
print_r($auth_call);
die();      
} 
catch (SoapFault $fault) {
die('Error : ' . $fault->faultstring);
}
?>

错误:内部服务器错误

对于实时脚本,您可以参考http://vtechvision.com/coupon/api/dgmwsdl1.phphttp://vtechvision.com/coupon/api/dgmwsdl2.php

1 个答案:

答案 0 :(得分:0)

我可以解释为什么你在第一种情况下得到Notice: Array to string conversion in /home/content/09/13963009/html/coupon/api/dgmwsdl1.php on line 12

当你打印$soapClient->GetSales($params);时,你需要按照WSDL中的描述传递params

GetSales(string $username, string $password, double $campaignid, string $saleStatus, string $dateFilterType, string $fromDate, string $toDate, double $optionalParams, double $sku)

但是下一个返回的字符串Internal Server Error只是wsdl:service name="dgmpublisherwebservicesService"

的回复