Calling Authenticate with PHP Xweb xwebSecureClient Avectra netFORUM

This is a small sample adapted from the xwebSecureClass that shows calling the Authenticate method and getting the soap headers. NOTE: This code was adapted on the fly and is untested right now, if you find success or bugs please update the code accordingly.
<?php
$nfxweb
= new SoapClient("https://mynf.mywork.org/xweb/Secure/netFORUMXML.asmx?WSDL",
        Array(
'trace'=>true, //turning on trace=true will let us grab the headers and responses
           
'exceptions'=>true ));
 

//these are the params set in the constructor
$authReqParams = Array('userName'=>'bobbojones', 'password' => 'secretsecret');
$responseHeaders = '';
try{
   
//run the soap call to get it - with the headers. 
   
$response = $nfxweb->__SoapCall("Authenticate", array('parameters'=>$authReqParams), null,null, $responseHeaders);
   
//Here is the auth token from our response
   
$authToken = $responseHeaders['AuthorizationToken']->Token;
   
$xwebNamespace = $response->AuthenticateResult;
} catch(
SoapFault $exception) {
    throw
$exception;
}
 
//Create the header for our next request.
$authHeaders = new SoapHeader($xwebNamespace, 'AuthorizationToken', Array('Token'=>$authToken), true);
 
//make our next request, with the new header and capture the token again.
$arguments = Array('szObjectKey'=>"899D54C8-2D34-4E8B-B276-000B80C8958E", 'szObjectName'=>'Individual');
$response = $nfxweb->__soapCall("GetFacadeObject", $arguments, null, $authHeaders, $responseHeaders);
       
$authToken = $responseHeaders['AuthorizationToken']->Token;
?>
Please note that some client has run into some weird compatibility issue between PHP and .net web serivces regarding how auguments is called on SOAP calls.