This is a little bit off-topic, but our friends in Redmond have so far also not been able to help me with this problem. I am hoping that somebody already ran into this problem and managed to resolve it.
I am trying to access the MapPoint FindService from Java using JAX-WS. I
can't get the example program to work. As soon as I try to instantiate the
FindService the following exception is thrown. I found several examples
using AXIS, but I would prefer to use JAX-WS as it is built into JAVA6. Any
suggestions on how to get this working are appreciated.
Exception in thread "main" Cannot create Service instance, service
{http://s.mappoint.net/mappoint-30/}FindService not found in the WSDL
http://staging.mappoint.net/standard-30/mappoint.wsdl
at
com.sun.xml.internal.ws.client.ServiceContextBuilder.build(ServiceContextBuilder.java:66)
at
com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:125)
at
com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:52)
at javax.xml.ws.Service.<init>(Service.java:57)
at
com.j2anywhere.geodecode.api.FindService.<init>(FindService.java:43)
at com.j2anywhere.geodecode.Main.main(Main.java:34)
package com.j2anywhere.geodecode;
import com.j2anywhere.geodecode.api.FindService;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
public class Main
{
public static void main(String[] args)
{
Authenticator.setDefault(new SimpleAuthenticator());
// try
// {
// FindService findServiceAdaptor = new FindService(new
URL("http://findv3.staging.mappoint.net/Find-30/Common.asmx"),new
QName("http://s.mappoint.net/mappoint-30/", "FindServiceSoap"));
// }
// catch (MalformedURLException ex)
// {
// ex.printStackTrace();
// }
FindService findServiceAdaptor = new FindService();
// FindServiceSoap findService = findServiceAdaptor.getFindServiceSoap();
//
((BindingProvider)findService).getRequestContext().put(BindingProvider.USERNAME_PROPERTY,"username");
//
((BindingProvider)findService).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"pwd");
//
// LatLong latLong = new LatLong();
// latLong.setLatitude(51.5708);
// latLong.setLongitude(-1.15405);
// GetInfoOptions infoOption = new GetInfoOptions();
// infoOption.setIncludeAddresses(true);
// ArrayOfLocation locations =
findService.getLocationInfo(latLong,"MapPoint.EU",infoOption);
// System.out.println("Location : "+locations);
}
}
class SimpleAuthenticator extends Authenticator
{
public PasswordAuthentication getPasswordAuthentication()
{
System.out.println("Authenticating");
return new PasswordAuthentication("USERID","PASSWORD".toCharArray());
}
}