SOAP::Lite with Microsoft Project Server PDS.WSDL

A

ashgromnies

I'm having some particular trouble with this, which mainly seems to
stem from not being able to supply the proper cookie to the request.

Here's the code I've worked out:

my $sns = 'http://tempuri.org/action';
my $method =
SOAP::Data->name('CMain.SoapXMLRequest')->attr({xmlns=>'http://tempuri.org/message'});

my $cookie_jar = HTTP::Cookies->new(
file => "/var/home/chris/lwp_cookies.dat",
autosave => 1,
ignore_discard => 1
);

$cookie_jar->load('/var/home/chris/lwp_cookies.dat');

sub SOAP::Transport::HTTP::Client::get_basic_credentials {
return 'DOMAIN\user' => 'password'; #note: censored for obvious
reasons
}



use LWP;
my $browser = new LWP::UserAgent(keep_alive=>1);
$browser->agent('Mozilla/4.0 (compatible; MSIE 5.5; Windows NT
5.0)');
$browser->cookie_jar($cookie_jar);
my $req = HTTP::Request->new(GET =>
"http://ADDRESS/ProjectServer/LGNBSC.ASP");
$cookie_jar->add_cookie_header($req);
$browser->credentials('ADDRESS:80', '', "DOMAIN\\user",
'password'); # censored, duh

my $res = $browser->request($req);
$res = $browser->request($req);



my $soap = SOAP::Lite
-> uri($sns)
-> on_action( sub{ join '/', $sns, $_[1] })
-> proxy('http://ADDRESS/ProjectServer/PDS.WSDL',keep_alive
=> 1,cookie_jar => $cookie_jar);


my $cookie = $cookie_jar->extract_cookies($res);

my $content = $cookie->{_content};
my @items = split('\r',$content);
$content = $items[2];
$content = substr($content,5,36);

my @params = ($content, SOAP::Data->name('Request' =>
\SOAP::Data->value(SOAP::Data->name('PDSInfo'))));
my $result = $soap->call($method => @params);

print "\n";

if ($result->fault){
print $result->faultstring;
}else{
print $result->result;
}

print "\n\n";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top