Topic Options
Rate This Topic
#114128 - 03/23/05 05:20 PM PEAR Php SOAP client request -> OpCreate wsdl help!!!!
wlipford Offline
newbie

Registered: 03/07/05
Posts: 7
I am trying to consume a web service that I created via Remedy Admin tool that creates a tickets, it works with SoapScope and other utilties, problem is I dont know how to send the ARAuthenticate header (username,password) so I get a no write access error. Here is my php code if that helps,
Code:

<?php

ini_set("include_path", '/var/www/html/pear_includes/' . PATH_SEPARATOR . ini_get("include_path"));
require "HTML/QuickForm.php";
include "db_connection.inc";
require "HTML/wil_custom.php";
require_once 'SOAP/Client.php';

$test = array('userName'=>'Willy Lipford','password'=>'1soret','authentication'=>'','locale'=>'','timeZone'=>'');

$header_ns = '{http://remedy03.corp.tnsi.com/arsys/WSDL/remedy03/HD_AccountRequest}ARAuthenticate';

$auth_header = new SOAP_Header($header_ns,'string',$test,0);

print_r($auth_header);
echo "################\n";
$client = new SOAP_Client('http://remedy03.corp.tnsi.com/arsys/services/ARService?server=remedy03&webService=HD_AccountRequest',0);

$client->addHeader($auth_header);

$method='Create';
$params=array('E-Mail_Updates'=>'Yes',
'Full_DescriptionOfRequest'=>'TESTING WEBSERVER SUBMIT',
'ReportedProblemCategory'=>'Crystal Enterprise',
'ReportedRequestType'=>'Create User Account',
'RequestClass'=>'Application',
'Requestor'=>'Willy Lipford',
'UserAccount'=>'George Castanza',
'Status'=>'New',
'Tickettype'=>'Task',
'RequestTypeDescription'=>'Create Crystal Enterprise login account');

$new=& new SOAP_Value('{http://remedy03.corp.tnsi.com/arsys/WSDL/remedy03/HD_AccountRequest}Create','string',$v=$params);

echo "################\n";
print_r($new);
echo "################\n";

$options=array('namespace'=>'urn:HD_AccountRequest',
'soapaction'=>'urn:HD_AccountRequest/Create',
'style'=>'document',
'use'=>'literal',
'userName'=>'Willy Lipford',
'password'=>'1soret');

$res=$client->call($method,$v=array('Create'=>$new),$options);

if(PEAR::isError($res)) {
echo "Error: ".$res->getMessage()."\n";
}

else {
print_r($res);
}



What the heck is going on.... here is my error... oh btw - this is ars 5.1.2 on linux doing mid-tier 6.0.

Error:
MessageType: 2
MessageNum: 8932
MessageText: You do not have write license
AppendedText:
MessageType: 2
MessageNum: 332
MessageText: You do not have write access (at create time) to field
AppendedText: 536870986


Any idea what is going on!! please help!

Thanks,
Willy Lipford


Edited by Matt_Reinfeldt (03/24/05 11:10 AM)

Top
#114129 - 03/24/05 09:46 AM Re: PEAR Php SOAP client request -> OpCreate wsdl help!!!! [Re: dminton]
Anonymous
Unregistered


Well I figured it out, so I wanted to post for anyone that might need the answer.

$header = new SOAP_Header(
'urn:HD_AccountRequest}AuthenticationInfo',
'Struct',
array('userName'=>'foo','password'=>'bar'),
1);
$client->addHeader($header);

Then assemble the soap body like the rest, this will allow you to authenticate to the server for a write license.

-WL

Top
#114130 - 01/04/06 10:07 AM Re: PEAR Php SOAP client request -> OpCreate wsdl help!!!! [Re: Anonymous]
Anonymous
Unregistered


That's great! How did you figure it out? I've been beating my head on my desk for a week!

Top