#!/usr/bin/perl use lib qw( \\crdhome\shares\TechHome\dbuild\ourperl ); use SOAP::Lite; use LWP::UserAgent; use LWP::Debug; LWP::Debug::level('+'); SOAP::Lite->import(+trace => 'all'); our $l_endpoint = 'http://localhost:8080/RelengWeb/MachineActivityWSPort'; our $l_domain = 'DOMAIN'; our $l_username = 'DOMAIN\\user'; our $l_password = 'userPassword'; my @ua_args = (keep_alive => 1); my @credentials = ($l_domain, "", $l_username, $l_password); my $schema_ua = LWP::UserAgent->new(@ua_args); $schema_ua->credentials(@credentials); print "\nBuilding proxy\n\n"; $soap = SOAP::Lite->proxy($l_endpoint, @ua_args, credentials => \@credentials); print "\nSetting URI\n\n"; $soap->uri("$l_endpoint"); print "\nSetting user agent\n\n"; $soap->useragent($schema_ua); print "\nTrying to connect to MachineActivity Port\n\n"; my $service = $soap->service("$l_endpoint" . "?wsdl"); print 'Successfully connected.'; sub SOAP::Transport::HTTP::Client::get_basic_credentials { return ('user' => 'password') }; #### LWP::UserAgent::new: () Building proxy SOAP::Transport::new: () SOAP::Serializer::new: () SOAP::Deserializer::new: () SOAP::Parser::new: () SOAP::Lite::new: () LWP::UserAgent::new: () SOAP::Transport::HTTP::Client::new: () Setting URI Setting user agent SOAP::Lite::call: () SOAP::Serializer::envelope: () SOAP::Serializer::envelope: useragent LWP::UserAgent=HASH(0x1030cec4) SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () Cannot encode 'domain' element as 'hash'. Will be encoded as 'map' instead SOAP::Data::new: () SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x1035e644) SOAP::Transport::HTTP::Client::send_receive: POST http://localhost:8080/RelengWe b/MachineActivityWSPort HTTP/1.1 Accept: text/xml Accept: multipart/* Content-Length: 1784 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://localhost:8080/RelengWeb/MachineActivityWSPort#useragent" 711GETHEAD180libwww-perl/5.8051DOMAIN\useruserPassword LWP::UserAgent::request: () LWP::UserAgent::send_request: POST http://localhost:8080/RelengWeb/MachineActivi tyWSPort LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::http::request: Keep the http connection to localhost:8080 LWP::UserAgent::request: Simple response: Unauthorized SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x1020d39c) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 401 Unauthorized Date: Mon, 12 Oct 2009 16:11:55 GMT Server: Apache-Coyote/1.1 WWW-Authenticate: NTLM Content-Length: 0 Client-Date: Mon, 12 Oct 2009 16:11:56 GMT Client-Peer: 127.0.0.1:8080 Client-Response-Num: 1 Client-Warning: Unsupported authentication scheme 'ntlm' 401 Unauthorized at test.pl line 29 SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Transport::HTTP::Client::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Parser::DESTROY: () SOAP::Transport::DESTROY: () SOAP::Serializer::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Deserializer::DESTROY: () SOAP::Lite::DESTROY: ()