I have a very strange issue while using MapScript from within some web service
projects. I have different projects/applications for different services - one
for each of WCF, WMS, WFS, and WMTS - so we can configure them independently.
MapScript requests work fine for all of them separately but if I access
MapScript from one and then another, one of them will not work correctly
anymore. The requests will return success (result == 0) and the format returned
is correct but the data is either null or an incorrect image. It doesn't seem
to be a threading issue since I can bombard any one of the services with
asynchronous requests and they are handled fine and the problems don't
necessarily come while using the different applications at the same time - just
one then the other.
I am using a support project for making the MS requests that is referenced by
each application (though I tried putting the code directly in each app with the
same results). Below is a simplified version of the helper utility I am using.
Is there anything that stands out as being an obvious issue? My endpoint
applications simply get the query parameters from the url request and pass them
as the requestParams argument with the appropriate map file.
namespace MapScript
{
public class MapScriptResponse
{
public string Format { get; set; }
public byte[] Data { get; set; }
public string ErrorString { get; set; }
public DateTime LastModified { get; set; }
}
public class MapScriptUtilities
{
/// <summary>
/// Execute a service request to mapserver through mapscript
/// </summary>
/// <param name="mapFile">Physical path to the map file on
which to make the request</param>
/// <param name="requestParams">List of request
parameters</param>
/// <returns>The response from mapscript.</returns>
public static MapScriptResponse ServiceRequest(string
mapFile, Dictionary<string, string> requestParams)
{
MapScriptResponse response = new MapScriptResponse();
mapObj map = new mapObj(mapFile);
OWSRequest owsRequest = new OWSRequest();
Dictionary<string, string>.Enumerator en =
requestParams.GetEnumerator();
string paramName = "";
string paramValue = "";
while (en.MoveNext())
{
paramName = en.Current.Key;
paramValue = en.Current.Value;
owsRequest.setParameter(paramName,
paramValue);
}
mapscript.msIO_installStdoutToBuffer();
int resultCode = map.OWSDispatch(owsRequest);
if (resultCode == 0)
{
response.Format =
mapscript.msIO_stripStdoutBufferContentType();
response.Data =
mapscript.msIO_getStdoutBufferBytes();
}
return response;
}
}
}
Any help would be greatly appreciated.
Brian
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users