4

I am consuming some map services in my WCF services and for each service that I have I get the client object via this code. Every new service that I add, I get the client object this way. I am curious if I can consume the map service using it's URL so that I dont have to add the map service as a service reference. I would like to use the URL of map service to create client object. Appreciate any feedback.

MapServerPortClient client = new WellMapService.MapServerPortClient(); OR MapServerPortClient client = new PipelineMapService.MapServerPortClient();

1

You can use one of the overloads which the generated client class constructor provides. It allows you to specify a different address upon the client instantiation.

new WellMapService.MapServerPortClient(
    "MapServerPort", // endpoint name (from app.config/web.config)
    "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer" // url used instead of the one in the config file
    );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.