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:
ata->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:
ata->name('Request' =>
\SOAP:
ata->value(SOAP:
ata->name('PDSInfo'))));
my $result = $soap->call($method => @params);
print "\n";
if ($result->fault){
print $result->faultstring;
}else{
print $result->result;
}
print "\n\n";
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:
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:
\SOAP:
my $result = $soap->call($method => @params);
print "\n";
if ($result->fault){
print $result->faultstring;
}else{
print $result->result;
}
print "\n\n";