Creating a VB.NET Client


PERL is a scripting language that is similar to C. It was one of the frontier Web languages that allowed interactive Web pages through the Common Gateway Interface (CGI). PERL’s role as a Web language has started to fade with the advent of J2EE, .NET, Cold Fusion, and other technologies, but PERL is still a superior language for automating tasks and performing system administration duties.

PERL’s main advantage is that it is a scripting language that makes it easy to change, compile, and execute. In fact, it’s a great language to use when performing software testing because of its ease of use and its ability to easily manipulate and parse text files. This gives you the ability to easily search for results in a generated log file.

To call Web Services from PERL, all you need to do is write a PERL script that uses the SOAP::Lite Library available from www.soaplite.com. The following code example contains a call to the returnCurrencyName method from the MoneyExchange Web Service covered in Chapter 11. The script begins by using a bracket to begin the scope of the program. Then it calls the SOAP::Lite Library with the use statement. Then a print method is associated with the SOAP::Lite call so the output from the method is displayed at the command line when the script executes. The location of the WSDL file of the service you wish to call gets passed to the service attribute. Then, the country whose currency name you are querying gets passed to the method from the service, returnCurrencyName. Notice that we didn’t need to create a proxy for PERL because it parses the WSDL on the fly to learn how to communicate with the service.

    {#begin scope PERL program      use SOAP::Lite;      #Call Axis Service      print "Name of currency in Switzerland is: ";      print SOAP::Lite      -> service      ('http://localhost:8080/axis/MoneyExchange.jws?wsdl')      -> returnCurrencyName('Swiss');     }#end scope PERL Program

The next PERL example calls three of the example Web Services found in various chapters of this book to show that PERL can call Web Services from SOAP, Axis, and .NET.

    {#begin scope PERL program     use SOAP::Lite;      #Call Axis Service      print "Name of currency in Switzerland is: ";      print SOAP::Lite       -> service      ('http://localhost:8080/axis/MoneyExchange.jws?wsdl')       -> returnCurrencyName('Swiss');      #add return line      print "\n";      #Call Apache SOAP Service      print "Type of Service being called: ";      print SOAP::Lite      -> service('http://localhost:8080/soap/GetId.wsdl')      -> ServiceId();     #Add Return Line     print "\n";     #Call .NET Web Service     print "The Value of C in simple stock quote is ";     print SOAP::Lite     -> service(      'http://localhost/XPlatform/StockQuote.asmx?wsdl'      )     -> GetTestQuote("C");     }#end scope PERL program

As you can see, PERL calls Web Services fairly easily, and this provides one more tool for testing and communicating with Web Services.




Cross-Platform Web Services Using C# and Java
Cross-Platform Web Services Using C# & JAVA (Charles River Media Internet & Web Design)
ISBN: 1584502622
EAN: 2147483647
Year: 2005
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net