The Gis Framework exposes WCF Services to perform Geometry Service Operations and Queries. This can be used to obtain GIS information for webpages that are not in the context of the GIS Framework Map.
WCF Service Set-up
Calls to the WCF Services of the GIS Framework must have a custom header added that specifies what virtual application the service call should be done in the context of.
var queryService = new GISQueryService.QueryServiceClient();
queryService.ChannelFactory.Endpoint.Behaviors.Add(new CustomHeaderBehavior());
CustomHeaderBehavior
public class CustomHeaderBehavior : IEndpointBehavior
{
public void Validate(ServiceEndpoint endpoint)
{
}
public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
{
}
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
throw new NotImplementedException();
}
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
clientRuntime.MessageInspectors.Add(new CustomHeaderMessageInspector());
}
}
CustomHeaderMessageInspector
public class CustomHeaderMessageInspector : IClientMessageInspector
{
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
string myHeaderName = "X-FDOT-GIS-Application-Id";
// The headerValue below should be the name of your Virtual Application
string myheaderValue = "GEV";
if (!request.Properties.ContainsKey(HttpRequestMessageProperty.Name))
{
request.Properties.Add(HttpRequestMessageProperty.Name, new HttpRequestMessageProperty());
}
var property = (HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name];
property.Headers[myHeaderName] = myheaderValue;
return null;
}
public void AfterReceiveReply(ref Message reply, object correlationState) { }
}
Query Service
See Main Article
Query ServiceThe QueryService can be used to perform queries and a number of other Map Related functions for an ArcGIS MapService.
Geometry Service
See Main Article
Geometry ServiceThe GeometryService contains utility methods, which provide access to sophisticated and frequently used geometric operations.
See Also