|Perl: the Markov chain saw|
SOAP::Lite vs LWP::UserAgent for SOAP transactionsby mrguy123 (Hermit)
|on Jul 19, 2006 at 09:51 UTC||Need Help??|
mrguy123 has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks, I apologize in advance for the length of this one:
My job for the past few months has been retrieving webpages from the internet for a meta search engine. Until now I have done so using basic url queries (e.g http://www.imdb.com/finds=all&q=cats for all movies with cats in the title). For this I have used the LWP::UserAgent with much satisfaction. In the past few weeks I have been trying to understand and retrieve web pages with SOAP. The information I had in my hand on how to do so (besides the web) were a few programs that my predecessor wrote that uses SOAP. In all these programs but one, he used the LWP::UserAgent to retrieve the web pages, sending the SOAP content as part of the request object in POST. This demo is an example of such a search request (it needs IP-authentication to work, but it sends all the required information):
As I have said, this was the way most of the programs sent their info. However, this particular program used the SOAP::Lite module to create the same search request. The code is:
As you can see, the code is much more simple, and basically creates the same request from scratch. If you run both demos, you should get the same output. In fact, I built the first demo from the second, using the info that was sent through the module to "convert" the transaction. However, when I tried to convert the other programs from the LWP::UserAgent form of transaction to the SOAP::Lite form, I failed miserabely.
Looking at the SOAP::Lite module in CPAN, I haven't been able to find explanations about how to create a SOAP request like my predacessor did(e.g. how do you know what the soap action is). My questions are (and again, sorry for the length):
1) When should I use the LWP::UserAgent, and when should I use SOAP::Lite?
2) When using SOAP::Lite, how and when can I build the SOAP content from scratch. What should I use for the SAOP action (In my demo it was the uri with a prefix, but is that the how its done all the time)?
3) What advantages does SOAP::WSDL give me over SOAP::Lite. Is it more recommended?
Any links to examples and info sites will be greatly appreciated.
Thanks a lot
Guy Naamati (mrguy123)
The rain it raineth on the just, and also on the unjust fella,
But chiefly on the just, because the unjust steals the just's umbrella.
-- Lord Bowen