On 08/20/2014 07:30 AM, eran meiri wrote:
> Hello everyone.
> I have a problem and I am seeking for help.
> 
> I need to access Citrix Odata api and for some reason I can't.
> when I try to access the URL with my browser I get a prompt to the
> domain\user an password.
> when I enter them I get the data I need but it doesn't work with the Perl
> script.
> 
> I have tried it with LWP:
> my $url = "http://192.168.100.41/Citrix/Monitor/OData/v1/Methods/";;
> my $req = HTTP::Request->new(GET => $url );
> my $ua = LWP::UserAgent->new(keep_alive=>1);
> $ua->credentials("192.168.100.41:80", "<REAL-M>","lyncent.com\\Citrix" =>
> 'Rel0aded1');


Did you try just parsing the responses and testing it with telenet and lynx?


I could be wrong, but this has nothing to do with SOAP or LWP directly.
 Look at the responses and see where the server authentication is failing.

print STDERR is your friend.

Ruben


> 
> my $response = $ua->request( $req );
> 
> if ($response->is_success) {
>     print $response->content;
> }
> else {
>     print $response->status_line, "\n";
> }
> 
> and I have tried it with SOAP:
> 
> my $api_host = "
> http://192.168.100.41/Citrix/Monitor/OData/v1/Methods/Catalogs";;
> my $api_user = "lyncent.com\\Citrix";
> my $api_pass = "Rel0aded1";
> my $authClient = SOAP::Lite->service($api_host );
> my $result2 = $authClient->performLogin($api_user, $api_pass);
> print $result2->{result};
> 
> or again with soap :
> my $service = SOAP::Lite
>               -> service('
> http://192.168.100.41/Citrix/Monitor/OData/v1/Methods/Catalogs');
> my $AuthHeader = SOAP::Header->new(
>   name =>'AuthenticationHeader',
>   attr => { xmlns => "192.168.100.41" },
>   value => {username => 'lyncent.com\Citrix', password => 'Rel0aded1' },
> );
> my $result = $service->GetIt($AuthHeader);
> 
> 
> all of these options give me the same result : 401 unauthorized
> the domain , user and password are all correct since I can access the URL
> from the browser.
> 
> H E L P
> 
> 
> 
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
> 

_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to