Hello,
I try to consum the MapPoint Web Service in PHP and especially, the findNearBy method.
I want to use the filter capability on this request, and when I provide simple parameters as EntityTypeName, the call works fine.
But when I provide more complex parameters as PropertyNames, WhereClause or Expression, I encounter always an error.
For information, I got the equivalent of php classes of Mappoint here : MapPoint PHP API (image, Array, user, PHP) - PHP Classes.
I found some information here on how to consum the MapPoint Web Service in PHP : Consuming MapPoint Web Service in PHP
I use, to do the call to the wsdl, the native SOAP of PHP (in v5.2.5) and not the nusoap library.
Here is a simple code that works fine :
But when I add the Expression parameter, I got an error :Code:// define the find range of the search options $loFindRange = new FindRange(); $loFindRange->StartIndex = 0; $loFindRange->Count = $poSearchCriteria->count; // define the search options $loFindOptions = new FindOptions(); $loFindOptions->ThresholdScore = 0; $loFindOptions->Range = $loFindRange; // define the center of the search $loLatLong = new LatLong(); $loLatLong->Latitude = $poSearchCriteria->latitude; $loLatLong->Longitude = $poSearchCriteria->longitude; // Set up the specification object $findAddressSpec = new FindAddressSpecification(); $findAddressSpec->DataSourceName = $poSearchCriteria->dataSourceName; $findAddressSpec->Distance = $poSearchCriteria->distance; $findAddressSpec->Options = $loFindOptions; $findAddressSpec->LatLong = $loLatLong; // define the find filer of the search options $findAddressSpec->Filter = new FindFilter(); $findAddressSpec->Filter->EntityTypeName = $poSearchCriteria->entityTypeName;
And the error is the following :Code:// specify the text of the Expression. $loFilterExpression = new FilterExpression(); $loFilterExpression->Text = "poi_name = {0}"; // set the paramater values to match the placeholder in the Text string. $lAParameters = array(); $lAParameters[0] = "Gare"; $loFilterExpression->Parameters = (object)$lAParameters; $findAddressSpec->Filter->Expression = $loFilterExpression;
So what I understand, it's that the webservice is unable to recognize that {0} is the first index of my parameters array...it's strange...SoapFault exception: [soap:Client] The value of the specified parameter index is out of range. Argument: specification.Filter.Expression.Text[7] in...
So am I misunderstanding the use of the webservice or can there be a problem with the parameters send when calling the webservice???
Thanks for advices![]()