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.
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">byte</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="token function">HandleRESTRequest</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">string</SPAN> Capabilities<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">string</SPAN> resourceName<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">string</SPAN> operationName<SPAN class="punctuation token">,</SPAN>
<SPAN class="keyword token">string</SPAN> operationInput<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">string</SPAN> outputFormat<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">string</SPAN> requestProperties<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">out</SPAN> <SPAN class="keyword token">string</SPAN> responseProperties<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
responseProperties <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">;</SPAN>
_serverLog<SPAN class="punctuation token">.</SPAN><SPAN class="token function">LogMessage</SPAN><SPAN class="punctuation token">(</SPAN>ServerLogger<SPAN class="punctuation token">.</SPAN>msgType<SPAN class="punctuation token">.</SPAN>infoStandard<SPAN class="punctuation token">,</SPAN> _soiName <SPAN class="operator token">+</SPAN> <SPAN class="string token">".HandleRESTRequest()"</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="number token">200</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Request received in Sample Object Interceptor for handleRESTRequest"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">/*
* Add code to manipulate REST requests here
* https://somearcgisserver.com/somesite/rest/services/test/ServiceNameHere/MapServer/1
* https://some3rdpartyapi.com/v1/realtime
*/</SPAN>
<SPAN class="comment token">// Find the correct delegate to forward the request too</SPAN>
IRESTRequestHandler restRequestHandler <SPAN class="operator token">=</SPAN> FindRequestHandlerDelegate<SPAN class="operator token"><</SPAN>IRESTRequestHandler<SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>restRequestHandler <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> response <SPAN class="operator token">=</SPAN> restRequestHandler<SPAN class="punctuation token">.</SPAN><SPAN class="token function">HandleRESTRequest</SPAN><SPAN class="punctuation token">(</SPAN>
Capabilities<SPAN class="punctuation token">,</SPAN> resourceName<SPAN class="punctuation token">,</SPAN> operationName<SPAN class="punctuation token">,</SPAN> operationInput<SPAN class="punctuation token">,</SPAN>
outputFormat<SPAN class="punctuation token">,</SPAN> requestProperties<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">out</SPAN> responseProperties<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//I think I need to add something here to grab the existing JSON of the mapservice and then kludge the desired attributes into it</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>operationName<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Equals</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"query"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">&&</SPAN> resourceName<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Equals</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"layers/1"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="comment token">//access the JSON of the map service here</SPAN>
<SPAN class="comment token">//access the JSON of the 3rd party rest service result</SPAN>
<SPAN class="comment token">//kludge the two together on the common attribute they share</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">return</SPAN> response<SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//return restRequestHandler.HandleRESTRequest(</SPAN>
<SPAN class="comment token">// Capabilities, resourceName, operationName, operationInput,</SPAN>
<SPAN class="comment token">// outputFormat, requestProperties, out responseProperties);</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>