Help save net neutrality! Learn more.

NuSoap missing SoapHeader class

  • Richard

    Richard - 2010-01-14


    I am new to NuSoap and am trying to implement it with using a purolator module (oh what fun..)
    I am getting the following error: Fatal error: Class 'SoapHeader' not found in  …

    //Define the Production (or development) Key and Password
    define("PRODUCTION_KEY", "XX");
    define("PRODUCTION_PASS", XX");
    //Define the Billing account and the account that is registered with PWS
    define("BILLING_ACCOUNT", "XX");
    define("REGISTERED_ACCOUNT", "XX");
    function createEWSSOAPClient()
      /** Purpose : Creates a SOAP Client in Non-WSDL mode with the appropriate authentication and 
        *           header information
      //Set the parameters for the Non-WSDL mode SOAP communication with your Development/Production credentials
      $client = new SoapClient( "./wsdl/shippingservice.wsdl", 
                                array   (
                                        'trace' =>  true,
                                        //Development (dev)
                                        //'location'    =>  "",
                                        'uri'=> "",
                                        'login' =>  PRODUCTION_KEY,
                                        'password'  =>  PRODUCTION_PASS
                              );print $client;
      //Define the SOAP Envelope Headers
      # '<soap:Header xmlns="><RequestContext><Version>1.0</Version><Language>en</Language><GroupID>xxx</GroupID><RequestReference>Rating Sample</RequestReference></RequestContext></soap:Header>'; 
     $headers[] = new SoapHeader("", 
                                    array (
                                            'Version'           =>  '1.0',
                                            'Language'          =>  'en',
                                            'GroupID'           =>  'xxx',
                                            'RequestReference'  =>  'Rating Example'
      //Apply the SOAP Header to your client                            
      return $client;

    I downloaded the NuSoap package from SourceForge.
    I read through all the NuSoap provided php file for the class 'soapheader' (not case sens.) but couldn't find it.
    Can someone guide me or help me into the right direction please?


  • sandeep

    sandeep - 2010-01-27

    me too facing similar issue
    Fatal error: Class 'SoapVar' not found
    Fatal error: Class 'SoapHeader' not found
    My code is as below


    $auth = array('User_id'=>'ravi','Password'=>'r2','ExternalPartyName'=>'');

    $authvar = new SoapVar($auth, SOAP_ENC_OBJECT);
    $header = new SoapHeader('http://subscribe/IntegrationService', 'MQUserNameToken xmlns="http://subscribe/IntegrationService"', $authvar, false);


    $client=new soapclient($wsdl, 'wsdl');


    echo $client->call('GetItems', $param)."\n";

    echo '<h2>Request</h2>';
      echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
      echo '<h2>Response</h2>';
      echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';

  • Scott Nichol

    Scott Nichol - 2010-04-26

    NuSOAP does not have SoapVar or SoapHeader classes.  The code looks like it is for the SOAP library for PHP.  Some PHP installations do not have this library available.  That is one reason NuSOAP is popular: it is just PHP code, so it does not matter how the PHP engine you are using was built.


Log in to post a comment.