Search code examples
phpsoapphrets

Querying with Multiple Listing Numbers in Evernet Soap service


I was trying to fetch data for NWMLS using evernet soap service. Here I have to extract data for Multiple listing Numbers / Listing Ids. But I am getting error response. Below is the code snipper which I am trying to get specific data.

<!-- language: php -->
$client=new SoapClient('http://evernet.nwmls.com/evernetqueryservice/evernetquery.asmx?WSDL');

$XMLQuery  = "<?xml version='1.0' encoding='utf-8' standalone='no' ?>";
$XMLQuery .="<EverNetQuerySpecification xmlns='urn:www.nwmls.com/Schemas/General/EverNetQueryXML.xsd'>";
    $XMLQuery .="<Message>";
    $XMLQuery .="<Head>";
    $XMLQuery .="<UserId>******</UserId>";
    $XMLQuery .="<Password>******</Password>";
    $XMLQuery .="<SchemaName>StandardXML1_1</SchemaName>";
    $XMLQuery .="</Head>";
    $XMLQuery .="<Body>";
    $XMLQuery .="<Query>";
    $XMLQuery .="<MLS>NWMLS</MLS>";
    $XMLQuery .="<ListingNumber>1045735555</ListingNumber>";
    $XMLQuery .="<ListingNumber>10641974354</ListingNumber>";
    $XMLQuery .="<PropertyType>RESI</PropertyType>";
    $XMLQuery .="</Query>";
    $XMLQuery .="<Filter></Filter>";
    $XMLQuery .="</Body>";
    $XMLQuery .="</Message>";
    $XMLQuery .="</EverNetQuerySpecification>";
    $params = array ('v_strXmlQuery' => $XMLQuery);
    $result = $client->RetrieveListingData($params);     
    $access = $result->RetrieveListingDataResult; print_r($access);
   $xml[] = simplexml_load_string($access); 

The response I am getting from the Soap service is

" Element 'urn:www.nwmls.com/Schemas/General/EverNetQueryXML.xsd:ListingNumber' cannot appear more than once if content model type is "all". "

How to form the query that needs to include multiple listing Numbers so that I will get the exact result ??

Thanks


Solution

  • Per the XSD specification, the "ListingNumber" cannot appear more than once, in the query. So that's why you're seeing that error.

    But how to query for multiple ListingNumbers? The way I know off the top of my head is to use the "BeginDate" and "EndDate", or "Status", "County", "Area".

    Of course, this is not as exact as directly querying those two listing numbers, so you get a range of values in return.

    Have you played around with http://evernet.nwmls.com/evernettest/RetrieveListingData.aspx?