none
Help to generate WebService client to consume services Bing in Java RRS feed

  • Question

  • Hello everyone, I created a webservice client using the address for Netbeans

    http://dev.virtualearth.net/webservices/v1/metadata/geocodeservice/geocodeservice.wsdl

    my code:

     

     public static void main(String[] args) {
            try {
                QName spacename = new QName("http://dev.virtualearth.net/webservices/v1/geocode");
                String key = new String("Bing Maps Key");
                JAXBElement<String> appID = new JAXBElement<String>(spacename, String.class, key);
                Credentials credential = new Credentials();
                credential.setApplicationId(appID);
                JAXBElement<Credentials> cred = new JAXBElement<Credentials>(spacename, Credentials.class, credential);
                Location location = new Location();
                location.setLatitude(Double.parseDouble("-26.9299"));
                location.setLongitude(Double.parseDouble("-48.9484"));
                JAXBElement<Location> loca = new JAXBElement<Location>(spacename, Location.class, location);
                ReverseGeocodeRequest request = new ReverseGeocodeRequest();
                request.setCredentials(cred);
                request.setLocation(loca);
                GeocodeResponse resp = reverseGeocode(request);
                List<GeocodeResult> result= (List<GeocodeResult>) resp.getResults();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    


    But i have problem:

     

    javax.xml.ws.soap.SOAPFaultException: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://dev.virtualearth.net/webservices/v1/geocode/contracts:request. The InnerException message was 'There was an error deserializing the object of type Microsoft.VirtualEarth.PublicTypes.Geocode.ReverseGeocodeRequest. The '/' character, hexadecimal value 0x2F, cannot be included in a name. Line 1, position 457.'.  Please see InnerException for more details.
    	at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
    	at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
    	at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
    	at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
    	at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
    	at $Proxy35.reverseGeocode(Unknown Source)
    	at mobileclient.Main.reverseGeocode(Main.java:500)
    	at mobileclient.Main.main(Main.java:53)
    

    Someone could help me with this problem?

    Thank you!

     

     



    • Edited by Shakall Monday, September 19, 2011 9:25 PM
    • Edited by Ricky_Brundritt Wednesday, September 21, 2011 9:23 AM removing Bing Maps Key
    • Moved by Ricky_Brundritt Saturday, March 10, 2012 11:04 AM (From:Bing Maps: Map Control and Web services Development)
    Monday, September 19, 2011 9:24 PM

Answers

All replies