views:

97

answers:

3

Hi all,

I have created a BizTalk orchestration that sents a message to a wcf webservice, the webservice creates a task on sharepoint, and the orchestration receives a response (just a string "succes"). Now I also created an eventhandler in sharepoint when someone changes a task to "complete" some code can be executed. I want to be able to send a message to a biztalk orchestration when someone "completes" a task. How can I do this?

I can call the webservice from sharepoint, but how do I push the message to the biztalk orchestration? If I "consume a wcf service" in my orchestration, a send-receive port is being created, but I only want to "receive" the message from the webservice. So the webservice has to push the message to the orchestration.

Thank you

A: 

What does the web service that you are trying to consume look like? Does is it have a return value? You could just send back "success" as you do in the other case.

Shiraz Bhaiji
The webservice just sends a string for now, what I want to do is when something invokes the webservice (not from biztalk, but from sharepoint) I want to send a message to the biztalk orchestration (example: a string with the title of a task). So I dont think I can simply consume the wcf service in biztalk, because the service doesn't expect an input, it just sends messages to biztalk)
Rise_against
@RiseAgainst - yes, you are right, you will need to publish (expose) a WCF service from BizTalk. The easiest way to do this is from the WCF Publication Wizard (but this also requires IIS)
nonnb
+2  A: 

If I understand you correctly, you use a WCF Service to send a task to SharePoint (you may be able to use the BizTalk SharePoint Adapter to do this directly - I have ner used it, but I think this is the kind of thing it can do). The event handler in SharePoint fires when the task is marked complete and then sends a message back to BizTalk.

To get the message back to BizTalk, you will need to create a WCF Receive Location. This receive location can be either one way or two way. These are really both two way receive ports. The Port receives the message from SharePoint via WCF and then sends a repsonse back to SharePoint to ack the receipt. BizTalk considers it a one way receive port if it only sends back an ACK. It considers it a two way receive port if it sends back the ACK along with a message.

So in a nutshell, you need to set up this second receive port in the orchestration. Publish it as a WCF web service. You also need to set up correlation so that the message can find its way back to the correct orchestration instance. Here is a good blog post on correlation: http://mstecharchitect.blogspot.com/2009/03/message-correlation-in-biztalk-2006.html.

The key to successful correlation is having a promoted property in each message that can be used to tie them back togeather. So the task you send to SharePoint should have a unique TaskID (or whatever). And the response from SharePoint should have that same promoted property in the repsonse.

ChrisLoris
+1  A: 

Just to add to Chris's post (+1) - BizTalk is very flexible about how you return the success (or failure) from the workflow in Sharepoint back to the orchestration - you can use anything from writing a file in a directory using the file adapter, to emailing it to an SMTP receive port, to writing a record in a database and polling from BizTalk using the SQL adapter.

To expose an orchestration (or receive ports in it) as a WCF service, the easiest way is to use the WCF Publishing Wizard (Tools | WCF Publishing Wizard in Visual Studio). This will walk you through creating the ports in BizTalk, and publishing the web service and Mex / WSDL under IIS. From this you will be able to add a Web / Service Reference from your Sharepoint App. One gotcha is to make sure that the App under IIS is running. Note that it is also possible to get BizTalk to host the WCF directly, but this is a bit more complicated.

nonnb
I have created a send port of "WCF-Custom" type and filled in an address, binding set to "customBinding" and modified the authentication modes and credentials for the port. I enabled the port and if I surf to the url is see a message "metadata publishing for this service is currently disabled". How can I fix this and how can I reach the port from my webservice?
Rise_against
Nevermind, I fixed it by configuring the metadata publishing. Now how can I call this port from a project? I added a service reference to the receiveport webservice and created a new instance of it. Now I see there is a method "BizTalkSubmit" but I need to give a Channels.Message with the method. How do I create this message?
Rise_against
The Channels.Message will represent the schema of the message that BizTalk is expecting in the Receive on the orchestration - the proxy entity created on the service reference should have typed fields for every element of the schema. As per Chris' post, you will need to correlate the call back into the orchestration using some piece of identifying / continuation data.
nonnb