Discussion:
(401)Unauthorized
(too old to reply)
faite
2008-10-27 18:15:02 UTC
Permalink
I am trying to execute the example that you have at
http://go.mappoint.net/mappointmpac/default.aspx?main=article.aspx&id=J20085
but it don't work for me.
Could you help me with this?
Thanks

public class FindAddress
{
public static String username = "xxxxx";
public static String password = "xxxxx";

public static String dataSourceName = "MapPoint.NA";
public static String findAddress = "5873 Northpointe Lane";
public static String findCity = "boynton beach";
public static String findState = "florida";
public static String findZip = "33437";

public static void getRute() throws RemoteException, MalformedURLException,
ServiceException
{
String serviceURL =
"http://routev3.staging.mappoint.net/Route-30/RouteService.asmx";

RouteServiceSoap routeService = new
RouteServiceLocator().getRouteServiceSoap(new URL( serviceURL ));
((RouteServiceSoapStub) routeService).setUsername(username);
((RouteServiceSoapStub) routeService).setPassword(password);

UserInfoRouteHeader routeHeader = new UserInfoRouteHeader();
routeHeader.setDefaultDistanceUnit(DistanceUnit.Kilometer);
CultureInfo cultureInfo = new CultureInfo();
cultureInfo.setName("en");
routeHeader.setCulture(cultureInfo);
((RouteServiceSoapStub)
routeService).setHeader("http://s.mappoint.net/mappoint-30/","UserInfoRouteHeader",routeHeader);

// Calculate a route between 2 latitude and longitude coordinates
LatLong[] latlongs = new LatLong[2];
latlongs[0] = new LatLong();
latlongs[0].setLatitude(new Double(40));
latlongs[0].setLongitude(new Double(-120));
latlongs[1] = new LatLong();
latlongs[1].setLatitude(new Double(41));
latlongs[1].setLongitude(new Double(-121));


Route myRoute = routeService.calculateSimpleRoute(latlongs, "MapPoint.NA",
SegmentPreference.Quickest);
}
Derek Chan
2008-10-29 14:34:06 UTC
Permalink
Hi,

What are you using to authenticate against MWS? The norm has always been to
use Axis 1.4 with an override that allows Digest authentication (you must use
digest) to work for Java. You'll find more details about this here:

http://go.mappoint.net/mappointmpac/article.aspx?id=J10002

Regards,
--
Infusion Development
http://www.infusion.com
Post by faite
I am trying to execute the example that you have at
http://go.mappoint.net/mappointmpac/default.aspx?main=article.aspx&id=J20085
but it don't work for me.
Could you help me with this?
Thanks
public class FindAddress
{
public static String username = "xxxxx";
public static String password = "xxxxx";
public static String dataSourceName = "MapPoint.NA";
public static String findAddress = "5873 Northpointe Lane";
public static String findCity = "boynton beach";
public static String findState = "florida";
public static String findZip = "33437";
public static void getRute() throws RemoteException, MalformedURLException,
ServiceException
{
String serviceURL =
"http://routev3.staging.mappoint.net/Route-30/RouteService.asmx";
RouteServiceSoap routeService = new
RouteServiceLocator().getRouteServiceSoap(new URL( serviceURL ));
((RouteServiceSoapStub) routeService).setUsername(username);
((RouteServiceSoapStub) routeService).setPassword(password);
UserInfoRouteHeader routeHeader = new UserInfoRouteHeader();
routeHeader.setDefaultDistanceUnit(DistanceUnit.Kilometer);
CultureInfo cultureInfo = new CultureInfo();
cultureInfo.setName("en");
routeHeader.setCulture(cultureInfo);
((RouteServiceSoapStub)
routeService).setHeader("http://s.mappoint.net/mappoint-30/","UserInfoRouteHeader",routeHeader);
// Calculate a route between 2 latitude and longitude coordinates
LatLong[] latlongs = new LatLong[2];
latlongs[0] = new LatLong();
latlongs[0].setLatitude(new Double(40));
latlongs[0].setLongitude(new Double(-120));
latlongs[1] = new LatLong();
latlongs[1].setLatitude(new Double(41));
latlongs[1].setLongitude(new Double(-121));
Route myRoute = routeService.calculateSimpleRoute(latlongs, "MapPoint.NA",
SegmentPreference.Quickest);
}
Loading...