Dear List,
We have an application that is making bulk requests to NAServer enabled on the map service. To tune and optimize the performance, we plan to consolidate all requests in a single request that should be handled by an SOE that would internally use NAServer for all the requests. So far I have been unable to find the path to acquire INAServer(2)`s reference from ServerObjectHelper that is passed in the init() method of SOE. Has anybody tried this before, or does the SOE need to load NA capabilities by accessing the actual MXD?
IMapServer3 ms = (IMapServer3) this.soHelper.getServerObject();
IServerObjectExtensionManager soeManager = new IServerObjectExtensionManagerProxy(ms);
IServerObjectExtension soe = soeManager.findExtensionByTypeName("NAServer"); // this is null ....tried Network Analyst, NA, NA_Server, NA_Extension
INAServer2 naServer = (INAServer2)soe ; // this is NULL
Solved! Go to Solution.
It turns out that above code does not work inside init() method. Reference to NAserver can be obtained by same code when run after initialization of SOE is completed. So if you want to use NAserver in a REST/SOAP operation, below method can be used to get reference.
private INAServer2 getNAServerRef(){
if(this.naServer2 != null)
return this.naServer2;
try {
this.naServer2 = (INAServer2)((IServerObjectExtensionManager)this.soHelper.getServerObject()).findExtensionByTypeName("NAServer") ;
return naServer2;
} catch (AutomationException e) {e.printStackTrace();
} catch (IOException e) {e.printStackTrace();
}
return naServer2;
}
It turns out that above code does not work inside init() method. Reference to NAserver can be obtained by same code when run after initialization of SOE is completed. So if you want to use NAserver in a REST/SOAP operation, below method can be used to get reference.
private INAServer2 getNAServerRef(){
if(this.naServer2 != null)
return this.naServer2;
try {
this.naServer2 = (INAServer2)((IServerObjectExtensionManager)this.soHelper.getServerObject()).findExtensionByTypeName("NAServer") ;
return naServer2;
} catch (AutomationException e) {e.printStackTrace();
} catch (IOException e) {e.printStackTrace();
}
return naServer2;
}