http://www.perlmonks.org?node_id=410779

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

I have the following code:

#!/usr/bin/perl + #use strict; use SOAP::Lite +debug; + + my $luser="my_user"; my $pass="my_pass"; + my $mls_schema="<SchemaName>NWMLSStandardXML</SchemaName>"; my $mls_status="A"; my $mls_county="lewis"; my $mls_start="2004-11-26T00:00:00"; my $mls_stop="2004-11-27T10:30:00"; + my $query="<Message><Head><UserId>$luser</UserID> <Password>$pass</Password> $mls_schema <Status>$mls_status</Status> <County>$mls_county</County> <BeginDate>$mls_start</BeginData> <EndData>$mls_stop</EndDate> </Head></Message>"; + print "Current Query: $query\n"; + my ($uri,$server,$endpoint,$soapaction,$method,$method_urn); + $uri="http://www.nwmls.com/EverNetServices"; $server='http://evernet.nwmls.com'; $endpoint="$server/evernetqueryservice/evernetquery.asmx"; $method='RetrieveListingData'; + my $soap=SOAP::Lite->new(uri =>$uri, proxy => $endpoint) ->on_action(s +ub { sprintf '"%s/%s"', shift,shift }) ; + my $response=$soap->call(SOAP::Data->name($method) ->attr({xmlns=>$uri}) => SOAP::Data->name(v_strXMLQuery=>$query)); if ($response->fault){ printf "A fault (%s) occurred: %s\n", $response->faultcode,$response->faultstring. join ("\n\t",@_). +"\n"; } else {print "$response->result\n";} + exit;


When I run it I get the following error response:
Object reference not set to an instance of an object

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http: +//schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/20 +01/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">< +soap:Body><RetrieveListingDataResponse xmlns="http://www.nwmls.com/Ev +erNetServices"><RetrieveListingDataResult>&lt;Listings&gt;&lt;Respons +eMessages&gt;&lt;Message&gt;&lt;Error&gt;System.NullReferenceExceptio +n: Object reference not set to an instance of an object. at System.Xml.XmlTextReader..ctor(String xmlFragment, XmlNodeType f +ragType, XmlParserContext context) at EverNetLib.EverNetUtility.QueryParseOperations.CheckWellFormedNe +ss(String v_strUserName, String v_strXmlQuery, XmlValidatingReader xv +rReader) at EverNetLib.EverNetUtility.QueryParseOperations.ValidateQuery(Str +ing v_strXmlQuery, MessageCollections&amp; r_mcMessages, Boolean blnB +uildQueryParamCollection) at EverNetQueryService.EverNetQuery.ValidAndRemotingEnabled(String +v_strXmlQuery, String v_strMethodName) at EverNetQueryService.EverNetQuery.RetrieveListingData(String v_st +rXmlQuery)&lt;/Error&gt;&lt;/Message&gt;&lt;/ResponseMessages&gt;&lt; +/Listings&gt;</RetrieveListingDataResult></RetrieveListingDataRespons +e></soap:Body></soap:Envelope>


Being new to both SOAP and object oriented programming I am not sure where this error is coming from. I am guessing it is something relatively easy. I would greatly appreciate being pointed in the right direction.

Thanks. Tony