Jump to content

SOAP Help...


RIRedinPA

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.