#!/usr/bin/perl -w
use SOAP::Lite trace=>'debug';
#use SOAP::Lite;
use Data::Dumper;
use strict;
# Perl sub routine to call Service Desk login method
# and specify Service Desk Web Services end point
sub login_get_SID {
# Edit $server, $user and $pw as needed.
my $server = '192.168.1.152:8180';
my $endpoint = '/axis/services/USD_R11_WebService?WSDL';
my $user = ''; #user id
my $pw = ''; #user pwd
my $wsdl = 'http://' . $server . $endpoint;
my $service = SOAP::Lite->service($wsdl);
my $sid = $service->login($user, $pw);
return ($service, $sid);
}
# Always a best practice to call logout() when done
sub logout {
my ($service, $sid) = @_;
$service->logout($sid)
}
# method to retrieve all Incident Areas
sub retrieveCategories
{
my ($service, $sid, $service_name) = @_;
my $method = SOAP::Data->uri('http://www.ca.com/UnicenterServicePlus/ServiceDesk')->name('doSelect');
# Attributes for object to be created can be pulled
# from majic files.
my @params = ( SOAP::Data->name("sid" => $sid),
SOAP::Data->name("objectType" => 'pcat'),
SOAP::Data->name("whereClause" => "sym like 'Appl%'"),
SOAP::Data->name("maxRows" => "1"),
SOAP::Data->name("attributes" =>
\SOAP::Data->value(
SOAP::Data->name("string" => "sym"),
SOAP::Data->name("string" => 'description')
)
),
);
#print "dumper: ".Dumper(@params)."\n";
my $result = $service->call($method => @params);
print "----result method call ---\n".$result->result."----- end result ----\n";
print "----valueof method call ----\n".$result->valueof('//AttrName[1]')."----- end valueof ----\n";
return ($result);
}
# Main calls
my ($service, $sid) = login_get_SID();
retrieveCategories($service, $sid);
logout($service, $sid);
####
----result method call ---
pcat:5103
sym
Applications
description
Applications
----- end result ----
----valueof method call ----
----- end valueof ----
##
##
SOAP::Transport::HTTP::Client::send_receive: POST http://192.168.1.152:8180/axis/services/USD_R11_WebService HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 713
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
ServiceDeskUn1c3nt3r
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Connection: close
Date: Mon, 15 Sep 2008 18:58:44 GMT
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Client-Date: Mon, 15 Sep 2008 18:58:45 GMT
Client-Peer: 192.168.1.152:8180
Client-Response-Num: 1
639087957
SOAP::Transport::HTTP::Client::send_receive: POST http://192.168.1.152:8180/axis/services/USD_R11_WebService HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/0.710.05
Content-Length: 1000
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
639087957pcatsym like 'Appl%'1symdescription
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Connection: close
Date: Mon, 15 Sep 2008 18:58:44 GMT
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Client-Date: Mon, 15 Sep 2008 18:58:46 GMT
Client-Peer: 192.168.1.152:8180
Client-Response-Num: 1
<?xml version="1.0" encoding="UTF-8"?>
<UDSObjectList>
<UDSObject>
<Handle>pcat:5103</Handle>
<Attributes>
<Attribute DataType="2002">
<AttrName>sym</AttrName>
<AttrValue>Applications</AttrValue>
</Attribute>
<Attribute DataType="2002">
<AttrName>description</AttrName>
<AttrValue>Applications</AttrValue>
</Attribute>
</Attributes>
</UDSObject>
</UDSObjectList>
Use of uninitialized value in concatenation (.) or string at C:\dev\usdservices\perlmonk_sample.pl line 54.
SOAP::Transport::HTTP::Client::send_receive: POST http://192.168.1.152:8180/axis/services/USD_R11_WebService HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/0.710.05
Content-Length: 648
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
639087957
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Connection: close
Date: Mon, 15 Sep 2008 18:58:46 GMT
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Client-Date: Mon, 15 Sep 2008 18:58:47 GMT
Client-Peer: 192.168.1.152:8180
Client-Response-Num: 1