title: PHP + Web Services
body: <p>I'm struggling to get a web service to work which we are using to integrate with a software package from Civica. Unfortunately they have sent us code in visual basic which we don't use here and I'm struggling to "translate" the visual basic into PHP.</p>
  
  <p>So here's the code I have so far:</p>
  
  <pre><code>error_reporting(E_ALL);
  
  $client = new SoapClient('https://xxx/cx/WebService/WSTokenService? 
  singleWsdl');
  var_dump($client-&gt;__getFunctions());
  </code></pre>
  
  <p>The above works and I can see the functions. It's the next bit I can't get to work:</p>
  
  <pre><code>$request_param = array('Password' =&gt; 'xxx', 'UserName' =&gt; 'yyy');
  
  try
  {
   $request = $client -&gt;GetUserWSToken($request_param);
   $result = $request -&gt;GetUserWSTokenResult;
   print_r($result);
  }
  catch (Exception $e) 
  {
  echo "&lt;P&gt;&lt;P&gt;Exception Error!";
  echo $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>When I run the above code I get an error message "Exception Error!GetUserWSToken has service faults". I also get another error "Object reference not set to an instance of an object".</p>
  
  <p>The visual basic code we've been sent by the package company to use is:</p>
  
  <pre><code>Dim tokenClient As New TokenService.WSTokenServiceClient
  Dim tokenreq As New TokenService.SecurityTokenRequest
  tokenreq.UserName = "usernamehere"
  tokenreq.Password = "passwordhere"
  Dim token = tokenClient.GetUserWSToken(tokenreq)
  </code></pre>
  
  <p>Does anyone know how to translate the visual basic above into what I need to do for PHP?</p>