Dewald Henning
Dewald Henning

Reputation: 353

PHP Soap Client Key Error

I need some assistance please. I am not a PHP expert but I know my way around, but for the life of me I cannot find the problem for this.

We have an external database (MSSQL Database to which we do not have access to) residing at our client. We use a CRM solution which generates a licence key for their products using a string. We access the stored procedures via a web service written in C#. On our side we have a PHP site that accesses the web service to write to the database.

My Code in PHP looks like this :

$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;
}

For some reason, every time I try to generate the product code, it gives the error :

Server was unable to process request. ---> Key Error. 

The version of php is 5.2 (I'm busy rewriting the whole thing to asp.net, but I have a time constraint on this for end of August)

Any help would be greatly appreciated.

EDIT "skey"=>$skey fixed. Thanks.

But the problem went from giving me an error to showing nothing but a grey page.

Upvotes: 0

Views: 372

Answers (2)

Sumit Gupta
Sumit Gupta

Reputation: 2192

I just open the WSDL link you provided and based on what I see, change the line

$result = $client->__soapCall("InsertSerialAuthProduct", array("InsertSerialAuthProduct" => array("Skey"=>$skey,"ProductID" => $productID ,"Data"=>$data))); 

to

$result = $client->__soapCall("InsertSerialAuthProduct", array("InsertSerialAuthProduct" => array("skey"=>$skey,"ProductID" => $productID ,"Data"=>$data))); 

as I see in WSDL s is small in skey so this might be cause of error. not sure though.

Upvotes: 0

som
som

Reputation: 4656

Problem :

"Skey"=>$skey, should be "skey"=>$skey,

$client->__soapCall("InsertSerialAuthProduct", array(
                    "InsertSerialAuthProduct" => array(
                             "skey"=>$skey, // Not Skey
                             "ProductID" => $productID ,
                             "Data"=>$data)
                            )
                    );

You can call like this :

$wsdl = "http://connectedservices.sagesouthafrica.co.za/serv/communicate.asmx?wsdl";
$client = new SoapClient($wsdl);
$result = $client->InsertSerialAuthProduct(array(
                          "skey"=>$skey,
                          "ProductID" => $productID ,
                          "Data"=>$data)
              );

Upvotes: 1

Related Questions