Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MgServiceNotSupportedException: The specified service is not supported

1 REPLY 1
Reply
Message 1 of 2
kdelcroix
375 Views, 1 Reply

MgServiceNotSupportedException: The specified service is not supported

Hello,

I would like to enumerate all resources but I get an Exception everytime I try to get a MgResourceService object:
"org.osgeo.mapguide.MgServiceNotSupportedException: The specified service is not supported."

But when I browse MapAgent ( Services API > "Resources" > "EnumerateResources"), I can retrieve the resources.

Here the source code I'm using:
----------------------------------------------
{code}
MapGuideJavaApi.MgInitializeWebTier("C:\\Program Files\\MapGuideOpenSource2.0\\Server\\Bin\\serverconfig.ini");
MgUserInformation cred = new MgUserInformation("Administrator", "admin");

// Connect to the site and get a feature service and a resource service instances
MgSiteConnection siteConn = new MgSiteConnection();
siteConn.Open(cred);

// Create a session repository
MgSite site = siteConn.GetSite();
sessionId = site.CreateSession();

// >>>> THE EXCEPTION OCCURS AT THE FOLLOWING LINE <<<<
MgResourceService resourceSrvc = (MgResourceService)siteConn.CreateService(MgServiceType.ResourceService);

// Enumerates all maps in the library
MgResourceIdentifier resourceId = new MgResourceIdentifier("Library://");
MgByteReader mgBR = resourceSrvc.EnumerateResources(resourceId, -1, "MapDefinition", false);
System.out.println("-------------------------MAPS----------------------------");
System.out.println(mgBR.toString());
System.out.println("---------------------------------------------------------");
}
catch(MgException mge)
{
mge.printStackTrace();
}
{code}
----------------------------------------------

I checked in MapAdmin if the service was well set... but I have seen nothing wrong.

Thanks to post a suggestion if you have an little idea.

Edited by: kdelcroix on Feb 17, 2009 10:40 AM
Added "code" tags Edited by: kdelcroix on Feb 17, 2009 10:41 AM
Better visibility of the line generating the error
1 REPLY 1
Message 2 of 2
kdelcroix
in reply to: kdelcroix

If found the error: the file I gave to the initializer was not the good file. Here is the good line code for the initializer:
{code}
MapGuideJavaApi.MgInitializeWebTier("C:\\Program Files\\MapGuideOpenSource2.0\\WebServerExtensions\\www\\webconfig.ini");
{code}

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report