[mapguide-users] Using .NET Api to connect from a different Machine

Johann Nothbauer nothbauer at rmdata.at
Thu Jul 17 08:04:21 EDT 2008


Hi all!

I'm trying to use the .NET Api to establish a connection to a Mapguide 
2.0.1 Site without using a Web Viewer. My Application is a smart client 
and should run on a different Machine the MapGuide Server runs on.

So I tried the following (in a Winforms Button_Click):

MapGuideApi.MgInitializeWebTier("webconfig.ini");
// Connect to the site.
MgUserInformation userInfo = new MgUserInformation("Administrator", 
"admin");
MgSiteConnection siteConnection = new MgSiteConnection();
siteConnection.Open(userInfo);
MgResourceService resService = 
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService); 


This works so far, but when I try to use the Resource-Service like this:
MgResourceIdentifier resID = new MgResourceIdentifier("Library://");
MgByteReader resEnum = resService.EnumerateResources(resID, -1, "");

the API throws get an "OSGeo.MapGuide.MgConnectionFailedException" 
(Message: "Cannot establish connection").

The same code works on the MapGuide Server Machine.

Is it possible to use the API to connect to a Mapguide Server on a 
different machine? Or do I have to use the Web-API (XML) over HTTP? I 
can change all my firewall rules, no problem.

Any Ideas?
Thanx,
Nothi






More information about the mapguide-users mailing list