Hi,
I am trying to get access to a sharepoint webpage from Unix.
This is the code that I am using to do that, without my username and passwd, everything is as it shoud be.
#!/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 => \@cre
+dentials);
$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_rowLi
+mit);
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);
}
This is my output:
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(0xb4f2
+90)
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/GetListCollec
+tion
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http:/
+/www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xm
+lsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema
+" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmln
+s:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><GetLis
+tCollection xmlns="http://schemas.microsoft.com/sharepoint/soap/" xsi
+:nil="true" /></soap:Body></soap:Envelope>
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: POST http://in.nokia.com/sites/s40config
+manag/_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/s40config
+manag/_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(0xe5d
+b90)
SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to in.n
+okia.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 ./webda
+v_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 $
I am concerned about these 3 lines here:
LWP::UserAgent::request: Simple response: Internal Server Error
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0xe5d
+b90)
SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to in.n
+okia.com:443 (Bad service '8080/')
Any ideas why am I getting these errors?
many thanks,
Joao
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.