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

In reply to soap object reference error by ctaustin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.