Wednesday, December 1, 2010

How to Call a .NET-based Web Service Using the SOAP::Lite Perl Library

Let's say you have a WebMethod that takes no arguments and returns a string:


[WebMethod]
public string HelloWorld()
{
   return "Hello World";
}

use SOAP::Lite;

my $soap = SOAP::Lite
    -> uri('http://www.alfredbr.com')
    -> on_action( sub { join '/', 'http://www.alfredbr.com', $_[1] } )
    -> proxy('http://localhost/Example1/Service1.asmx');

print $soap->HelloWorld()->result; 
 
View More Detail: http://msdn.microsoft.com/en-us/library/ms995764.aspx