The bits of code I was missing:
Setup Response Complex type in the wsdl
Code:
$server->wsdl->addComplexType('AuthResponseType',
'complexType',
'struct',
'all',
'',
array(
'DebtorCode' => array('name' => 'DebtorCode',
'type' => 'xsd:string'),
'SessionCode' => array('name' => 'SessionCode',
'type' => 'xsd:string')
)
);
Register the function with the server
Code:
$server->register('Authenticate',
array('userName' => 'xsd:string',
'password' => 'xsd:string'),
array('return' => 'tns:AuthResponseType'),
'MyApiWrapper',
'MyApiWrapper#Authenticate',
'rpc',
'encoded',
'Authenticates the login credentials and returns the debtor code and session id of the authenticated session');
The actual function, see the return array...
Code:
function Authenticate($userName, $password){
$client = new SoapClient(null, array('location' => "http://blah.com/api.php", 'uri' => "http://blah.com/"));
$AuthResponse = $client->authenticate($userName, $password);
return array(
'DebtorCode' => $AuthResponse->debtorCode,
'SessionCode' => $AuthResponse->session);
}
Still seems like a lot of code, but it works. I got my response in .Net and all was well.