[mapguide-users] Problem with $resourceService (PHP)

Galois amihalas at yahoo.gr
Wed Oct 29 09:33:06 EDT 2008


Hello,

I have two problems so If anyone knows something I would appreciate his/her
help.

Problem 1
when I define a resourceService, my page doesn't show.

The code is copy - paste from Dev's Guide:

<?php
	$installDir = 'C:\Program Files\MapGuideOpenSource\\';
	$extensionsDir = $installDir . 'WebServerExtensions\www\\';
	$viewerDir = $extensionsDir . 'mapviewerphp\\';
	include $viewerDir . 'constants.php';
	
	MgInitializeWebTier($extensionsDir . 'webconfig.ini');
	
	$site = new MgSite();
	$site->Open(new MgUserInformation("Administrator", "admin"));
	$sessionId = $site->CreateSession();
	
	$webLayout
="Library://GoSpatial/WebLayout/Autostrada+Brescia+Padova+Map.WebLayout";
	
	// Get the user information using the session id,
	// and set up a connection to the site server.
	$userInfo = new MgUserInformation($sessionId);
	$siteConnection = new MgSiteConnection();
	$siteConnection->Open($userInfo);
	
	// Get an instance of the required service(s).
	$resourceService =
$siteConnection->CreateService(MgServiceType::ResourceService);
	
	
        // Display the spatial reference system used for the map.
	$map = new MgMap();
	$map->Open($resourceService, $mgMapName);
	$srs = $map->GetMapSRS();
	
?>
<html>
<head>
<title>Simple Sample Application</title>
</head>
<body marginheight="0" marginwidth="0">
<iframe id="viewerFrame" width="100%" height="100%" frameborder=0
scrolling="no"
src="http://127.0.0.1:8008/mapguide/mapviewerajax/?SESSION=<?=$sessionId?>&WEBLAYOUT=<?=
$webLayout ?>&username=Administrator&password=admin"></iframe>
</body>
</html>

If I comment the lines from where I define $resourceService till the end of
php script, my map is loading...

Problem 2
When I try to run the phpSamples (for example the Hello Map) and I press on
the "Display Spatial Reference  ", I get the following error:

"Error: Invalid argument(s): [1] = "" The session ID is invalid because the
session separator character was not found. Exception occurred in method
MgUserInformation.SetMgSessionId at line 165 in file
c:\build_bond_area\mapguide_open_source_v1.2\build_18.1\mgdev\common\mapguidecommon\System/UserInformation.cpp"

Generally, I cannot run any of the samples...

Thanks in Advance!
-- 
View this message in context: http://www.nabble.com/Problem-with-%24resourceService-%28PHP%29-tp20227195p20227195.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list