I'm trying to use PHP to pass submitted form fields to a web service that will create a user record in our database. I know the web service is working because I have ColdFusion code that is able to successfully create a user account with submitted parameters from my local machine. However, I need to get this working in php since our site is built in Drupal (php). I also tried the wsclient (drupal module) but to no avail.
I came accross this post (How to make a PHP SOAP call using the SoapClient class) which is similar to what I'm trying to do, but I keep getting an error. Here is the code I'm working with. Also, I need to pass the security password to use the web service in order to use it.
class Create {
function Create($securityPassword)
{
$this->securityPassword = $securityPassword;
}
}
$client = new SoapClient("https://isgweb.entnet.org/iservices/Account.asmx?WSDL");
$create = new Create("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); //web service password
$params = array(
"Create" => $create,
"Prefix" => "Mr",
"FirstName" => "John",
"LastName" => "Doe",
);
//print_r($params);
$response = $client->__soapCall('Create', array($params));
var_dump($response);
Here is the error I'm getting:
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\wamp\www\sandbox\webservice2.php:23 Stack trace: #0 C:\wamp\www\sandbox\webservice2.php(23): SoapClient->__soapCall('Create', Array) #1 {main} thrown in C:\wamp\www\sandbox\webservice2.php on line 23
The method I'm trying to call is the "Create" method. You can see it exists in the wsdl url
I'd appreciate help in trying to successfully create a record using the web service via php.