Ticket #659 (closed defect: fixed)
WebAPI "Cannot establish connection". on different machine than server
| Reported by: | zspitzer | Owned by: | |
|---|---|---|---|
| Priority: | medium | Milestone: | |
| Component: | Web API | Version: | 2.0.1 |
| Severity: | minor | Keywords: | |
| Cc: | External ID: |
Description
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
