[Xml-compile] Beginner's question: How to access secured WS with username and password

Mark Overmeer mark at overmeer.net
Thu Feb 11 12:42:28 GMT 2010


* Tapio.Niva at tieto.com (Tapio.Niva at tieto.com) [100211 11:54]:
> Hello, I tried XML::Compile with wsdl using script like below:
>  
> #!/usr/bin/perl

use strict; use warnings;

> use XML::Compile::WSDL11;     
> use XML::Compile::SOAP11;
> use XML::Compile::Transport::SOAPHTTP;
> use Log::Report mode => 'DEBUG';
> my $nodewsdl = "NodeBean.wsdl";
> my $wsdl = XML::Compile::WSDL11->new($nodewsdl);
> my $server = 'user:password\@localhost';
> my $call = $wsdl->compileClient( operation=>'getNodes',server=>$server );
> my %request = ('filter'=>{'condition'=>{'name'=>'name','operator'=>
> 'LIKE','value'=>'VJHASW%'}});
> my ($nodes, $trace) = $call->(%request);

You do not need '' left of a fat-comma (=>)
Here you use %request as an array: array first packed in a HASH and
then unpacked in the call.  You can also pass \%request to call, to
avoid that.  Or like this:

  my ($nodes, $trace) = $call->(filter => {condition =>
     {name=> 'name', operator => 'LIKE', value => 'VJHASW%'}} );

> Something is obviously wrong in my script, because the result was
> "received 401 Unauthorized",

Olivier is right in his answer.
-- 
Regards,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list