[mapguide-users] Storing WebLayout in Session Repository

Hidekazu Shimaji hshimaji at ybb.ne.jp
Thu Feb 22 06:30:25 EST 2007


Hello,

Not "NeulingenALK.Map" but "NeulingenALK.MapDefinition" is required for the WebLayout.
I tried the same way of you, but it did not work.
I don't know why.  I finally gave up using the MgMap class, 
and used the SetResource function for setting a xml of the MapDefinition.

Does anybody know about it?

Regards,
Hidekazu Shimaji

--- Gunter Becker <gunter.becker at CSOGIS.DE> wrote:

> 
> OK your code works for me but now I got the problem that the map isn't shown
> in the AjaxViewer. Instead I got hte following error message:
> 
>   An unclassified exception occurred. Exception occurred in method
> MgMap_Create__SWIG_0 at line 681 in file .\MgApi_wrap.cpp
> 
> My Query to launch AjaxViewer:
> 
>  
>
http://geo19/mapguide/mapviewerajax/?SESSION=bb143bae-ffff-ffff-8000-000476dc3d5a_en&amp;WEBLAYOUT=Session:bb143bae-ffff-ffff-8000-000476dc3d5a_en//Current.WebLayout
> 
> XML representation of the WebLayout:
> 
>   <?xml version="1.0" encoding="utf-8" ?> 
>   <WebLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xsi:noNamespaceSchemaLocation="WebLayout-1.0.0.xsd">
>       <Title>ALK Neulingen</Title> 
>       <Map>
>          
> <ResourceId>Session:279a9b8c-0000-1000-8000-000476dc3d5a_en//NeulingenALK.Map</ResourceId>
> 
>           <HyperlinkTarget>TaskPane</HyperlinkTarget> 
>       </Map>
>       ...
> 
> Must the <ResourceId> be of Type "MapDefinition" or is "Map" also OK?? 
> 
> To make things clear:
> 
> My intention is to store the WebLayout into the session repository to give
> the user the ability to leave the AjaxViewer and go to another webpage of my
> application and then return to the AjaxViewer. All of the changes he had
> done before leaving the map (changing colors, adding layers, ..) should be
> avbailable after loading WebLayout stored in session.
> 
> Is that the right way to this ??
> 
> 
> Hidekazu Shimaji wrote:
> > 
> > Hello,
> > 
> > I don't think the ResourceHeader is the cause.
> > You have to set the content of xmlWebLayout to byteArray.
> > 
> > How about do like this:
> > 
> > --- the code start
> > //save the xml to MemoryStream
> > System.IO.MemoryStream stream = new System.IO.MemoryStream();
> > xmlWebLayout.Save(stream);
> > // get byte array from the MemoryStream
> > byte[] byteArray = stream.ToArray();
> > //convert byte array to string without the first byte(BOM)
> > string outerXml = System.Text.Encoding.UTF8.GetString(byteArray, 1,
> > byteArray.Length - 1);
> > // convert string to byte array with the utf-8 encoding 
> > byteArray = System.Text.Encoding.UTF8.GetBytes(outerXml);
> > 
> > // store the WebLayout in Session-Repository
> > MgByteSource byteSource = new MgByteSource(byteArray,
> >    byteArray.Length);
> > byteSource.MimeType = MgMimeType.Xml;
> > MgResourceIdentifier userWebLayoutId = new
> >     MgResourceIdentifier("Session:" + sessionId + @"//Current." +
> >     MgResourceType.WebLayout);
> > 
> > resourceService.SetResource(userWebLayoutId, byteSource.GetReader(),
> > null);
> > --- the code end
> > 
> > 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Storing-WebLayout-in-Session-Repository-tf3265925s16610.html#a9096652
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 



More information about the mapguide-users mailing list