#!/bin/perl
use LWP::UserAgent;
use LWP::Debug;
use Data::Dumper;
use SOAP::Lite on_action => sub { "$_[0]$_[1]"; };
import SOAP::Data 'name', 'value';
our $sp_endpoint = 'http://in.nokia.com/sites/s40configmanag/_vti_bin/copy.asmx';
our $sp_domain = 'NOE';
our $sp_username = 'USERNAME';
our $sp_password = 'PASSWD';
$debug = 1;
if ($debug) {
LWP::Debug::level('+');
SOAP::Lite->import(+trace => 'all');
}
my @ua_args = (keep_alive => 1);
my @credentials = ($sp_domain, "", $sp_username, $sp_password);
my $schema_ua = LWP::UserAgent->new(@ua_args);
$schema_ua->credentials(@credentials);
$soap = SOAP::Lite->proxy($sp_endpoint, @ua_args, credentials => \@credentials);
$soap->schema->useragent($schema_ua);
$soap->uri("http://schemas.microsoft.com/sharepoint/soap/");
$lists = $soap->GetListCollection();
quit(1, $lists->faultstring()) if defined $lists->fault();
sub lists_getid
{
my $title = shift;
my @result = $lists->dataof('//GetListCollectionResult/Lists/List');
foreach my $data (@result) {
my $attr = $data->attr;
return $attr->{ID} if ($attr->{Title} eq $title);
}
return undef;
}
sub lists_getitems
{
my $listid = shift;
my $in_listName = name('listName' => $listid);
my $in_viewName = name('viewName' => '');
my $in_rowLimit = name('rowLimit' => 99999);
my $call = $soap->GetListItems($in_listName, $in_viewName, $in_rowLimit);
quit(1, $call->faultstring()) if defined $call->fault();
return $call->dataof('//GetListItemsResult/listitems/data/row');
}
my $list_id = lists_getid('TB104 UI config report');
print "List ID is: $list_id\n";
my @items = lists_getitems($list_id);
foreach my $data (@items) {
my $attr = $data->attr;
print Dumper($attr);
}
####
joacoimb@farem001 ui_config_tools $ perl ./webdav_interface2.pl
LWP::UserAgent::new: ()
SOAP::Lite::new: ()
LWP::UserAgent::new: ()
SOAP::Transport::HTTP::Client::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
LWP::UserAgent::new: ()
SOAP::Schema::new: ()
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: GetListCollection
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0xb4f290)
SOAP::Transport::HTTP::Client::send_receive: POST http://in.nokia.com/sites/s40configmanag/_vti_bin/copy.asmx HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 457
Content-Type: text/xml; charset=utf-8
SOAPAction: http://schemas.microsoft.com/sharepoint/soap/GetListCollection
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: POST http://in.nokia.com/sites/s40configmanag/_vti_bin/copy.asmx
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::http::request: Keep the http connection to in.nokia.com:80
LWP::UserAgent::request: Simple response: Found
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET https://in.nokia.com/sites/s40configmanag/_vti_bin/copy.asmx
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::UserAgent::request: Simple response: Internal Server Error
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0xe5db90)
SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to in.nokia.com:443 (Bad service '8080/')
Content-Type: text/plain
Client-Date: Mon, 24 Jan 2011 11:07:33 GMT
Client-Warning: Internal response
500 Can't connect to in.nokia.com:443 (Bad service '8080/')
SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
500 Can't connect to in.nokia.com:443 (Bad service '8080/') at ./webdav_interface2.pl line 37
SOAP::Parser::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Transport::HTTP::Client::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Transport::DESTROY: ()
SOAP::Schema::DESTROY: ()
SOAP::Serializer::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Parser::DESTROY: ()
SOAP::Transport::DESTROY: ()
SOAP::Serializer::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Lite::DESTROY: ()
SOAP::Lite::DESTROY: ()
joacoimb@farem001 ui_config_tools $
####
LWP::UserAgent::request: Simple response: Internal Server Error
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0xe5db90)
SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to in.nokia.com:443 (Bad service '8080/')