Bing geocode service always returns Credentials are either invalid or unspecified RRS feed

  • Question

  • I'm trying to use the Bing geocode web service. With an existing Application Key and even a new created Application Key at Bing Maps Account center, I always get "Credentials are either invalid or unspecified." I searched on the internet and found so many posts on this subject, but couldn't find a solution for my problem. Can somebody please point out the problem in my code?

    I followed the documentation here:


    And the WSDL is:


    My code is here:

        public GeocodeResponse getGeoCode(String street, String city,
                String state, String zipCode)
            net.virtualearth.dev.webservices.v1.common.ObjectFactory object =
                new net.virtualearth.dev.webservices.v1.common.ObjectFactory();
            GeocodeRequest request = new GeocodeRequest();
            GeocodeResponse response = getGeoCodeCommon(request);
            return response;

        private GeocodeResponse getGeoCodeCommon(GeocodeRequest request)
            GeocodeService geocodeService = new GeocodeService();
            IGeocodeService igeo = geocodeService.getBasicHttpBindingIGeocodeService();
            GeocodeResponse response = null;
            try {
                response = igeo.geocode(request);
            } catch (IGeocodeServiceGeocodeResponseSummaryFaultFaultMessage e) {
            return response;

        private Address getAddress(String street, String city, String state, String zipCode)
            com.microsoft.schemas._2003._10.serialization.ObjectFactory object =
                new com.microsoft.schemas._2003._10.serialization.ObjectFactory();
            Address address = new Address();
            return address;

        private Credentials getCredentials()
            com.microsoft.schemas._2003._10.serialization.ObjectFactory object =
                new com.microsoft.schemas._2003._10.serialization.ObjectFactory();
            Credentials credentials = new Credentials();
            return credentials;

    • Moved by Ricky_Brundritt Saturday, March 10, 2012 12:07 PM (From:Bing Maps: Map Control and Web services Development)
    Tuesday, November 15, 2011 5:04 PM


All replies

  • One thing worth trying is to change the name of your variable to something other than object. I can see this potentially causing an issue. Also, why are you using ObjectFactory? Can you just place your key into the setApplicationId method to ensure that it is being passed? Check this documentation out and verify this method works for you: http://msdn.microsoft.com/en-us/library/cc980855.aspx
    Wednesday, November 16, 2011 6:04 PM
  • The reason I used ObjectFactory because object fields generated from WSDL have JAXBElement types. I managed to have JAXBElement not generated by using bindings. Now the code is working.


    Thank you very much for the help.


    Wednesday, November 16, 2011 8:22 PM
  • Hmm... ok. I thought you were using .NET and not Java. Take a look at this blog post:http://ngjon.wordpress.com/2010/01/19/simple-java-starter-applications-using-bing-maps-web-services/ Personally I recommend using the REST services over the SOAP services as they are faster, have more features and are easier to use cross platforms.
    Thursday, November 17, 2011 10:13 PM