HI guys.
Can I know is that any way to use webservice to change cmdb (config item)-for example change the model number of the config item (computer) ?
Any guide for this on using soap http because i am quite new on it (Beside the otrs documentation)
Regards
Brian
Config item with webservice
-
- Znuny newbie
- Posts: 1
- Joined: 08 Jun 2012, 10:07
- Znuny Version: 3.1.6
- Real Name: Grégoire
- Company: SquidSolutions
Re: Config item with webservice
Hi,
OTRS is shipped with a very clever RPC interface: /bin/cgi-bin/rpc.pl, which doesn't handle CMDB by default. But it is very easy to patch it, like this post explains: http://www.iniy.org/?p=20. This post explains how to enable RPC authentication in SystemConfig, don't forget this part ! So what I did for a (successfull) try was:
- Copy rpc.pl to itsmrpc.pl
- Edit itsmrpc.pl:
"+" lines are the code I added. Now I can use http://myotrssite/itsmrpc.pl within my perl/php/java/whatever code to access OTRS::ITSM functions. To discover these functions, go to your OTRS root directory, and type:
Here is an example for retrieving all CIs for a specific CI Class:
OTRS is shipped with a very clever RPC interface: /bin/cgi-bin/rpc.pl, which doesn't handle CMDB by default. But it is very easy to patch it, like this post explains: http://www.iniy.org/?p=20. This post explains how to enable RPC authentication in SystemConfig, don't forget this part ! So what I did for a (successfull) try was:
- Copy rpc.pl to itsmrpc.pl
- Edit itsmrpc.pl:
Code: Select all
use Kernel::System::CustomerCompany;
use Kernel::System::Ticket;
use Kernel::System::LinkObject;
+ use Kernel::System::ITSMConfigItem;
[...]
$CommonObject{TicketObject} = Kernel::System::Ticket->new(%CommonObject);
$CommonObject{LinkObject} = Kernel::System::LinkObject->new(%CommonObject);
+ $CommonObject{ITSMConfigItem} = Kernel::System::ITSMConfigItem->new(%CommonObject);
Code: Select all
perldoc Kernel::System::ITSMConfigItem
Code: Select all
#!/usr/bin/perl
use strict;
use Data::Dumper;
use SOAP::Lite;
my $User='user';
my $Pw='pass';
my $RPC = new SOAP::Lite(proxy => 'http://myotrssite/otrs/itsmrpc.pl',uri => 'http://myotrssite/Core');
my $res = $RPC->Dispatch($User,$Pw,'ITSMConfigItem','ConfigItemResultList',ClassID => "147");
die $res->fault->{faultstring} if $res->fault;
print Dumper ($res->result)."\n";
-
- Znuny superhero
- Posts: 656
- Joined: 24 Feb 2012, 03:58
- Znuny Version: LTS and Features
- Real Name: Mo Azfar
- Location: Kuala Lumpur, MY
- Contact:
Re: Config item with webservice
hi..i trying to follow your explanation..grrrreg wrote:Hi,
OTRS is shipped with a very clever RPC interface: /bin/cgi-bin/rpc.pl, which doesn't handle CMDB by default. But it is very easy to patch it, like this post explains: http://www.iniy.org/?p=20. This post explains how to enable RPC authentication in SystemConfig, don't forget this part ! So what I did for a (successfull) try was:
- Copy rpc.pl to itsmrpc.pl
- Edit itsmrpc.pl:"+" lines are the code I added. Now I can use http://myotrssite/itsmrpc.pl within my perl/php/java/whatever code to access OTRS::ITSM functions. To discover these functions, go to your OTRS root directory, and type:Code: Select all
use Kernel::System::CustomerCompany; use Kernel::System::Ticket; use Kernel::System::LinkObject; + use Kernel::System::ITSMConfigItem; [...] $CommonObject{TicketObject} = Kernel::System::Ticket->new(%CommonObject); $CommonObject{LinkObject} = Kernel::System::LinkObject->new(%CommonObject); + $CommonObject{ITSMConfigItem} = Kernel::System::ITSMConfigItem->new(%CommonObject);
Here is an example for retrieving all CIs for a specific CI Class:Code: Select all
perldoc Kernel::System::ITSMConfigItem
Code: Select all
#!/usr/bin/perl use strict; use Data::Dumper; use SOAP::Lite; my $User='user'; my $Pw='pass'; my $RPC = new SOAP::Lite(proxy => 'http://myotrssite/otrs/itsmrpc.pl',uri => 'http://myotrssite/Core'); my $res = $RPC->Dispatch($User,$Pw,'ITSMConfigItem','ConfigItemResultList',ClassID => "147"); die $res->fault->{faultstring} if $res->fault; print Dumper ($res->result)."\n";
when i execute a script to retrieving all CI,
i got an error "No Such Object ITSMConfigItem".
refer screenshot..
any idea??

My Github
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This
Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This
Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
-
- Znuny newbie
- Posts: 58
- Joined: 17 Aug 2012, 06:11
- Znuny Version: 3.3.x
- Real Name: Cornelius Jackson
Re: Config item with webservice
I followed the above instructions, and used ConfigItemAdd function . I was able to create new ConfigItem (data got inserted into ConfigItem Table). But how to accomidate the rest attributes of ConfigItem?
-
- Znuny newbie
- Posts: 1
- Joined: 17 Oct 2012, 14:56
- Znuny Version: 3.2.1
- Real Name: Daniel Alejandro Zuleta Zahr
- Company: Neosecure
Re: Config item with webservice
Well, first i want to thanks grrrreg for the head up on how to achive the comunication between RPC and the ITSM modules. I was able to create an importation script for my CMDB following that guideline.
Crons, i run into the same problem, the way to solve it is by using the function VersionAdd after you create the ConfigItem.
The definition of the function is on $OTRS/Kernel/System/ITSMConfigItem/Version.pm
Good luck
Crons, i run into the same problem, the way to solve it is by using the function VersionAdd after you create the ConfigItem.
The definition of the function is on $OTRS/Kernel/System/ITSMConfigItem/Version.pm
Good luck
-
- Znuny newbie
- Posts: 58
- Joined: 17 Aug 2012, 06:11
- Znuny Version: 3.3.x
- Real Name: Cornelius Jackson
Re: Config item with webservice
What array for XMLData does it accepts here:?
I need example of $ArrayHashRef. I tried this:
Code: Select all
my $VersionID = $ConfigItemObject->VersionAdd(
ConfigItemID => 123,
Name => 'The Name',
DefinitionID => 1212,
DeplStateID => 8,
InciStateID => 4,
XMLData => $ArrayHashRef, # (optional)
UserID => 1,
);
Code: Select all
my $ArrayHashRef = {
'CPU' => 'Intel',
'Model' => 'HP',
'Vendor'=> 'Vendor Name',
'Type'=> 'Laptop',
'Description'=> 'Description Goes here',
'Owner' => '',
'SerialNumber' =>'999999',
'OperatingSystem' =>'Fedora',
'HardDisk'=>'Segate',
'Capacity'=>'500GB',
'Ram'=>'4GB DDR3',
'FQDN'=>'test.test',
'NIC'=>'Adapter 990099',
'IPoverDHCP'=>'Yes',
'GraphicAdapter'=>'',
'WarrantyExpirationDate'=>'2012-12-12',
'InstallDate'=>''
};
OTRS 3.3.x, Ubuntu, MySql 5.5