簡體   English   中英

PHP Soap客戶端密鑰錯誤

[英]PHP Soap Client Key Error

我需要一些幫助。 我不是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已修復。 謝謝。

但是問題從給我一個錯誤到只顯示一個灰色頁面而已。

問題:

"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)
              );

我只是打開您提供的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很小,所以這可能是導致錯誤的原因。 雖然不確定。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM