When moving Windows Workflow Foundation (WF) applications between dev/test/production environments, one of the first questions asked about the InvokeWebServiceActivity shape is how to dynamically change the URL of the web service call at runtime. The appropriate place to implement this is in the Invoking event of the shape, since it is raised before the web request. The below code will achieve this
Private void WebServiceInvoking(Object sender, InvokeWebServiceEventArgs e)
{
NamespaceofWebServiceClass.ClassName objWebService;
objWebService = (NamespaceofWebServiceClass.ClassName)e.WebServiceProxy;
objWebService.Url = ConfigurationManager.AppSettings[“WebServiceURL”];
}