Accessing Bing Maps Web Services using Java RRS feed

All replies

  • I don't use Java myself, but this looks like really useful information for anybody that does - thanks for sharing it.

    Beginning Spatial with SQL Server
    Tuesday, September 8, 2009 6:16 PM
  • Hi,

    I have a quick question,

    I can't seem to find the "*;

    What WSDL generates this?.

    I have the stubs generated for following four WSDL's.
    Common/Token :
    Geocode Service :
    Imagery Service :
    Route Service :
    Search Service :

    Thursday, October 1, 2009 6:31 PM
  • I think you have the wrong WSDL urls.  Here's what I'm using for the geocode service:
    Friday, October 2, 2009 12:20 AM
  • Which URL you use depends on whether you are accessing the staging or production environment. The service URLs srrk listed are for the production environment. The staging environments are all proceeded by a "staging" subdomain. Since you are using a staging token, you will need the staging service URL as orbitphreak listed.

    Friday, October 2, 2009 12:23 AM
  • Thanks.

    That helped.
    Friday, October 2, 2009 3:38 PM
  • hi, I found problems on generating stubs. This is what I used,
    java org.apache.axis.wsdl.WSDL2Java -U 147281 -P 2009Transit*

    but exceptions are throwed out,
    org.xml.sax.SAXException: Fatal Error: URI=null Line=1: Premature end of file.
        at org.apache.axis.utils.XMLUtils$ParserErrorHandler.fatalError(

    It works for the common services...though, I don't know why here. Any ideas on what happened here? I am quite new to web service development, and really appreciate your help
    Saturday, November 14, 2009 10:32 PM
  • Check out this thread:
    Windows Live Developer MVP -
    Saturday, November 14, 2009 11:19 PM
  • Thanks for the update. I have successfully translate the wsdl into java files. But it seems there are still problems in the auto-generated files," can not be recognized as Throwable.

    Btw, the system is  ubuntu and jdk1.6. Is there any one who encountered the same problem? Any help is appreciated , thankx
    Sunday, November 15, 2009 1:59 AM
  • Jonathan


    Thanks for you blog at the above link, I was able to do a lot of progresss. here is my new problem


    I started writing java based web services using axis.jar(probably older version..NOT axis2). I am using keys. I used wsdl2java from axis .jar to create the stub classes. below is the code and it worked fine....

       BasicHttpBinding_IGeocodeServiceStub geocodeServiceClient = (BasicHttpBinding_IGeocodeServiceStub) (new GeocodeServiceLocator()).getBasicHttpBinding_IGeocodeService();
       GeocodeRequest request = new GeocodeRequest();


    Now I am ready to write ANT scripts and took axis2 instead of axis. The ant task using axis2 generate lot of other classes and does not have some of the older classes I had generated. I am getting compile errors on all my web service code.

    I looking for JAVA based web service code for geocode and route. I cannot resolve the compile errors.  BasicHttpBinding_IGeocodeServiceStub is no longer available in the new set of generated classes.

    Could you explain.

    Wednesday, June 16, 2010 4:53 PM
  • The Axis2 library is totally different from Axis. If you use an IDE like Eclipse, you should get the suggestions dropdown for the available methods. I'll pull up some of my examples and post them up.
    Wednesday, June 16, 2010 9:47 PM
  • Hello Jonathan,

    I am using the Imagery Srvices GetMapUri to get the uri, and then I use that uri to get the image.

    I am getting an Invalid URL exception when I use that uri to do HttpClient.execute(GetMethod), but when I use the same from a browser it works ? Am I missing anythign here ? Would you know.




    Saturday, October 9, 2010 7:48 PM
  • Hi Jonathan,

    I have used axis2 to generate the proxy and binding files. as mentioned above now I dont see  BasicHttpBinding_IGeocodeServiceStub etc.. classes. While trying to populate request with axis2 I am getting following error:

    Exception in thread "main" org.apache.axis2.AxisFault: Transport error: 415 Error: Cannot process the message because the content type 'application/soap+xml; charset=UTF-8; action=""' was not the expected type 'text/xml; charset=utf-8'.
        at org.apache.axis2.transport.http.HTTPSender.handleResponse(
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(
        at org.apache.axis2.transport.http.HTTPSender.send(
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
        at org.apache.axis2.engine.AxisEngine.send(
        at org.apache.axis2.description.OutInAxisOperationClient.send(
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(
        at org.apache.axis2.client.OperationClient.execute(
        at TestBingMaps.main(


    I have created following request:

    public static void main(String[] args) throws Exception {
            GeocodeServiceStub geocodeService = new GeocodeServiceStub("");
            //GeocodeServiceStub stub = new GeocodeServiceStub();
            GeocodeResponseDocument response = geocodeService.Geocode(getGeocodeDocument());
        private static GeocodeDocument getGeocodeDocument(){
            GeocodeDocument  geocodeDocument = GeocodeDocument.Factory.newInstance();
            geocodeDocument.getGeocode().getRequest().setQuery("1 Microsoft Way, Redmond, WA");
            return geocodeDocument;


    Can you please help me where I am goining wrong while creating request.





    Sunday, May 15, 2011 12:52 AM
  • The instructions were for using the Axis package, not Axis2.

    In any case, if there is no specific need to use Axis, don't use it. Use the new REST service instead.

    Check out a geocoding sample at You'll save a lot of hair.

    Saturday, May 21, 2011 1:53 AM
  • I am using imagery soap service and getting the Map image given the 2 points. But it does not highlight the route. which property should be populated in the request to highlight the route.

    Following is the request:

    private static GetMapUri createMapUriRequest(){
   objFactory = new;
            GetMapUri mapUriRequest = objFactory.createGetMapUri();
            MapUriRequest request = new MapUriRequest();
            return mapUriRequest;




    Thursday, June 9, 2011 9:00 PM
  • The SOAP imagery service has limited features. The last I checked it did not support polylines or polygons so drawing routes required a lot of extra work. Look at using the REST services. They are a lot easier to use and have a lot more features.
    Windows Live Developer MVP - |
    Friday, June 10, 2011 9:39 AM
  • Thankyou..
    Anuradha daga
    Tuesday, June 14, 2011 6:17 PM