tags:

views:

58

answers:

1

I am trying to invoke the Web Service PersonalDetails_Update by passing an array of values to it. These values are being successfully written to the database that the web service is designed to do. However, it is also supposed to return an ID for the record written to the database. But I don't get anything back. Just a blank screen with no XML or underlying source.

When using getLastRequest, I get this error:

Fatal error: Uncaught SoapFault exception: [Client] Function ("getLastRequest") is not a valid method for this service in

Code used to pass data to web service and request/response headers:

$client->PersonalDetails_Update(array('personaldetails' => $params));
printf("<br/> Request = %s </br>", htmlspecialchars($client->getLastRequest()));
$result = $client->__getLastResponse();
$header = $client->__getLastResponseHeaders();

When using getLastResponse and getLastResponseHeaders, I don't get anything back.

+1  A: 

you forgot the "__":

printf("<br/> Request = %s </br>", htmlspecialchars($client->__getLastRequest()));

your soap client thinks "getLastRequest" is a method of a soap service this way, not a soap client method.

also you should tell us what soap client you are using. i assume you use php built-in soap client...

use __soapCall method to be sure, you are making a request to the service:

try {
    $result = $client->__soapCall('PersonalDetails_Update', array('personaldetails' => $params));
} catch (SoapFault $exception) {
    echo 'soap fault occured: '.$exception->getMessage().'<br/>';
}

you should check if the returned value is a soap fault.. see the manual

kgb
Thanks for this. When using __soapCall as you have written it, I get the following error: Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in
baswoni
To answer your question, yes I am using the standard built-in PHP Soap Client.
baswoni
that's why i told you to check if answer is a soapfault ;). the error you get is the soap service error, the client sent request and received response correctly. use a try{}catch(SoapFault $e){}.... the reason why "Server was unable to process request" is a different question. you have to check your request params or debug the server.
kgb
I don't think I've got the syntax correct here?try{ $client->PersonalDetails_Update(array('personaldetails' => $params));} catch { (SoapFault $e) {}}
baswoni
i've added a try - catch block to the answer
kgb
Thanks for this. The error I'm getting is: soap fault occured: Server was unable to process request. ---> Object reference not set to an instance of an object.You mentioned that this is a server-side issue if the error says server was unable to process request? Does this indicate a configuration problem at the web-service end?
baswoni