【问题标题】:How do I integrate NTLM authentication with Perl's SOAP::Lite module?如何将 NTLM 身份验证与 Perl 的 SOAP::Lite 模块集成?
【发布时间】:2009-06-18 16:28:33
【问题描述】:

此 Perl 代码适用于对 ASP.NET Web 服务的匿名访问,但是当打开集成安全性时,该服务会返回 401 错误。我想我需要将 NTLM 模块与 SOAP::Lite 结合使用,但不清楚如何这样做。这些组件如何集成?

use SOAP::Lite;
use strict;

my $proxy = "http://localhost:28606/WebService.asmx";

my $method_name = "HelloWorld";
my $uri = "http://tempuri.org/";
my $methodAction = $uri . $method_name;

my $soap = SOAP::Lite
    ->uri( $uri )
    ->proxy( $proxy )
    ->on_action(sub{ $methodAction; });

my $method = SOAP::Data->name($method_name)->attr({xmlns=>$uri});
my $result = $soap->call($method);

print $result->result();

【问题讨论】:

  • 究竟什么是“集成安全”?

标签: perl soap ntlm


【解决方案1】:

如果你这样做,你可以让 SOAP::Lite 打印一些调试输出:

use SOAP::Lite +trace;

而不是

use SOAP::Lite;

编辑:

好的,我想我现在明白了。打开集成安全功能使 IIS 需要 NTLM 身份验证。有一个thread over at perlmonks.org 似乎揭示了答案。

【讨论】:

    【解决方案2】:

    我有点晚了,但我刚刚遇到了同样的问题。试试这个:

    use LWP::UserAgent;
    use LWP::Debug;
    use SOAP::Lite on_action => sub { "$_[0]$_[1]"; };
    import SOAP::Data 'name', 'value';
    our $sp_endpoint = 'http://sp.example.com/sites/mysite/_vti_bin/lists.asmx';
    our $sp_domain = 'sp.example.com:80';
    our $sp_username = 'DOMAIN\username';
    our $sp_password = 'xyz';
    
    if ($debug) {
        LWP::Debug::level('+');
        SOAP::Lite->import(+trace => 'all');
    }
    
    my @ua_args = (keep_alive => 1);
    my @credentials = ($sp_domain, "", $sp_usernam, $sp_password);
    my $schema_ua = LWP::UserAgent->new(@ua_args);
    $schema_ua->credentials(@credentials);
    $soap = SOAP::Lite->proxy($sp_endpoint, @ua_args, credentials => \@credentials);
    $soap->schema->useragent($schema_ua);
    $soap->uri("http://schemas.microsoft.com/sharepoint/soap/");
    

    【讨论】:

      猜你喜欢
      • 2011-10-08
      • 1970-01-01
      • 2018-09-28
      • 2010-10-02
      • 1970-01-01
      • 1970-01-01
      • 2021-02-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多