Community of MapPoint and Bing Maps Users and Developers
This is a discussion on Experiencing problems when using the findNearBy method of the MapPoint Web Service in PHP within the Development forums, part of the MapPoint Desktop Discussion category; Hello, I try to consum the MapPoint Web Service in PHP and especially, the findNearBy method. I want to use ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Experiencing problems when using the findNearBy method of the MapPoint Web Service in PHP 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 : 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;
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;
Quote:
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 |
| |||
| Re: Experiencing problems when using the findNearBy method of the MapPoint Web Service in PHP
If you want to test this, just copy the script which is in attachments in your web server root directory and edit the four parameters in ./mappoint/ClassLoader.php:
|
| |||
| Re: Experiencing problems when using the findNearBy method of the MapPoint Web Service in PHP
Ok I found the problem. It's a problem with the type of the parameters which are sent through the SOAP mechanism. If the parameter type is not specified, the SOAP content does specify the type of the parameter, this is the default behavior. The solution is consequently to indicate the type of the parameter with this line : Code: $lAParameters[0] = new SoapVar( "Gare", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"); Code: $lAParameters = array(); $lAParameters[0] = new SoapVar( "Gare", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"); $loFilterExpression->Parameters = $lAParameters; $findAddressSpec->Filter->Expression = $loFilterExpression; |
![]() |
| Tags |
| experiencing, findnearby, mappoint, method, php, problems, service, web |
| ||||
| Posted By | For | Type | Date | |
| Site content newsletter - PHP Classes | This thread | Refback | 06-30-2009 01:48 AM | |
| The Magazine for MapPoint - MP2K Magazine | This thread | Refback | 06-11-2009 12:20 PM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FindNearby Method | trevorjdaniel | Bing Maps and MapPoint Web Service | 1 | 01-24-2009 06:53 AM |
| How to delete circle from map after Findnearby method | azorgnairelau | MapPoint Desktop Discussion | 4 | 11-28-2007 01:41 PM |
| Is new datasource MapPointNAICS.NA support findnearby Method | saad | MapPoint Desktop Discussion | 1 | 08-18-2005 03:08 AM |
| Method FindNearby() with a route object | Anonymous | MapPoint Desktop Discussion | 3 | 12-19-2002 09:06 AM |
| FindNearby Method | Anonymous | MapPoint Desktop Discussion | 0 | 09-24-2002 10:08 AM |