Object reference not set to an instance of an object

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
EddiRae
Forum Newbie
Posts: 9
Joined: Fri Jun 19, 2009 11:00 am

Object reference not set to an instance of an object

Post by EddiRae »

I am new to PHP and webservices.

I am getting an error that I am not sure where to start looking.

My code in PHP is:

Code: Select all

<?php
 
function TREC($a, $b, $c, $d, $e, $f)
{
  $str = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><Transmission><EdProviderData><DetailData><Detail>";
  $str = $str . "<IN_PROV>$a</IN_PROV> <IN_CRSE>$b</IN_CRSE> <IN_CDATE>$c</IN_CDATE> <IN_ZIP>$d</IN_ZIP>";
  $str = $str . "<IN_LICENSE>$e</IN_LICENSE> <IN_NAME>$f</IN_NAME> </Detail> </DetailData> </EdProviderData> </Transmission>";
  
  $wsdl="https://www.trec.state.tx.us/ProcessEdRoster/Service1.asmx?wsdl";
  
  $client=new soapclient($wsdl);
  // this is the authentication ticket I got from an authentication webservice
  try
  {
     // instantiate soapclient
     $client = new SoapClient($wsdl);
     // create header object and insert into headers
     $header = new SoapHeader('https://www.trec.state.tx.us/ValidationSoapHeader/', 'DevToken',$DevToken, false);
 
     // do it
     $response = $client->ProcessRoster(array($str), NULL, $header);
 
     return $response;
   }
   catch (SoapFault $exception)
   {
     return $exception;
   }
}
 
$TREC = TREC('0303','66-66-129-6503','06242009','77041','1234567','Eddi Rae Melton');
 
echo $TREC;
 
?>
The error that I am getting is as follows:

Code: Select all

SoapFault exception: 
[soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\TREC.php:33 
Stack trace: 
    #0 [internal function]: SoapClient->__call('ProcessRoster', Array) 
    #1 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\TREC.php(33): SoapClient->ProcessRoster(Array, NULL, Object(SoapHeader)) 
    #2 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\TREC.php(44): TREC('0303', '66-66-129-6503', '06242009', '77041', '1234567', 'Eddi Rae Melton') 
    #3 {main}
Where do I start looking?
Thanks for your help!!
Eddi Rae
Last edited by Benjamin on Wed Jun 24, 2009 12:48 pm, edited 1 time in total.
Reason: Changed code type from text to php.
Post Reply