Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-16 18:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found