title: Send request to the queryCSV method of rightnow webservice using PHP
body: <p>I want to send request parameters &amp; client info header to te rightnow webservice using PHP SOAP calls. How can I do this ? Please help</p>
  
  <p>My wsdl structure is as follows:</p>
  
  <pre><code>&lt;wsdl:operation name="QueryCSV"&gt;
              &lt;soap:operation soapAction="QueryCSV" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body parts="parameters" use="literal"/&gt;
                  &lt;soap:header message="rnw_v1_2:ClientInfoHeader" part="request_header" use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
  </code></pre>
  
  <p>I want to pass client header and parameters (query, pagesize, delimiter, returnrawresult, disableMTOM) to the queryCSV method. I am getting following error:</p>
  
  <p>Fatal error: Uncaught SoapFault exception: [soapenv:Sender] Data element in the Message is NULL in index.php(112): SoapClient->__soapCall('QueryCSV', Array) #1 {main} thrown in index.php </p>
  
  <p>I tried several ways, one of the way I tried is here:</p>
  
  <pre><code>&lt;?php
  
  class clsWSSEAuth {
            private $Username;
            private $Password;
          function __construct($username, $password) {
                   $this-&gt;Username=$username;
                   $this-&gt;Password=$password;
                }
  }
  
  class clsWSSEToken {
          private $UsernameToken;
          function __construct ($innerVal){
              $this-&gt;UsernameToken = $innerVal;
          }
  }
  
  class ClientInfoHeader {
           private $AppID;
           function __construct ($appid){
               $this-&gt;AppID = $appid;
          /}
  }
  
  
  $username = "***";
  $password = "***";
  $WSDL = "https://*****/services/soap?wsdl";
  $arrOptions = array('trace' =&gt; true);
  $appid = "*****";
  
  
  // SECURITY NAMESPACE
  $strWSSENS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
  
  //client infoheader namespace
  $v1 = "urn:wsdl.ws.rightnow.com/v1_2";
  
  $objSoapVarUser = new SoapVar($username, XSD_STRING, NULL, $strWSSENS, NULL, $strWSSENS);
  $objSoapVarPass = new SoapVar($password, XSD_STRING, NULL, $strWSSENS, NULL, $strWSSENS);
  
  $objWSSEAuth = new clsWSSEAuth($objSoapVarUser, $objSoapVarPass);
  $objSoapVarWSSEAuth = new SoapVar($objWSSEAuth, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS);
  
  // token object
  $objWSSEToken = new clsWSSEToken($objSoapVarWSSEAuth);
  $objSoapVarWSSEToken = new SoapVar($objWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS);
  $objSoapVarHeaderVal = new SoapVar($objSoapVarWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'Security', $strWSSENS);
  
  # Create the ClientInfoHeader header
  $objAppId = new SoapVar($appid, XSD_STRING, NULL, $v1, NULL, $v1);
  $objClientInfoHeader = new SoapVar($objAppId, SOAP_ENC_OBJECT, NULL, $v1, 'ClientInfoHeader', $v1);
  
  
  //soap header
  $objSoapVarWSSEHeader = array();
  $objSoapVarWSSEHeader[] = new SoapHeader($strWSSENS, 'Security', $objSoapVarHeaderVal, true);
  $objSoapVarWSSEHeader[] = new SoapHeader($v1, 'ClientInfoHeader', $objClientInfoHeader);
  
  $objClient = new SoapClient($WSDL, $arrOptions);
  //set headers
  $wss_header = $objClient-&gt;__setSoapHeaders($objSoapVarWSSEHeader);
  
  
   $Query = "select ********** from ******** where id &gt; *** ";
   $PageSize = 50;
   $Delimiter = '|';
   $ReturnRawResult = false;
   $DisableMTOM = true;
  
   $params = array('Query' =&gt; $Query, 'PageSize' =&gt; $PageSize, 'Delimiter' =&gt; $Delimiter, 'ReturnRawResult' =&gt; $ReturnRawResult, 'DisableMTOM' =&gt; $DisableMTOM);
  
  
   $objResponse = $objClient-&gt;__soapCall("QueryCSV", array('parameters' =&gt; $params));
   var_dump($objResponse);
  
   ?&gt;
  </code></pre>