I think that you're looking for the closest facility task. Take a look at this link and see if it helps.
About performing a remote geoprocessing operation without using the client APIs, you can always talk directly to the REST API but I do not recommend this approach, unless you have good reasons to consider it. Remember that, if you talk directly with the REST API the de/serialization functions (and some other functions) are entirely on you.
Hi Pepatosp
thank you very much for quick turnaround. The closest facility task would only work with point features (in the near feature layer),
not sure whether it would work for lines and polygons. Correct me, If I am wrong. In my case, I would like to calculate distance between the input location and near features ( which can be point, line and polygons). If the near feature is a line or polygon, then, it should calculate the distance of the nearest vertices from the line or polygon rather than the centroid of the near line or polygon features.
I think, for this kind of analysis, We should use Generate Near Table in Arctoolbox and publish them as a Geoprocessing service.
this should help me solve the problem. Just wondering, if anyone, has published geoprocessing service like this and use them in their application. If so, can you point me to the right link, please. Or If there is any other better way of doing this, would also be of great help.
Regards
Ganesh
I
Ganesh, you're right.
I misunderstood your requirements. When you said that you want to use any kind of feature, I've thought about using the polygon centroids (in case of polygons) and the line middle points. If you need the closest vertices, this solution won't work.
I don't know the how the arctoolbox tool that you talk works, so I think that I can't help here.