fritz1968 has asked for the wisdom of the Perl Monks concerning the following question:
The WSDL that I use was enhanced with security. (We're the lowest test environment, so it was inevitable). I had my WSDL connector working like a charm before the "enhancement", but now I am at a loss on how to pass the userID and password via a HTTP header. Here is my code thus far:
#!/usr/bin/perl ############################# # Written By: Frank Friedman # Email: frank.e.friedman@jpmchase.com # Date: Aug. 15, 2012 # Summary: ############################# use Data::Dumper; use SOAP::Lite +trace => 'debug'; #use SOAP::Lite; #use JPMC::PIDM; #use Getopt::Std; #use File::Spec; #use Log::Log4perl qw(get_logger :no_extra_logdie_message); use jpmc_wsdl; #my $proxy = 'http://TEST:testing@myid-dev.company.net/rjam-request-se +rvice/svc/RequestService/3?wsdl'; my $proxy = 'http://myid-dev.company.net/rjam-request-service/svc/Requ +estService/3?wsdl'; my $xmlns = "http://myid.company.net/request/service/3"; my $provider = "homeFolderWin"; my $maxLockedTimes=200; my $startingRecord = "1"; my $recordsToRetrieve = "1"; ## Local variables my $action = "setBestMatch"; my $state = "PLACED"; my $recordCount=0; my $response = fetchandlock({ proxy => $proxy, xmlns => $xmlns, first => $startingRecord, max => $recordsToRetrieve, action => $action, state => $state, }); if($response->fault) { $tmp_string = $response->faultstring(); exit; } #=============================== # Password = test = VEVTVElORzp0ZXN0 # userID = TESTING sub fetchandlock { my $zID="TEST"; my $zPW="VEVTVElORzp2ZXN0"; #base 64 encoding my ($args) = @_; # IIS web services expect / as a separator for uri and method. my $lite = SOAP::Lite->new()->on_action(sub { join '/', @_ } ) ->proxy($args->{proxy}); my $response = $lite->call( SOAP::Data->name('fetchAndLock') ->attr({ 'xmlns', $args->{xmlns}}), SOAP::Data->name("first")->value($args->{first}), SOAP::Data->name("max")->value($args->{max}), SOAP::Data->name("action")->value($args->{action}), SOAP::Data->name("state")->value($args->{state}), ); return $response; }
I can easily connect to the WSDL if I put the userID and password in the proxy (note the commented out "proxy" line near the top).
any insight on how to do it via a SOAP call? I know it goes in my "fetchandLock" subroutine, but where and how do I code it?
any help/insight/suggestions/etc... would be greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: soap::lite and authorization
by Anonymous Monk on Aug 28, 2012 at 02:21 UTC | |
by fritz1968 (Sexton) on Aug 29, 2012 at 14:26 UTC | |
by Anonymous Monk on Aug 30, 2012 at 11:37 UTC | |
by fritz1968 (Sexton) on Aug 30, 2012 at 19:21 UTC | |
by Anonymous Monk on Aug 30, 2012 at 19:43 UTC |