Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 2 of 2

Setting default distance unit

This is a discussion on Setting default distance unit within the Bing Maps and MapPoint Web Service forums, part of the Map Forums category; I'm using MapPoint Web Service in a Java J2EE architecture. How do I set the default distance unit to miles ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Setting default distance unit

    I'm using MapPoint Web Service in a Java J2EE architecture. How do I set the default distance unit to miles in the RouteService CalculateSimpleRoute call?

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Here's an example of how to set the header elements in Java:

    The following is a code snippet of how you would set the Distance Unit property of
    the UserInfoFindHeader and UserInfoRouteHeader. These edits were done to the FindRouteDialog.java
    file which is in the 'Java Driving Directions' demo located at
    http://demo.mappoint.net/.

    try {
    String findUrl = staging ? findStagingUrl : findProductionUrl;
    findService = new FindServiceLocator().getFindServiceSoap(new
    URL(findUrl));
    ((FindServiceSoapStub) findService).setUsername(userName);
    ((FindServiceSoapStub) findService).setPassword(password);

    //Create a SOAP Header Element and child elements to support setting
    the Distance unit for the FindService
    SOAPHeaderElement myUserInfoFindHeader = new
    SOAPHeaderElement("","UserInfoFindHeader");
    MessageElement myDistanceUnit = new MessageElement("","DefaultDistanceUnit");
    myDistanceUnit .addTextNode("DistanceUnit.Mile");
    myUserInfoFindHeader.addChild(myDistanceUnit);

    //Set the header using the SOAP Header Element and children created
    above
    ((FindServiceSoapStub) findService).setHeader(myUserInfoFindHeader);

    String routeUrl = staging ? routeStagingUrl : routeProductionUrl;
    routeService = new RouteServiceLocator().getRouteServiceSoap(new
    URL(routeUrl));
    ((RouteServiceSoapStub) routeService).setUsername(userName);
    ((RouteServiceSoapStub) routeService).setPassword(password);

    //Create a SOAP Header Element and child elements to support setting
    the Distance unit for the Route Service
    SOAPHeaderElement myUserInfoRouteHeader = new
    SOAPHeaderElement("","UserInfoRouteHeader");
    MessageElement myDistanceUnit = new MessageElement("","DefaultDistanceUnit");
    myDistanceUnit .addTextNode("DistanceUnit.Mile");
    myUserInfoRouteHeader.addChild(myDistanceUnit);

    //Set the header using the SOAP Header Element and children created
    above
    ((RouteServiceSoapStub) routeService).setHeader(myUserInfoRouteHeader);

    }
    catch (Exception e) {
    ExceptionDialog.displayException(this, e);
    }


    Steven Pushee

    This posting is provided "AS IS" with no warranties, and confers no rights.
    You assume all risk for your use. 2003 Microsoft Corporation. All rights
    reserved.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Has anyone had any problems setting the value of t....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 10-26-2006, 08:43 AM
  2. European Utilities Business Unit Leader
    By florence4000 in forum News and Announcements
    Replies: 0
    Last Post: 05-26-2005, 06:38 AM
  3. Low cost GPS unit with SDK
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 11-24-2004, 09:22 AM
  4. How to change the default country setting
    By neo in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 08-13-2003, 01:29 PM
  5. Setting Speeds
    By aarunprakash in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 06-06-2003, 01:45 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25