tags:

views:

188

answers:

2

If I run this

$HostTransactionInfo = new HostTransactionInfo();  // std Object
$HostTransactionInfo->SecurenetID = $cc->merchant->data[$this->name]['secure_net_id'];
$HostTransactionInfo->SecureKey = $cc->merchant->data[$this->name]['secure_key'];
$HostTransactionInfo->Test = self::TEST;

$securenet = new SoapClient(self::WSDL, array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));
$host_trans_info = new SoapVar($HostTransactionInfo, SOAP_ENC_OBJECT);
var_dump($host_trans_info);

$save = $securenet->Process_Save($host_trans_info);

I receive this on every variation: "Server was unable to process request. ---> Object reference not set to an instance of an object."

My SoapClient::__getTypes() request gives me this:

array(
 [2] => struct HostTransactionInfo {
 string SecurenetID;
 string SecureKey;
 string Test;
}
 [6] => struct Process_Save {
 HostTransactionInfo oTi;
}
)

My SoapClient::__getFunctions() request gives me this:

array (
    [2] => Process_SaveResponse Process_Save(Process_Save $parameters)
)

Does anyone have any clue as to what I'm doing wrong?

+1  A: 

The error is returned by the securenet webservice. Why not contact their support?

But in any case, the server should return a more informative message than "Object reference not set to an instance of an object". The fact that their code dereferences null pointers when it gets some unexpected input doesn't bode well for something that's supposed to be a "secure" payment system.

Wim Coenen
+1  A: 

Please check the XML request that is sent to the server and the XML response you get back:

// ...
$securenet = new SoapClient(self::WSDL, array(
    'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
    'trace'    => true  // that's important for the debugging methods to work
));
// ...
$save = $securenet->Process_Save($host_trans_info);
var_dump($securenet-> __getLastRequestHeaders());
var_dump($securenet-> __getLastRequest());
var_dump($securenet-> __getLastResponseHeaders());
var_dump($securenet-> __getLastResponse());

This will help to get you an overview of what's happening on the wire. If you can rule out any server-related problem, the error will most likely be related to a XML-SOAP-request that is not in the required format.

Stefan Gehrig