http://www.perlmonks.org?node_id=946465


in reply to SOAP::Lite fault seems faulty

SOAP::Lite fault seems faulty

Pretty basic right? Just makes a soap authentication request

Soooo the fault code, is unknown method: faultcode?... Someone make it make sense, lol

Nope, it is your program which is faulty ;) What is it you're expecting  $soap->fault to do?

 $soap->fault is really  $soap->call( 'fault' ), does your SOAP server have a fault method? faultcode method? faultstring method?

#!/usr/bin/perl -- use SOAP::Lite; my $soap = SOAP::Lite ->proxy( 'http://localhost/blah/DummyService', timeout => 0.00001, ); $soap->transport->add_handler("request_send", \&pp_dump ); eval { $soap->fault; 1 } or print $@; print '#' x 33, "\n"; eval { $soap->faultcode; 1 } or print $@; print '#' x 33, "\n"; eval { $soap->faultstring; 1 } or print $@; print '#' x 33, "\n"; $soap->call('NONSENSE'); sub pp { use XML::Twig; open my($fh), '>', \my $str; no warnings 'newline'; XML::Twig->new( qw! pretty_print record ! )->parse( @_ )->print( $fh ); return $str; } sub pp_dump { { my $content = $_[0]->content(''); $_[0]->content( pp($content) ); } print $_[0]->as_string,"\n"; return; } __END__ POST http://localhost/blah/DummyService HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/0.714 Content-Length: 391 Content-Type: text/xml; charset=utf-8 SOAPAction: "#fault" <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http:/ +/www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSche +ma-instance"> <soap:Body> <fault xsi:nil="true"/> </soap:Body> </soap:Envelope> 500 Can't connect to localhost:80 (timeout) at soap.lite.fault.pl line + 12 ################################# POST http://localhost/blah/DummyService HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/0.714 Content-Length: 395 Content-Type: text/xml; charset=utf-8 SOAPAction: "#faultcode" <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http:/ +/www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSche +ma-instance"> <soap:Body> <faultcode xsi:nil="true"/> </soap:Body> </soap:Envelope> 500 Can't connect to localhost:80 (timeout) at soap.lite.fault.pl line + 14 ################################# POST http://localhost/blah/DummyService HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/0.714 Content-Length: 397 Content-Type: text/xml; charset=utf-8 SOAPAction: "#faultstring" <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http:/ +/www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSche +ma-instance"> <soap:Body> <faultstring xsi:nil="true"/> </soap:Body> </soap:Envelope> 500 Can't connect to localhost:80 (timeout) at soap.lite.fault.pl line + 16 ################################# POST http://localhost/blah/DummyService HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/0.714 Content-Length: 394 Content-Type: text/xml; charset=utf-8 SOAPAction: "#NONSENSE" <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http:/ +/www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSche +ma-instance"> <soap:Body> <NONSENSE xsi:nil="true"/> </soap:Body> </soap:Envelope> 500 Can't connect to localhost:80 (timeout) at soap.lite.fault.pl line + 18