I’m just getting started with soap communication through php.
I have access to a webservice that returns a true or false dependant on three attributes ‘username’, ‘password’ and ‘domain’
Here’s my anonymised request code:
//VARS
$username = 'example';
$password = 'example';
$domain = 'example';
$client = new SoapClient("https://www.example.com/example.wsdl");
try {
$client->authenticate(array($email, $password, $domain));
echo $client->__getLastResponse();
} catch (SoapFault $e) {
echo $e->getMessage();
}
die();
Now, as I mentioned, I’m new to this so I’m not sure that what I’ve written is even correct, please help!
Here are the relevant parts of the wsdl (again, anonymised):
//MESSAGE
<message name="AuthenticateRequest">
<part type="xsd:string" name="username"/>
<part type="xsd:string" name="password"/>
<part type="xsd:string" name="domain"/>
</message>
<message name="AuthenticateResponse">
<part type="xsd:boolean" name="authenticationResponse"/>
</message>
//OPERATION
<portType name="LDAPPortType">
<operation name="authenticate">
<documentation>
Connects to the LDAP server with the parameters provided. If successful, this function then attempts to bind to the LDAP directory with the user's credentials. The function returns TRUE on success or FALSE on failure.
</documentation>
<input message="tns:AuthenticateRequest"/>
<output message="tns:AuthenticateResponse"/>
</operation>
</portType>
Have I missed anything crucial?
Thanks for your help, it’s greatly appreciated!
I think you are going to need
$usernameinstead of$emailin this lineAlso try to specify parameter names in array as: