我需要一些帮助。我不是PHP专家,但我知道我的方式,但对于我的生活,我找不到这个问题。
我们有一个驻留在我们客户端的外部数据库(我们无权访问的MSSQL数据库)。我们使用CRM解决方案,使用字符串为其产品生成许可证密钥。我们通过用C#编写的Web服务访问存储过程。在我们这边,我们有一个PHP站点访问Web服务以写入数据库。
PHP中的我的代码如下所示:
$skey = "FDGK:LKss#()#84$$$";
$productID = 5;
$data = "D359;00011,P,D359ZZ,SQKGLTKQKQYZHRA,ALNR,009350,20140228,005392;DEWALDH;D359;0";
try
{
$wsdl = "http://connectedservices.sagesouthafrica.co.za/serv/communicate.asmx?wsdl";
$client = new SoapClient($wsdl);
$result = $client->__soapCall("InsertSerialAuthProduct", array("InsertSerialAuthProduct" => array("Skey"=>$skey,"ProductID" => $productID ,"Data"=>$data)));
} catch (SoapFault $E)
{
echo $E->faultstring;
}
出于某种原因,每次我尝试生成产品代码时,都会出错:
Server was unable to process request. ---> Key Error.
php的版本是5.2(我正忙着把整个东西重写为asp.net,但是我对8月底有时间限制)
非常感谢任何帮助。
修改 “skey”=> $ skey已修复。谢谢。
但问题是从给我一个错误到只显示灰页。
答案 0 :(得分:1)
问题:
"Skey"=>$skey,
应为"skey"=>$skey,
$client->__soapCall("InsertSerialAuthProduct", array(
"InsertSerialAuthProduct" => array(
"skey"=>$skey, // Not Skey
"ProductID" => $productID ,
"Data"=>$data)
)
);
您可以这样打电话:
$wsdl = "http://connectedservices.sagesouthafrica.co.za/serv/communicate.asmx?wsdl";
$client = new SoapClient($wsdl);
$result = $client->InsertSerialAuthProduct(array(
"skey"=>$skey,
"ProductID" => $productID ,
"Data"=>$data)
);
答案 1 :(得分:0)
我只是打开你提供的WSDL链接,根据我看到的,改变行
$result = $client->__soapCall("InsertSerialAuthProduct", array("InsertSerialAuthProduct" => array("Skey"=>$skey,"ProductID" => $productID ,"Data"=>$data)));
到
$result = $client->__soapCall("InsertSerialAuthProduct", array("InsertSerialAuthProduct" => array("skey"=>$skey,"ProductID" => $productID ,"Data"=>$data)));
正如我在WSDL中看到的那样skey很小,所以这可能是错误的原因。但不确定。