Answered by:
SOAP-ERROR: Parsing WSDL

Question
-
Hi I'm using PHP to access the geocoding web service and on my local machine (mac running MAMP, php 5.2.6) it works fine. When I moved my application to my live server (CentOS running php 5.2.11) it get the following error:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl' : Start tag expected, '<' not found
Here's my test code:
try { $soap_url = 'http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl'; $soap_client = new SoapClient($soap_url); var_dump($soap_client->__getFunctions()); } catch (Exception $e) { echo '<pre>'; print_r($e); exit; }
I'm not sure where to start troubleshooting ... any thoughts?
Output
PHP 5.2.6 array 0 => string 'GeocodeResponse Geocode(Geocode $parameters)' (length=44) 1 => string 'ReverseGeocodeResponse ReverseGeocode(ReverseGeocode $parameters)' (length=65) 2 => string 'GeocodeResponse Geocode(Geocode $parameters)' (length=44) 3 => string 'ReverseGeocodeResponse ReverseGeocode(ReverseGeocode $parameters)' (length=65) PHP 5.2.11 SoapFault Object ( [message:protected] => SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl' : Start tag expected, '<' not found [string:private] => [code:protected] => 0 [file:protected] => /home/volvoad/vtna/vtna.com/test.php [line:protected] => 5 [trace:private] => Array ( [0] => Array ( [file] => /home/volvoad/vtna/vtna.com/test.php [line] => 5 [function] => SoapClient [class] => SoapClient [type] => -> [args] => Array ( [0] => http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl ) ) ) [faultstring] => SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl' : Start tag expected, '<' not found [faultcode] => WSDL )
Wednesday, March 10, 2010 11:22 PM
Answers
-
I figured it out if I change the wsdl url from:
http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsd
To:
http://dev.virtualearth.net/webservices/v1/metadata/geocodeservice/geocodeservice.wsdl
It ends up working.
Anyone know why? Is there a redirect or something happening? Why would it work on some machines and not others? Wierdness ...
Also will I run into problems linking to: http://dev.virtualearth.net/webservices/v1/metadata/geocodeservice/geocodeservice.wsdl? For example, does MS change this url often?
Thanks- Proposed as answer by Ricky_BrundrittModerator Thursday, March 11, 2010 1:26 PM
- Marked as answer by Ricky_BrundrittModerator Saturday, March 13, 2010 12:00 AM
Wednesday, March 10, 2010 11:49 PM -
The url is "http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl" and it has never been changed. It's possible the some kind of encoding in your url is occuring. As for using the Bing Map web services in PHP, check out this article: http://j-ng.spaces.live.com/blog/cns!CDA7EF602F8CCA1!159.entry
Windows Live Developer MVP - http://rbrundritt.spaces.live.com- Proposed as answer by Ricky_BrundrittModerator Thursday, March 11, 2010 1:26 PM
- Marked as answer by Ricky_BrundrittModerator Saturday, March 13, 2010 12:00 AM
Thursday, March 11, 2010 12:39 AMModerator
All replies
-
I figured it out if I change the wsdl url from:
http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsd
To:
http://dev.virtualearth.net/webservices/v1/metadata/geocodeservice/geocodeservice.wsdl
It ends up working.
Anyone know why? Is there a redirect or something happening? Why would it work on some machines and not others? Wierdness ...
Also will I run into problems linking to: http://dev.virtualearth.net/webservices/v1/metadata/geocodeservice/geocodeservice.wsdl? For example, does MS change this url often?
Thanks- Proposed as answer by Ricky_BrundrittModerator Thursday, March 11, 2010 1:26 PM
- Marked as answer by Ricky_BrundrittModerator Saturday, March 13, 2010 12:00 AM
Wednesday, March 10, 2010 11:49 PM -
The url is "http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl" and it has never been changed. It's possible the some kind of encoding in your url is occuring. As for using the Bing Map web services in PHP, check out this article: http://j-ng.spaces.live.com/blog/cns!CDA7EF602F8CCA1!159.entry
Windows Live Developer MVP - http://rbrundritt.spaces.live.com- Proposed as answer by Ricky_BrundrittModerator Thursday, March 11, 2010 1:26 PM
- Marked as answer by Ricky_BrundrittModerator Saturday, March 13, 2010 12:00 AM
Thursday, March 11, 2010 12:39 AMModerator