10.07.2015 Views

Beginning Web Development With Perl : From Novice to ... - Nabo

Beginning Web Development With Perl : From Novice to ... - Nabo

Beginning Web Development With Perl : From Novice to ... - Nabo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 7 ■ SOAP-BASED WEB SERVICES 139Table 7-1. Some <strong>Web</strong> Sites with SOAP InterfacesSite/Service Description Information URLAmazon.com Numerous web services <strong>to</strong> expose http://www.amazon.com/gp/aws/data on products at Amazon.com landing.htmlNational <strong>Web</strong> services <strong>to</strong> expose forecasts and http://weather.gov/xml/Weatherconditions based on latitude andServicelongitude; available for U.S. locationsGoogle Interfaces <strong>to</strong> query Google’s direc<strong>to</strong>ry http://www.google.com/apis/and moreSOAP Meets <strong>Perl</strong>: SOAP::LiteOne package in <strong>Perl</strong>, SOAP::Lite, stands apart from other modules capable of talking SOAP.SOAP::Lite enables a developer <strong>to</strong> create both a SOAP client <strong>to</strong> send SOAP requests and a SOAPlistener <strong>to</strong> receive SOAP requests. SOAP::Lite is a collection of a number of other SOAP- andXML-related packages in <strong>Perl</strong>, so importing SOAP::Lite in<strong>to</strong> a program’s namespace effectivelymakes numerous functions available <strong>to</strong> your program.The SOAP::Lite package is available with many Linux distributions and also at yourfavorite CPAN mirror. Some of the classes available with SOAP::Lite include the following:• SOAP::Data• SOAP::Deserializer• SOAP::Header• SOAP::Lite• SOAP::Parser• SOAP::Serializer• SOAP::Server• SOAP::TransportImporting and Debugging SOAP:LiteFirst things first—you need <strong>to</strong> know how <strong>to</strong> import and, more important, how <strong>to</strong> debug thepackage. As with other packages, you first import SOAP::Lite in<strong>to</strong> your program’s namespacewith the use pragma:use SOAP::Lite;When importing in<strong>to</strong> the namespace, you can specify some debugging, or tracing as it’sknown <strong>to</strong> SOAP::Lite. This tracing can be helpful—no, more appropriately, this tracing canbe a huge time- and headache-saver—when working with web services. Like other debugging,such as that for Net::SMTP, SOAP::Lite tracing can show method calls and other usefulbits that can assist in troubleshooting a call <strong>to</strong> a web service. Multiple levels of tracing areavailable with SOAP::Lite. Some levels are applicable <strong>to</strong> the client only, the server only, orboth. Table 7-2 lists some the events that are traceable with SOAP::Lite.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!