Karuna,
at first glance, you will need to put newlines after each header field like 
this:

$header  = "Content-Type: text/xml\r\n";
$header .= " X-User: admin\r\n";
$header .= " X-Pass: password\r\n";
$header .= " X-APIVERSION: 2\r\n";

I am assuming that the headers are not properly read on the VCL side and so 
authentication isn't proceeding; otherwise, the code looks fine.

Aaron


--
Aaron Coburn
Systems Administrator and Programmer
Academic Technology Services, Amherst College
[email protected]<mailto:[email protected]>






On Aug 8, 2012, at 7:19 AM, Karuna P Joshi wrote:

Hello,

I am using VCL Sandbox installation to create a request/reservation from
the cloud broker interface. I am trying to use the XMLRPCaddRequest
function in the xmlrpcWrappers file and have ensured that I am passing the
X-User, X-Pass and X-APIVERSION values in the http header. However, I keep
getting " *faultString Access denied **faultCode **3*" error message.

I noticed some messages in the archives discussing this and would
appreciate any pointers on next steps I should take. I am also including my
code below -

$request = xmlrpc_encode_request("XMLRPCaddRequest", array($ImageID,
$start, $length));
$header  = "Content-Type: text/xml";
$header .= " X-User: admin ";
$header .= " X-Pass: password ";
$header .= " X-APIVERSION: 2";
$context = stream_context_create(array('http' => array(
   'method' => "POST",
   'header' => $header,
   'content' => $request
)));
$file = file_get_contents("https://152.46.16.138/index.php?mode=xmlrpccall";,
false, $context);
$response = xmlrpc_decode($file);
if($response && xmlrpc_is_fault($response)) {
    trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
   print_r($response);
}

--
regards,
Karuna
____________________
Karuna Pande Joshi
PhD Candidate,
CSEE Dept, UMBC
[email protected]<mailto:[email protected]>,  
[email protected]<mailto:[email protected]>

Reply via email to