Re: [otrs] PHP and SOAP

2011-05-04 Thread Aleksander Walesa
Thanks Roy,

This is exactly what was needed :)

Best Regards,
Aleksander


-Original Message-
From: otrs-boun...@otrs.org [mailto:otrs-boun...@otrs.org] On Behalf Of Roy 
Kaldung
Sent: Wednesday, May 04, 2011 3:14 PM
To: User questions and discussions about OTRS.
Subject: Re: [otrs] PHP and SOAP

Hi Aleksander,

I wrote a little wrapper class for me and that's my TicketGet method:

public function getTicketData ($ticketId)
{
$ticketData = $this->client->__soapCall('Dispatch',
array($this->username, $this->password, "TicketObject", "TicketGet",
"Result", "ARRAY", "UserID", 1, "TicketID", $ticketId));
$data = array();
foreach (array_keys($ticketData) as $key => $val) {
$data[$key] = $ticketData[$val];
}
$td = array();
for ($i = 0; $i < count($data); $i = $i + 2) {
$td[$data[$i]] = $data[$i + 1];
}
return $td;
}

The method returns a hash array, e.g. $ticketData['TicketFreeText5']

hth,

Roy

-- 
Roy Kaldung
e-mail: r...@kaldung.com


-
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
-
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs


Re: [otrs] PHP and SOAP

2011-05-04 Thread Roy Kaldung
Hi Aleksander,

I wrote a little wrapper class for me and that's my TicketGet method:

public function getTicketData ($ticketId)
{
$ticketData = $this->client->__soapCall('Dispatch',
array($this->username, $this->password, "TicketObject", "TicketGet",
"Result", "ARRAY", "UserID", 1, "TicketID", $ticketId));
$data = array();
foreach (array_keys($ticketData) as $key => $val) {
$data[$key] = $ticketData[$val];
}
$td = array();
for ($i = 0; $i < count($data); $i = $i + 2) {
$td[$data[$i]] = $data[$i + 1];
}
return $td;
}

The method returns a hash array, e.g. $ticketData['TicketFreeText5']

hth,

Roy

-- 
Roy Kaldung
e-mail: r...@kaldung.com


-
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs


Re: [otrs] PHP and SOAP

2011-05-04 Thread Shawn Beasley
Hello Aleksander,

On May 4, 2011, at 14:22 , Aleksander Walesa wrote:

> Hi All,
>  
> I’m struggling with SOAP from PHP. I’ve interface set up and can access API. 
> But when I run this script (to display single ticket data):
>  

There is a d...@otrs.org and a user forum 
http://forums.otrs.org/viewforum.php?f=64 that could be of help here. I 
recommend trying both.

///shawn-
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

[otrs] PHP and SOAP

2011-05-04 Thread Aleksander Walesa
Hi All,

I'm struggling with SOAP from PHP. I've interface set up and can access API. 
But when I run this script (to display single ticket data):

http://192.168.9.149/otrs/rpc.pl";;

$soapclient = new SoapClient(null, array('location'  => $url,
 'uri'   => "Core",
 'trace' => 1,
 'login' => $user,
 'password'  => $pass,
 'style' => SOAP_RPC,
 'use'   => SOAP_ENCODED));
$ticket = $soapclient->__soapCall("Dispatch", array($user, $pass, 
"TicketObject", "TicketGet","TicketID","30","UserID","1"));
var_dump($ticket);
?>

I'm getting such output:

array(146) { ["s-gensym1194"]=> string(3) "Age" ["s-gensym1196"]=> 
int(52802585) ["s-gensym1198"]=> string(10) "PriorityID" ["s-gensym1200"]=> 
int(3) ["s-gensym1202"]=> string(9) "ServiceID" ["s-gensym1204"]=> string(0) "" 
["s-gensym1206"]=> string(16) "TicketFreeText11" ["s-gensym1208"]=> string(0) 
"" ["s-gensym1210"]=> string(15) "TicketFreeTime4" ["s-gensym1212"]=> string(0) 
"" ["s-gensym1214"]=> string(15) "TicketFreeTime1" ["s-gensym1216"]=> string(0) 
"" ["s-gensym1218"]=> string(15) "TicketFreeText6" ["s-gensym1220"]=> string(0) 
"" ["s-gensym1222"]=> string(7) "StateID" ["s-gensym1224"]=> int(2) 
["s-gensym1226"]=> string(15) "TicketFreeTime5" ["s-gensym1228"]=> string(0) "" 
["s-gensym1230"]=> string(14) "EscalationTime" ["s-gensym1232"]=> int(0) 
["s-gensym1234"]=> string(15) "TicketFreeTime6" ["s-gensym1236"]=> string(0) "" 
["s-gensym1238"]=> string(14) "TicketFreeKey9" ["s-gensym1240"]=> string(0) "" 
["s-gensym1242"]=> string(7) "OwnerID" ["s-gensym1244"]=> int(4) 
["s-gensym1246"]=> string(7) "Changed" ["s-gensym1248"]=> string(19) 
"2009-08-31 10:43:54" ["s-gensym1250"]=> string(5) "Owner" ["s-gensym1252"]=> 
string(10) "lsmolinski" ["s-gensym1254"]=> string(15) "TicketFreeText7" 
["s-gensym1256"]=> string(0) "" ["s-gensym1258"]=> string(15) "TicketFreeKey11" 
["s-gensym1260"]=> string(0) "" ["s-gensym1262"]=> string(7) "Created" 
["s-gensym1264"]=> string(19) "2009-08-31 10:43:52" ["s-gensym1266"]=> 
string(15) "TicketFreeText4" ["s-gensym1268"]=> string(0) "" ["s-gensym1270"]=> 
string(7) "QueueID" ["s-gensym1272"]=> int(4) ["s-gensym1274"]=> string(15) 
"TicketFreeText2" ["s-gensym1276"]=> string(0) "" ["s-gensym1278"]=> string(14) 
"TicketFreeKey6" ["s-gensym1280"]=> string(0) "" ["s-gensym1282"]=> string(8) 
"TicketID" ["s-gensym1284"]=> int(30) ["s-gensym1286"]=> string(14) 
"TicketFreeKey5" ["s-gensym1288"]=> string(0) "" ["s-gensym1290"]=> string(16) 
"TicketFreeText12" ["s-gensym1292"]=> string(0) "" ["s-gensym1294"]=> 
string(22) "EscalationResponseTime" ["s-gensym1296"]=> int(0) 
["s-gensym1298"]=> string(13) "UnlockTimeout" ["s-gensym1300"]=> 
int(1251708234) ["s-gensym1302"]=> string(15) "TicketFreeTime3" 
["s-gensym1304"]=> string(0) "" ["s-gensym1306"]=> string(11) "ArchiveFlag" 
["s-gensym1308"]=> string(1) "n" ["s-gensym1310"]=> string(15) 
"TicketFreeText3" ["s-gensym1312"]=> string(0) "" ["s-gensym1314"]=> string(14) 
"CustomerUserID" ["s-gensym1316"]=> NULL ["s-gensym1318"]=> string(15) 
"TicketFreeText8" ["s-gensym1320"]=> string(0) "" ["s-gensym1322"]=> string(15) 
"TicketFreeText9" ["s-gensym1324"]=> string(0) "" ["s-gensym1326"]=> string(4) 
"Type" ["s-gensym1328"]=> string(7) "Problem" ["s-gensym1330"]=> string(14) 
"TicketFreeKey7" ["s-gensym1332"]=> string(0) "" ["s-gensym1334"]=> string(11) 
"Responsible" ["s-gensym1336"]=> string(10) "lsmolinski" ["s-gensym1338"]=> 
string(16) "TicketFreeText10" ["s-gensym1340"]=> string(0) "" 
["s-gensym1342"]=> string(13) "ResponsibleID" ["s-gensym1344"]=> int(4) 
["s-gensym1346"]=> string(15) "TicketFreeKey16" ["s-gensym1348"]=> string(0) "" 
["s-gensym1350"]=> string(14) "TicketFreeKey3" ["s-gensym1352"]=> string(0) "" 
["s-gensym1354"]=> string(19) "RealTillTimeNotUsed" ["s-gensym1356"]=> int(0) 
["s-gensym1358"]=> string(7) "GroupID" ["s-gensym1360"]=> int(7) 
["s-gensym1362"]=> string(15) "TicketFreeKey13" ["s-gensym1364"]=> string(0) "" 
["s-gensym1366"]=> string(10) "CustomerID" ["s-gensym1368"]=> NULL 
["s-gensym1370"]=> string(14) "TicketFreeKey1" ["s-gensym1372"]=> string(0) "" 
["s-gensym1374"]=> string(6) "TypeID" ["s-gensym1376"]=> int(1) 
["s-gensym1378"]=> string(8) "Priority" ["s-gensym1380"]=> string(8) "3 normal" 
["s-gensym1382"]=> string(15) "TicketFreeKey12" ["s-gensym1384"]=> string(12) 
"MasterTicket" ["s-gensym1386"]=> string(15) "TicketFreeKey10" 
["s-gensym1388"]=> string(0) "" ["s-gensym1390"]=> string(14) "TicketFreeKey8" 
["s-gensym1392"]=> string(0) "" ["s-gensym1394"]=> string(9) "UntilTime" 
["s-gensym1396"]=> int(0) ["s-gensym1398"]=> string(15) "TicketFreeText1" 
["s-gensym1400"]=> string(0) "" ["s-gensym1402"]=> string(20) 
"EscalationUpdateTime" ["s-gensym1404"]=> int(0) ["s-gensym1406"]=> string(15) 
"TicketFreeTime2" ["s-gensym1408"]=> string(0) "" ["s-gensym14