public function invokeWebService(array $connection, $operation, array $request) // Invokes StarTrack web service using supplied request and returns the response // For details see sample applications and the Usage Guide { try { /* $localCertificateFilespec = $connection['localCertificateFilespec']; // .pem client certificate with // private key prepended. $localCertificatePassphrase = $connection['localCertificatePassphrase']; // Passphrase for client's // private key $sslOptions = array( 'ssl' => array( 'cafile' => "c:/inetpub/wwwroot/eServices/Server_DSA_Public_Certificate.pem", 'local_cert' => $localCertificateFilespec, 'passphrase' => $localCertificatePassphrase, 'allow_self_signed' => true, 'verify_peer' => false ) ); $sslContext = stream_context_create($sslOptions); */ $clientArguments = array( // 'stream_context' => $sslContext, // 'trace' => true, 'exceptions' => true, 'encoding' => 'UTF-8', 'soap_version' => SOAP_1_1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS // Added in Release 4.0 to regularise // the response - single elements are // arrays of length 1, not objects ); $oClient = new WSSoapClient($connection['wsdlFilespec'], $clientArguments); $oClient->__setUsernameToken($connection['username'], $connection['password']); return $oClient->__soapCall($operation, $request); } catch (SoapFault $e) { throw new SoapFault($e->faultcode, $e->faultstring, NULL, $e->detail); // It is left to the caller to handle this exception as desired } }