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

How to Call a .NET-based Web Service Using the SOAP::Lite Perl Library: "BASIC Authentication
In the Introduction, I said that my users were using Perl on Solaris. The previous examples assume that the server has enabled Anonymous Access on the IIS Web server�no username or password is required. However, if you want to use basic authentication on your Web service, SOAP::Lite can send usernames and passwords upon request to your Web service.
To demonstrate SOAP::Lite support for basic authentication, first turn off Anonymous Access and turn on Basic Authentication for the virtual directory containing your Web service. If you are using a Windows machine as your client and not a UNIX machine, turn off Integrated Windows Authentication as well. (Be aware that when you turn off Integrated Windows Authentication for the virtual directory containing your Web service, you cannot debug the Web service in Visual Studio .NET.)
Once you turn on Basic Authentication, go back and run the last example. You should get an error message:
401 Access Denied at Example3.plx line 22
Now add these lines of code anywhere in your example (replacing the words username and password for a real Windows username and password on your Web server):
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
return 'username' => 'password';
}

When your client application tries to access the Web service, the Web server issues a challenge for credentials. When SOAP::Lite receives this challenge, it calls the get_basic_credentials function. In this function, you arrange for the proper username and password pair to be returned to the Web server. You can watch this interaction with tcpTrace.exe."

No comments:

Ramadan - What is it?

  Ramadan is one of the most important and holy months in the Islamic calendar. It is a time of fasting, prayer, and spiritual reflection fo...