Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

SOAP::Lite login setup

by diamondsandperls (Beadle)
on Feb 01, 2013 at 16:57 UTC ( #1016587=perlquestion: print w/ replies, xml ) Need Help??
diamondsandperls has asked for the wisdom of the Perl Monks concerning the following question:

Wondering why my login is not working with SOAP::Lite hoping someone can shed some light.



#!/usr/bin/perl use SOAP::Lite 'trace', 'debug'; use Data::Dumper; $Data::Dumper::Indent=1; use HTTP::Cookies; use strict; use warnings; #SETTING UP SOAP my $soap = SOAP::Lite -> soapversion('1.2') -> envprefix('soap12') -> proxy('https://url2archer?wsdl', cookie_jar => HTTP::Cookies->n +ew(ignore_discard => 1)); my $data = SOAP::Data->new(); $data->uri('https://url2archer?wsdl'); my $session = $data->name('CreateUserSession'); my @params = ( SOAP::Data->name('userName')->value('username'), SOAP::Data->name('pin')->value(10000), SOAP::Data->name('password')->value('password') ); my $result = $soap->call($session => @params)->result; #print Dumper($result); my $token = $soap->sessionToken(); #print Dumper ($token); =begin #DIGGING TOKEN INFO my $token = $soap->sessionToken(); if ($token->fault) { die $token->faultstring; } print $token =cut

Comment on SOAP::Lite login setup
Download Code
Re: SOAP::Lite login setup
by Anonymous Monk on Feb 01, 2013 at 23:07 UTC
Re: SOAP::Lite login setup
by Khen1950fx (Canon) on Feb 02, 2013 at 02:09 UTC
    FWIW: Here's my stab at it:
    #!/usr/bin/perl use strict; use warnings; use HTTP::Cookies; use SOAP::Lite ( +trace => 'all', maptype => {} ); use Data::Dumper::Concise; $Data::Dumper::Indent = 1; my $soap = SOAP::Lite->proxy( 'https://url2archer?wsdl', cookie_jar => HTTP::Cookies->new( ignore_discard => 1 ) ); my $session = SOAP::Data->name('CreateUserSession') ->attr( { xmlns => 'https://url2archer.com/' } ); my @params = ( SOAP::Data->name('userName')->value('username'), SOAP::Data->name('pin')->value(10000), SOAP::Data->name('password')->value('password'), ); my %keyHash = %{ $soap->call( $session => @params )->body->{'CreateUserSession'} } +; foreach my $k ( keys %keyHash ) { print "$k = $keyHash{$k}"; } =begin DIGGING TOKEN INFO my $token = $soap->sessionToken(); if ($token->fault) { die $token->faultstring; } print $token =cut
    The only problem that I encountered was that I couldn't connect to your site without the proper credentials, obviously.

      Thanks for the response getting the following error. Can't use an undefined value as a HASH reference at line 33. oh this is on an intranet so there is no way to hit the url for ya thanks for the help though. Any idea on what the error could be?

      also noticed the below error happens first.

      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error

        There is nothing anyone can do to help you with unknowable server, unknowable wsdl, and unknowable error -- 500 means generic somethings wrong, useless for making suggestions

        I gave you my SOAP debugging tips, try to apply them, then you'll have some idea where you're going wrong with the SOAP request you're sending

        Maybe this short SOAP::Lite tutorial can help you How to Call a .NET-based Web Service Using the SOAP::Lite Perl Library

        SOAP::Lite WSDL support is easily broken, SOAP is very painful (I hate it), but it appears you're forced to deal with SOAP, so I urge you to switch to XML::Compile

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1016587]
Front-paged by Lotus1
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2014-07-28 10:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (196 votes), past polls