Greetings all, Alex Malek here - I'm a member of the SharePoint workflow team. This week at PDC, I did a breakout session on how to call an external system from a SharePoint Workflow. Let's walk through what that process looks like!
Note: I've already gone and created a WCF Service called "EmployeeUpdate” that has a single Operation called "UpdateEmployeeDB"
The easiest way to work with a WCF from .net is to have VS create a “proxy class”, which abstracts all the service calls behind a nice interface. You can do this easily using the “Add Service Reference” feature.
Creating the Service Reference endpoint also adds a "App.config" file to your local project, with a "System.ServiceModel" element. However, SharePoint doesn’t read from app.config files, so for SharePoint to be able to call this endpoint, you need to copy that configuration data to your local web.config.
Since SharePoint is built on .net 3.0, it is not supported to use the new Send/Receive Activities that were added as part of .net 3.5. Instead, we’ll use a code activity to work with the Service via code.
CustomEmployeeDatabase.Workflow1Client client = new CustomEmployeeDatabase.Workflow1Client("WSHttpContextBinding_IWorkflow1");
4. Since my service is local, I’ll use the default network credentials to interact with the service. You’ll need to modify depending how your service is secured.
client.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
5. Last, but not least, you can now call your operation, just as if it was a local function.
string result = client.UpdateEmployeeDB();client.Close(); <- don’t forget to close your connection
That's it! You can now hit F5 to test your workflow.
There you have it - calling web services from SharePoint workflows. If you run into trouble, double-check that you properly copied the configuration information from app.config into your SharePoint web.config.
Thanks!-Alex Malek
PingBack from http://mstechnews.info/2008/11/calling-a-wcf-service-from-a-sharepoint-workflow-using-visual-studio/
A useful post no doubt, but what's it doing in the **SharePoint Designer** blog.
It's not for the SPD workflow, it's for workflow done with Visual studio !
Or did I miss something ?
Top News Stories Can Microsoft Keep SharePoint Rolling? (InformationWeek) Microsoft has a juggernaut
Nach längere Zeit habe ich mal wieder die Kaffeetasse hervorgekramt und stelle wieder ein paar interessante
Una vez más, os presentamos el tradicional recopilatorio de enlaces y recursos interesantes que en torno
Direkter Download: SPPD-105-2008-11-10 Aktuell SharePoint Guidance - November 2008 SharePointPartner.de
Direkter Download: SPPD-105-2008-11-10 Aktuell SharePoint Guidance - November 2008 SharePointPartner