[mapguide-users] MaestroAPI - Runtime Map From Session Exception

Crispin_at_Linknode crispin.hoult at linknode.co.uk
Thu Oct 13 10:33:28 EDT 2011


Hi,

I am using the Maestro API to create a map that I edit before showing by
adding layers, changing filters etc - I know the map is created OK as it
will load in a WebLayout and I can inspect it with the GETRESOURCECONTENT
call.

However, if I try and extend my application by opening the session map then
I get an exception (see below the code).
What am I missing?  Why can't I open my session map as a runtime map?
To be clear, if I take the watch variable I am trying to open then I can
confirm that it exists in the session.

 Thanks for your help - Crispin


    // map
    IMapDefinition md =
(IMapDefinition)conn.ResourceService.GetResource(mdId);

... sometime later

    // save map
    String resMDId = "Session:" + conn.SessionID + "//ABC.MapDefinition";
    conn.ResourceService.SaveResourceAs(md, resMDId);

... in this page or in another page after the map has loaded OK

    // set groups via runtime map
    IMappingService mpSvc =
(IMappingService)conn.GetService((int)ServiceType.Mapping);
    RuntimeMap rtMap = mpSvc.OpenMap(resMDId);


Exception: Runtime maps must be in the current session repository


   at OSGeo.MapGuide.MaestroAPI.PlatformConnectionBase.OpenMap(String
runtimeMapResourceId) in
e:\Projects\Maestro\OSGeo.MapGuide.MaestroAPI\PlatformConnectionBase.cs:line
1818
   at _Default.Page_Load(Object sender, EventArgs e) in
e:\Projects\ABC\mapFrame.aspx.cs:line 195
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e)
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

-----
linknode.co.uk 
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/MaestroAPI-Runtime-Map-From-Session-Exception-tp6889144p6889144.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list