开发者

push message to biztalk orchestration from webservice

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


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜