2009-06-18 2 views
4

이 Perl 코드는 ASP.NET 웹 서비스에 대한 익명 액세스와 함께 작동하지만 통합 보안이 켜져 있으면 401 오류가 반환됩니다. NTLM 모듈을 SOAP :: Lite와 함께 사용해야한다고 생각합니다.하지만 그렇게하는 방법이 명확하지 않습니다. 이러한 구성 요소를 어떻게 통합 할 수 있습니까? 당신이 경우에NTLM 인증을 Perl의 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(); 
+0

"통합 보안"이란 정확히 무엇입니까? – innaM

답변

2

당신은 SOAP :: Lite는 디버깅 출력을 인쇄 할 수 있습니다 :

use SOAP::Lite +trace; 

대신

use SOAP::Lite; 

을 편집 :

OK, 나는 생각 지금 사세요. 통합 보안 기능을 켜면 IIS에서 NTLM 인증이 필요합니다. 대답을 나타내는 것으로 보이는 thread over at perlmonks.org이 있습니다.

1

조금 늦었지만 같은 문제에 직면했습니다. 사용해보기 :

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/"); 
관련 문제