0

I am soapClient to access web service as follows.

$con = new SoapClient('wsdl url');
$array = array("apiRequestDetails" => array(
            "id" => "0000045399",
            "mobile" => "9843484142",
            "pin" => "b59c67bf196a4758191e42f76670ceba",
            "refNumber" => "222",
            "serviceCode" => "23",
            "trxnTraceId" => "1",
            "value" => "200.068879335"
    
    ));
$det = $con->__call('initiatePayment', $array);
    echo '<pre>';
    print_r($det);

I get following error Fatal error: Uncaught SoapFault exception: [S:Server] java.lang.NullPointerException in D:\xampp\htdocs\sharepoint\connection.php:25 Stack trace:

0 D:\xampp\htdocs\sharepoint\connection.php(25): SoapClient->__call('initiatePayment', Array)

1 {main}

thrown in D:\xampp\htdocs\sharepoint\connection.php on line 25 Can anyone tell me what this error is and how can i solve it. thanks in advance

3
  • Calling __call directly is deprecated, check my answer, it contains a link to the man page Commented Dec 13, 2013 at 11:00
  • no java code here so why java tag? Commented Dec 13, 2013 at 11:01
  • @JqueryLearner though i am using php here the webservice that i am using is in java Commented Dec 13, 2013 at 11:23

1 Answer 1

1

It's an unhandled exception. Try wrapping it in a try/catch block to find out the error. Also __call() is deprecated, you should be using __soapCall().

try{
    $det = $con->__soapCall('initiatePayment', $array);
    print_r($det);
} catch(SoapFault $ex){
    echo $ex->getMessage();
}
Sign up to request clarification or add additional context in comments.

3 Comments

I tried it too and it returns 'java.lang.NullPointerException' and I also have tried __soapCall() and also it gives the same error 'java.lang.NullPointerException'
__call isn't deprecated. Calling it directly is deprecated. For regular SOAP calls, the __call method is still being used
Also, read the docs for the __soapCall method (link in my answer): it's meant to be used in rather specific cases (non-wsdl, unknown SOAP action, different uri's etc...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.