up
Perl Lecture Notes - June 15, 2002 - XML take 3
- Questions
- RPC in general
- We already do this.
- Just use a script to hit someone's web form and parse the result.
Voila.
- So what's wrong with this picture?
- Coming soon to an internet near you: Web Services
- SOAP::Lite
- Go look at the first example before wading through this summary.
- Also check the acronyms
for RPC, XML-RPC, SOAP, WSDL, XSD, UDDI, REST, .NET
- Overall it's just like Perl:
- Extremely simple to do simple stuff - even in one line.
- Multiple syntax options for nearly everything.
- Many ways to configure and use
- Details of XML envelopes : possible but harder.
- It can hide all the SOAP XML from you.
- It can even turn remote perl objects (packages)
into persistent objects that appear to be local.
- Very cool.
- Capabilities:
- Support for SOAP clients and servers.
- Support for XML-RPC clients and servers
- Support for many transport protocols.
- Examples of connecting to/from .NET and COM service/clients
- Support for reading .wsdl files to define service.
- Supports compression for HTTP messages
- No support for creating .wsdl files.
- Limited support for queries to UDDI servers.
- Data types
- SOAP is strongly typed. Perl is not.
- Getting arguments back is usually fine - they're just
converted into something appropriate.
Multiple argument returns turn into key-value hashes,
for example.
- Sending out arguments can be a bit trickier. SOAP::Lite
will try to guess the type (number or string, say), or
you can specify data types and keys
within a SOAP::Data structure, and send that structure
as the argument.
- Caveats
- Many fine examples; however, details are often hazy.
- Various SOAP server/clients expect various specifics
in the SOAP envelope. Getting SOAP::Lite to
fit other's expectations may take some massaging
of SOAP::Data or SOAPAction. But there are many
examples as well as debugging tools.
- The documentation can be a bit spotty.
- Parts (UDDI, WSDL, some docs) feel like a work in progress.
- One (albeit long) liner:
perl "-MSOAP::Lite service=>'http://www.xmethods.net/sd/StockQuoteService.wsdl'" -le "print getQuote('MSFT')"
- Examples
These command line clients can be on any machine.
As usual .pl and .cgi files will have pretty formatting if you append
- paraphrased from "What's Next" conference
- "SOAP is friendly to a firewalls the way a bullet is friendly to a skull."
- "HTML/JavaScript is the universal client;
HTTP is the universal transport;
CGI is the universal server."
- Future is rich clients (Flash etc) and web services.
- A big question - trust and security.
(Many options, though: see SOAP::Lite Cookbook)
- Resources and Documentation
- Assignmnent
- Reading
- Browse the SOAP site documentation and tutorials.
- Writing
- Use SOAP::Lite to turn a piece of one of your
CGI websites into a SOAP service.
- Write a client that accesses your service.
- Create a webpage that gives a brief description of
your service.
Are we having fun yet?