PHP Server was unable to process request
This is my coding can any one help:
<?php
class clsWSSEAuth {
private $Username;
private $Password;
private $Meruser;
private $Merpass;
function __construct($username, $password) {
$this->Username=$username;
$this->Password=$password;
//$this->MerhcantUsername=$Meruser;
//$this->MerhcantPassword=$Merpass;
}
}
/*class clsWSSEToken {
private $UsernameToken;
function __construct ($innerVal){
$this->UsernameToken = $innerVal;
}
}*/
?>
<!--Step2: Create Soap Variables for UserName and Password -->
<?php
include("lib/nusoap.php");
$Username = $_REQUEST['usname'];
$Password = $_REQUEST['uspass'];
$Meruser = $_REQUEST['merusname'];
$Merpass = $_REQUEST['meruspass'];
//Check with your provider which security name-space they are using.
$strWSSENS = "http://localhost/royal_new/";
$objSoapVarUser = new SoapVar($Username, XSD_STRING, NULL, $strWSSENS, NULL, $strWSSENS);
$objSoapVarPass = new SoapVar($Password, XSD_STRING, NULL, $strWSSENS, NULL, $strWSSENS);
$objSoapVarmerUser = new SoapVar($Meruser, XSD_STRING, NULL, $strWSSENS, NULL, $strWSSENS);
$objSoapVarmerPass = new SoapVar($Merpass, XSD_STRING, NULL, $strWSSENS, NULL, $strWSSENS);
?>
<!--Step3: Create Object for Auth Class and pass in soap var -->
<?php
$objWSSEAuth = new clsWSSEAuth($objSoapVarUser, $objSoapVarPass);
?>
<!--Step4: Create SoapVar out of object of Auth class-->
<?php
$objSoapVarWSSEAuth = new SoapVar($objWSSEAuth, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS);
?>
<!--Step5: Create object for Token Class-->
<?php
//$objWSSEToken = new clsWSSEToken($objSoapVarWSSEAuth);
?>
<!--Step6: Create SoapVar out of object of Token class-->
<?php
//$objSoapVarWSSEToken = new SoapVar($objWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS);
?>
<!--Step7: Create SoapVar for 'Security' node-->
<?php
//$objSoapVarHeaderVal=new SoapVar($objSoapVarWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'Security', $strWSSENS);
?>
<!--Step8: Create header object out of security soapvar-->
<?php
//$objSoapVarWSSEHeader = new SoapHeader($strWSSENS, 'Security', $objSoapVarHeaderVal,true, 'http://services.l2payments.com/MerchantServices.asmx?WSDL');
//Third parameter here makes 'mustUnderstand=1
//Forth parameter generates 'actor="http://abce.com"'
?>
<!--Step9: Create object of Soap Client-->
<?php
$param = array('MerhcantUsername' => $Username,'MerhcantPassword' =>$Password);
$objClient = new SoapClient('http://services.l2payments.com/MerchantServices.asmx?WSDL', $param);
?>
<!--Step10: Set headers for soapclient object -->
<?php
//$objClient->__setSoapHeaders(array($objSoapVarWSSEHeader));
?>
<!--Step 11: Final call to method -->
<?php
try {
$objResponse = $objClient->__soapCall('LoginRequest', $param); // Note: Same results without or without exceptions => true
} catch(Exception $开发者_开发技巧e) {
var_dump($e);
}
?>
I am getting this error:
object(SoapFault)#9 (9) {
["message:protected"]=> string(96) "Server was unable to process request. ---> Object reference not set to an instance of an object."
["string:private"]=> string(0) ""
["code:protected"]=> int(0)
["file:protected"]=> string(32) "C:\wamp\www\royal_new\server.php"
["line:protected"]=> int(102)
["trace:private"]=> array(1) {
[0]=> array(6) {
["file"]=> string(32) "C:\wamp\www\royal_new\server.php"
["line"]=> int(102)
["function"]=> string(10) "__soapCall"
["class"]=> string(10) "SoapClient"
["type"]=> string(2) "->"
["args"]=> array(2) {
[0]=> string(12) "LoginRequest"
[1]=> array(2) {
["MerhcantUsername"]=> string(5) "manoj"
["MerhcantPassword"]=> string(5) "manoj" } } } }
["faultstring"]=> string(96) "Server was unable to process request. ---> Object reference not set to an instance of an object."
["faultcode"]=> string(11) "soap:Server"
["detail"]=> string(0) "" }
精彩评论