RIRedinPA Posted February 4, 2009 Share Posted February 4, 2009 I'm a newbie to SOAP. I'm using nuSoap. I'm having problems with the headers. I keep getting this fatal error: Fatal error: Class 'SOAPHeader' not found in /mnt/w0508/d09/s00/b02fe6e8/www/nasvf_cvent_api3.php on line 26 Here's my code: <html> <head> <title>NASVF_CVENT_API TEST</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php //include nusoap require_once ("nusoap/lib/nusoap.php"); //set up parameters $param = array('AccountNumber' =>'N...1', 'UserName' => 'N...i', 'Password' => '2...R'); //set up serverpath $serverpath = 'https://api.cvent.com/soap/V200611.ASMX?WSDL'; //declare new soapclient $client = new soapclient($serverpath); //make the call $result = $client->call('Login',$param); //set soap headers $CventSessionValue = array('CventSessionValue' => $result->LoginResult->CventSessionHeader); //$result is from login above $soap_header = new SOAPHeader('http://api.cvent.com/2006-11','CventSessionHeader',$CventSessionValue); $header->call('setSoapHeaders',($soap_header)); // if a fault occurred, output error info if (isset($fault)) { print "Error: ". $fault; } else { // Check for errors $err = $client->getError(); if ($err) { // Display the error echo '<h2>Error</h2><pre>' . $err . '</pre>'; } else { // Display the result echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>'; } } //create contact $contact = array('FirstName' => 'TestFirstName', 'LastName' => 'TestLastName', 'EmailAddress' => '[email protected]'); $result = $client->call('CreateContact', $contact); // if a fault occurred, output error info if (isset($fault)) { print "Error: ". $fault; } // kill object unset($client); ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/143716-soap-help/ Share on other sites More sharing options...
ratcateme Posted February 4, 2009 Share Posted February 4, 2009 im not an expert on SOAP so i dont know what classes are contained in each file but you need to require the file containing the SOAPHeader class the error is being caused because it cannot be found in the included files Scott. Link to comment https://forums.phpfreaks.com/topic/143716-soap-help/#findComment-754044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.