I have Print and Map Services on same physical server and web application (developed using ArcGIS Javascript API) also deployed on same server. Web application consumed both print and map services.
When Print Task request send to server using LiveIP, at that moment Print Task crated json. This json has Map service with LiveIP. But i need localIP in Map service because Print Task request (using Live IP) send and now request is on server and its need to use Map service so Map service should have LocalIP in json.
var printTask = new PrintTask("http://<LIVEIP>:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export Web Map Task");
To achieve this task i develop following code;
Step 1: alert(map.getLayer(map.graphicsLayerIds).url) //Display LiveIP
Step2:
map.getLayer(map.graphicsLayerIds).url = http://<ServerLocalIP:port>/arcgis/rest/services/<serviceName>/MapServer/0 (Map object updated as per requirement)
Step3:
var params = new PrintParameters();
params.map = map;
Step4:
printTask.execute(params, function (evt) {
//
}
I checked in fiddler after send request ("printTask.execute"), the created json has LiveIP in Rest service URL instead of LocalIP.
Thanking you in advance.