NAME

Mappoint::SOAP - Client SOAP implementation for Mappoint, based on SOAP::Lite


SYNOPSIS

        use Mappoint::SOAP;
        use MIME::Base64;
        my $render = new Mappoint::Render;
        my $map = $render->GetMap(
                view => [
                        MapView => [
                                CenterPoint => {
                                        Latitude => 52.1309,
                                        Longitude => 5.42743
                                },
                                Scale => 2000000
                        ],
                ],
                options => [
                        Format => [
                                Width => 500,
                                Height => 500
                        ],
                        GeoDataSource => [
                                Name => 'MapPoint.EU'
                        ]
                ]
        );
        my $image = decode_base64($map->result->{MapImage}{Image}{Bits});
        open(GIF, ">/tmp/image.gif");
        print(GIF $image);

Example mappoint.ini file (in /etc or c:\ depending on OS)

        [credentials]
        user=MyUserid
        password=MyPassword
        [proxy]
        common=http://find.staging.mappoint.net/Find-20/Common.asmx
        find=http://find.staging.mappoint.net/Find-20/FindService.asmx
        render=http://render.staging.mappoint.net/Render-20/RenderService.asmx
        route=http://route.staging.mappoint.net/Route-20/RouteService.asmx
        [UserInfoHeader]
        DefaultDistanceUnit=km
        [Culture]
        Name=nl
        LCID=19
        [Debug]
        ;proxy=http://localhost/cgi-bin/soaptest.cgi
        ;readable=1


DESCRIPTION

Overview

This implementation is restricted to the staging services of Mappoint. (So far).

The following classes exist:

        Mappoint::Common
        Mappoint::Find
        Mappoint::Render
        Mappoint::Route

These classes reflect the remote SOAP classes as decribed at

        http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mpn20/html/mpdevHeaders.asp?frame=true

and

        http://find.staging.mappoint.net/Find-20/Common.asmx?WDSL
        http://find.staging.mappoint.net/Find-20/FindService.asmx?op=FindNearby
        http://render.staging.mappoint.net/Render-20/RenderService.asmx?WDSL
        http://route.staging.mappoint.net/Route-20/RouteService.asmx?WDSL

The Mappoint classes relay on SOAP::Lite so this module is required. The Mappoint classes only offer an easier API to the Mappoint services.

The Mappoint::SOAP is the base class for the other classes and should not be used solely.

For parsing the results from Mappoint, the MappointResult class can be used. Here an example of creating an imagemap out of the respone of GetMap method

        my $map = $render->GetMap(....);
        my $result = new Mappoint::Result($map);
        my $active_area = $result->get_first('ActiveArea');
        foreach my $hotarea_elm (@{$active_area->subitems}) {
            my $hotarea = $hotarea_elm->attr;
                foreach my $type (qw(IconRectangle LabelRectangle)) {
                        my $rect = $hotarea->{$type};
                        $tag .= sprintf('<area shape="rect" coords="%d,%d,%d,%d" href="%s">',
                                $rect->{left},
                                $rect->{top},
                                $rect->{right},
                                $rect->{bottom},
                                $hotarea->{PinID} . '.html'
                        );
                }
        }
        $tag .= '</map>';

The ini-file is required and is read at the moment the class Mappoint::SOAP is loaded.

Constructor and intialisation

The constructors do not have parameters.

Class and Object methods

Methods that all classes offer (except the Mappoint::Result related classes):

        $object->set_CustomLogEntry($value)
        $object->set_CultureName($value)
        $object->set_CultureLCID($value)
        $object->set_DefaultDistanceUnit($value)
        $object->set_ContectGeoID($value)
        $object->set_ContectGeoISO2($value)

The first method deals with the CustomerInfo header, the others deal with the UserInfoHeader.

Other methods are the same as in the description on the earlier mentiond links. However, the parameters are given in a different way. See example in SYNOPSIS. Note that an anonymous hash is used for attribute of an element and an anonymous array is used for (underlaying) elements.

The MappointResult class offers a show-method for showing the response from Mappoint in a clear way. The contructor will build a tree of Mappoint::ResultElement objects, which have a name, attributes and sub elements.

With the get_first($name) method you can get a subtree of an element with name $name. See also the example above for building the image map.


ENVIRONMENT


DIAGNOSTICS


BUGS

Probably ;-)


FILES

mappoint.ini

The mappoint.ini file supports also a [Debug] section, where a proxy can be defined you want to use for test purposes. You can also force a readable(1) so that the xml output is more readable in trace mode (when you do +trace=>'all').

        [Debug]
        proxy=http://localhost/cgi-bin/soaptest.cgi
        readable=1


SEE ALSO


AUTHOR(S)

Herald van der Breggen (herald at breggen. xs4all. nl)