#subroutine to login to webservice
sub usdLogin {
my ($service, $sid) = eval {
my $wsdl = 'http://' . USD_Server . USD_Endpoint;
my $srv = SOAP::Lite->uri(USD_URI)->service($wsdl);
my $id = $srv->login(USD_USER, USD_PWD);
if($id->fault) {
printLog("ERROR","$0::".chomp($id->faultcode));
printLog("ERROR","$0::".chomp($id->faultstring));
printLog("ERROR","$0::".chomp($id->faultactor));
return 0;
}
return ($srv, $id);
};
if ($@) {
printLog("ERROR","$0::$@");
return exit 1;
}
return ($service, $sid);
}
####
#here is my trace output. Ideally, I would love to capture
#the faultcode, faultstring and ErrorMessage
ServiceDeskdefault1
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Connection: close
Date: Fri, 19 Sep 2008 20:14:28 GMT
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Client-Date: Fri, 19 Sep 2008 20:14:31 GMT
Client-Peer: 192.168.25.128:8080
Client-Response-Num: 1
soapenv:Client
Error - invalid login password
Error - invalid login password
1000
####
[Fri Sep 19 16:13:42 2008]::ERROR::C:\dev\TWP\USDCache.pl::Unrecognized method 'fault'. List of available method(s): bunch of methods here.
[Fri Sep 19 16:14:31 2008]::ERROR::C:\dev\TWP\USDCache.pl::Can't call method "fault" on an undefined value at C:\dev\TWP\USDCache.pl line 98.