ctaustin has asked for the wisdom of the Perl Monks concerning the following question:

I am new to the world of SOAP and XML for that matter. Some of the jargon and what not has been a little daunting.

I am trying to write a SOAP client. I have been provided with XML Schemas of the two web services as well as WSDL schemas. While there are two services, there seems to be several different methods (?) that I can call (e.g. RetrieveOfficeData, RetrieveListingData, etc.).

I was also provided with the following SOAP Example, but am sadly having trouble discerning what is what within the example:
POST /evernetqueryservice/evernetquery.asmx HTTP/1.1 Host: evernet.nwmls.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://www.nwmls.com/EverNetServices/RetrieveOfficeData" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x +mlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schema +s.xmlsoap.org/soap/envelope/"> <soap:Body> <RetrieveOfficeData xmlns="http://www.nwmls.com/EverNetServices"> <v_strXmlQuery>string</v_strXmlQuery> </RetrieveOfficeData> </soap:Body> </soap:Envelope>


I have written the following, small perl code to try to work with this method:
#!/usr/bin/perl use strict; use SOAP::Lite; my $num= shift; $num=~/^\d+$/ or die "USAGE: $0 num/n"; my ($server,$endpoint,$soapaction,$method,$method_urn); $server='http://evernet.nwmls.com'; $endpoint="$server/evernetqueryservice/evernetquery.asmx"; $soapaction="http://www.nwmls.com/EverNetServices/RetrieveOfficeData"; $method='RetrieveOfficeData'; $method_urn='http://www.nwmls.com/EverNetServices'; my $num2words=SOAP::Lite->new(uri=>$soapaction, proxy=>$endpoint); my $response=$num2words -> call(SOAP::Data->name($method) ->attr({xmlns=>$method_urn}) =>#Arguments listed next SOAP::Data->name(v_strXmlQuery=>$num)); if ($response->fault){ printf "A fault (%s) occurred: %s\n", $response->faultcode,$response->faultstring; } else { print "$response->result\n"; } exit;


When I run this, I get the following error:
A fault (soap:Client) occurred: Server did not recognize the value of HTTP Header SOAPAction: http://www.nwmls.com/EverNetServices#RetrieveOfficeData.


So I am thinking that I am confusing things when I assign the method, urn, enpoint, etc.

Given the example provided, how would I decode the following elements: server, endpoint (proxy), soapaction (uri), method, method_urn?

Regards

Replies are listed 'Best First'.
Re: SOAP::Lite Help
by csuhockey3 (Curate) on Oct 21, 2004 at 19:51 UTC