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

Axis2 with MapPoint 4.5 Java?

This is a discussion on Axis2 with MapPoint 4.5 Java? within the Bing Maps and MapPoint Web Service forums, part of the Map Forums category; Is MapPoint 4.5 compatible with Axis2? I cannot seem to generate all of the classes using wsdl2java. For example, MapPoint ...

  1. #1
    trowland is offline Junior Member White Belt
    Join Date
    May 2007
    Location
    Connecticut
    Posts
    5

    Axis2 with MapPoint 4.5 Java?

    Is MapPoint 4.5 compatible with Axis2? I cannot seem to generate all of the classes using wsdl2java. For example,

    MapPoint 3.0 with Axis 1.2 produced:
    RenderService.java
    RenderServiceLocator.java
    RenderServiceSoap.java
    RenderServiceSoapStub.java

    MapPoint 4.5 with Axis2 produces:
    RenderService.java
    RenderServiceCallbackHandler.java
    RenderServiceMessageReceiverInOut.java
    RenderServiceSkeleton.java
    RenderServiceStub.java

    I have also found other differences, e.g. Format.setHeight(Integer) is now format.setHeight(int), and several others similarly. Is it correct that MapPoint 4.1 is fully backward-compatible but 4.5 is not?

    Thank you
    Tom
    thomas.rowland@priceline.com

  2. #2
    trowland is offline Junior Member White Belt
    Join Date
    May 2007
    Location
    Connecticut
    Posts
    5

    Re: Axis2 with MapPoint 4.5 Java?

    Yes mappoint 4.5 works fine with axis2. The mappoint types are generated as inner classes to the stub. You access everything through the stub. Generating the Java classes is almost the same as in axis1, except axis2 provides a .bat file you can use, and also some of the switch parameters are slightly different.

    Here is an example of generating the class files using ADB. You can also use JIBX or XMLBeans if you wish - let me know how that works out! Also make sure you also have all of the jar files in your classpath:

    wsdl2java -uri http://staging.mappoint.net/standard-30/mappoint.wsdl -ns2p http://s.mappoint.net/mappoint-30/=c...er.mappoint_45, http://s.mappoint.net/v40/=com.myapp...er.mappoint_45 -o .\mp45classfiles -g -t -wv 1.1 -d adb -ssi

    This creates the following files:

    CommonServiceCallbackHandler.java
    CommonServiceStub.java
    FindServiceCallbackHandler.java
    FindServiceStub.java
    RenderServiceCallbackHandler.java
    RenderServiceStub.java
    RouteServiceCallbackHandler.java
    RouteServiceStub.java

    You only need to use the stubs unless you are using asynch then you want to also make use of the callback handlers.

    Here is an example of using the RenderServiceStub to call the GetMap() method on a GetMap object:

    /*************************************
    * create your
    MapSpecification obj
    ************************************/

    MapSpecification spec = new MapSpecification();
    spec.setViews(aViews);
    spec.setDataSourceName("MapPoint.NA");
    spec.setOptions(options);
    spec.setPushpins(aPushpins);

    /*************************************
    * the Stub
    ************************************/
    RenderServiceStub stub = new RenderServiceStub();

    /**************************************
    * Authenticator
    ************************************/
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(MapManagerParams.getUsername());
    auth.setPassword(MapManagerParams.getPassword());
    auth.setPreemptiveAuthentication(true);

    /**************************************
    * ServiceClient options
    ************************************/
    Options options = stub._getServiceClient().getOptions();
    options.setProperty(HTTPConstants.AUTHENTICATE, auth);
    options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(90000));
    options.setProperty(HTTPConstants.CONNECTION_TIMEO UT, new Integer(90000));

    // make sure we are using HTTP 1.0 and not 1.1
    options.setProperty( org.apache.axis2.context.MessageContextConstants.H TTP_PROTOCOL_VERSION,
    org.apache.axis2.transport.http.HTTPConstants.HEAD ER_PROTOCOL_10);

    //-- set the EndpointReference (the RenderServicURL)
    EndpointReference endpoint = new EndpointReference(sEndpoint);
    options.setTo(endpoint);

    /*************************************
    * GetMap object
    ************************************/
    RenderServiceStub.GetMap getMap = new RenderServiceStub.GetMap();
    getMap.setSpecification(spec);

    /*************************************
    * CustomerInfoRenderHeader
    ************************************/
    CustomerInfoRenderHeader custInfoRenderHeader = new CustomerInfoRenderHeader();
    custInfoRenderHeader.setCustomLogEntry((short) 20);

    CustomerInfoRenderHeader0 custInfoRenderHeader0 = new CustomerInfoRenderHeader0();
    custInfoRenderHeader0.setCustomerInfoRenderHeader( custInfoRenderHeader);

    /*************************************
    * UserInfoRenderHeader
    ************************************/
    UserInfoRenderHeader userInfoRenderHeader = new UserInfoRenderHeader();
    userInfoRenderHeader.setDefaultDistanceUnit(Distan ceUnit.Mile);
    // CultureInfo
    CultureInfo cult = new CultureInfo();
    // cultureInfo.setLcid(5);
    cult.setName("en-us"); // default is en-US
    userInfoRenderHeader.setCulture(cult);
    // countryRegionContext
    CountryRegionContext ctx = new CountryRegionContext();
    ctx.setEntityID(244);
    userInfoRenderHeader.setContext(ctx);
    UserInfoRenderHeader6 userInfoRenderHeader6 = new UserInfoRenderHeader6();
    userInfoRenderHeader6.setUserInfoRenderHeader(user InfoRenderHeader);

    /*************************************
    * Send the Request
    ************************************/
    GetMapResponse mapResponse =
    stub.GetMap(getMap,custInfoRenderHeader0,userInfoR enderHeader6);

    /*************************************
    * get the images from the Response
    ************************************/
    ArrayOfMapImage aImages = mapResponse.getGetMapResult();
    MapImage[] images = aImages.getMapImage();


    The above shows that working with the stubs and the ServiceClient are quite different using axis2, however working with the mappoint api has only changed slightly. E.g. the method params that used to be objects are now primitives, e.g.:
    pushpins[0].getLatLong().setLatitude(new Double(42.264779115928796));
    is now
    pushpins[0].getLatLong().setLatitude(42.264779115928796);
    Another difference in the mappoint api is that every service method requires a userInfoHeader and customerInfoHeader param. Look at my code above to see how these are set - it tripped me up!

    One other difference in using axis2 was that there is no longer a client-config.wsdd. I have set those params programmatically here, but you can also use an axis2.xml file in its place.

    Here are some references that may help you with axis2:

    Axis2/Java - Axis2 Reference Guide
    Axis2/Java - Migrating from Axis 1.x
    Apache Axi2/Java | WSO2 Oxygen Tank
    Axis2 FAQ


    thanks,
    Your experiences/feedback are much appreciated!
    Tom
    thomas.rowland@priceline.com


Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Mappoint java support
    By Anonymous in forum Bing Maps and MapPoint Web Service
    Replies: 9
    Last Post: 02-20-2009, 01:28 AM
  2. Integration of MapPoint in Java application
    By Shukri in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 10-03-2008, 08:31 AM
  3. Using MapPoint 2003 with Java
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 09-19-2008, 12:46 PM
  4. mappoint cd development in java?
    By nprimex1 in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 03-23-2006, 12:18 PM
  5. something like mappoint, but for java...
    By Joeba in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-03-2002, 10:14 AM

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