SOAP::Lite with Microsoft Project Server PDS.WSDL

Discussion in 'Perl Misc' started by ashgromnies, Apr 24, 2006.

  1. ashgromnies

    ashgromnies Guest

    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";
     
    ashgromnies, Apr 24, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aaron Brady

    SQL, lite lite lite

    Aaron Brady, Dec 29, 2008, in forum: Python
    Replies:
    15
    Views:
    792
    Aaron Brady
    Jan 1, 2009
  2. Andrew Tkachenko

    SOAP::Lite +wsdl

    Andrew Tkachenko, Mar 5, 2005, in forum: Perl Misc
    Replies:
    0
    Views:
    160
    Andrew Tkachenko
    Mar 5, 2005
  3. spacegoat
    Replies:
    2
    Views:
    192
    spacegoat
    Nov 6, 2005
  4. John Bokma

    SOAP::Lite + wsdl misunderstanding?

    John Bokma, Jan 24, 2007, in forum: Perl Misc
    Replies:
    0
    Views:
    132
    John Bokma
    Jan 24, 2007
  5. J. Gleixner
    Replies:
    0
    Views:
    413
    J. Gleixner
    Feb 12, 2008
Loading...

Share This Page