My Goal is to create a ticket (and add some Dynamic Fields)
I have the following in my SOAP call 'CustomerID' => $CustomerID,
Code: Select all
<?
error_reporting(E_ALL);
# Please define the connection information here:
$url = "http://1.1.1.1/otrs/nph-genericinterface.pl/Webservice/Data/";
$username = "root";
$title = "My Test Ticket via SOAP and PHP";
$from = "me@myemail.com";
$NameSpace = 'Webste';
$CustomerID = "123456";
$Queue = "Postmaster";
$Operation = "TicketCreate";
//attachments
// Read in our file attachment
$attachment = file_get_contents('attachment.txt');
$encoded = base64_encode($attachment);
$attached = chunk_split($encoded);
$contenttype = "text/plain; charset=utf8";
$client = new SoapClient(null, array('location' =>
$url,
'uri' => "CORE",
'trace' => 1,
'style' => SOAP_RPC,
'use' => SOAP_ENCODED));
$msg=array(new SoapParam('USERNAME', "UserLogin"),
new SoapParam('PASSWORD', "Password"),
new SoapParam(Array(
'CustomerUser'=> 'me@email.com,
'ID'=> '1',
'UserID'=> '1',
'PriorityID' => '2',
'Queue' => 'Postmaster',
'State' => 'new',
'Title' => 'Hello',
'CustomerID' => $CustomerID,
'Queue' => $Queue,
'State' => 'new',
'PriorityID' => 3
), 'ns1:Ticket'),
new SoapParam(Array(
'CustomerID'=> 1,
'Body' => 'some body',
'ContentType' => 'text/plain; charset=utf8',
'Subject' => 'some subject',
'TimeUnit' => '1',
'TimeUnits' => 'minutes',
'CustomerID', '8',
'CustomerUser', '9',
'OwnerID' , '10',
'UserID', '11'
), 'ns1:Article'),
new SoapParam(Array(
'Name' => 'streamtest',
'Value' => 'OK',
), 'ns1:DynamicField'),
new SoapParam(Array(
'Content' => $attached,
'ContentType' => $contenttype,
'Filename' => 'Attatchment.txt'
), 'ns1:Attachment')
);
$answer = $client->__soapCall('TicketCreate',$msg);
?>
Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers in /home/tl/otrs/make2.php:67
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://172.30.0...', 'CORE#TicketCrea...', 1, 0)
#1 /home/tl/otrs/make2.php(67): SoapClient->__soapCall('TicketCreate', Array)
#2 {main}
thrown in /home/tl/otrs/make2.php on line 67