AnsweredAssumed Answered

Kluge new attributes into map service (SOI)

Question asked by jamesfreddyc Champion on May 15, 2019
Latest reply on Jul 8, 2019 by jamesfreddyc

I started with an SOI project and attempting to create an interceptor that will take the contents of a map service (layer 1) and kludge some new attributes from some other JSON I have pulled in another request.  


Which sample would be closest to what I'd like to attempt?

 

This YouTube Video is doing what I'd like but is in Java and not C# and I'm having difficulty understanding.

 

I have a simple SOI.sln setup and just starting to try and fill in the correct areas.

 

public byte[] HandleRESTRequest(string Capabilities, string resourceName, string operationName,
            string operationInput, string outputFormat, string requestProperties, out string responseProperties)
        {
            responseProperties = null;
            _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".HandleRESTRequest()",
                200, "Request received in Sample Object Interceptor for handleRESTRequest");

            /*
            * Add code to manipulate REST requests here                         
            * https://somearcgisserver.com/somesite/rest/services/test/ServiceNameHere/MapServer/1
            * https://some3rdpartyapi.com/v1/realtime
            */


           

            // Find the correct delegate to forward the request too
            IRESTRequestHandler restRequestHandler = FindRequestHandlerDelegate<IRESTRequestHandler>();
            if (restRequestHandler == null)
                return null;

            var response = restRequestHandler.HandleRESTRequest(
                       Capabilities, resourceName, operationName, operationInput,
                       outputFormat, requestProperties, out responseProperties);

            //I think I need to add something here to grab the existing JSON of the mapservice and then kludge the desired attributes into it
            if (operationName.Equals("query") && resourceName.Equals("layers/1"))
            {
                //access the JSON of the map service here
                //access the JSON of the 3rd party rest service result
                //kludge the two together on the common attribute they share
            }

            return response;

            //return restRequestHandler.HandleRESTRequest(
            //        Capabilities, resourceName, operationName, operationInput,
            //        outputFormat, requestProperties, out responseProperties);
        }

Outcomes