views:

238

answers:

1

Up until now I've only been using orchestrations in my BizTalk application and it's been working fine so far. But now I want to convert some of the unnecessary orchestrations to pure message routing instead in order to get better performance.

I've got a WCF service with only one method and that works fine because I can set the BtsActionMapping to only that single method. But the second WCF service I've got has two methods and now BizTalk doesn't know how to route my message. I've read everywhere that you need to set BTS.Operation in a custom pipeline to get it to work. But I've searched all over the place for a tutorial or example on how to do this.

I've been trying to implement the IBaseComponent, IComponentUI, IComponent and IPersistPropertyBag interfaces to do this. Am I going in the right direction or I'm I way off? Can anyone point me to an example or better yet show me how to do this?

A: 

The easiest way to get started writing a custom pipeline component is to use the BizTalk Server Pipeline Component Wizard; it will generate all the boilerplate for you. I've also got several custom pipeline components you can use as an example, a few that are very close to what you need (i.e. a component that just sets a custom message property) can be seen here.

As for setting the property, all you need to do is call message.Context.Write/Promote and pass in the namespace and name of the property, in this case those would be "http://schemas.microsoft.com/BizTalk/2003/system-properties" and "Operation" respectively.

tomasr
Thanks for the answer and it seems like I was on the right track. With the code you provided I have now written my custom component.However it seems like I can't get it to execute. I've created a receive pipeline and put the custom component in the disassembler. Then I attached the pipeline onto the send port. With this I still get that the BTS.Operation is not set. Do I need to import/include any BizTalk schema into my schema? Or did I do something wrong when creating and deploying my pipeline?
It's hard to say what might be going wrong without knowing more details. However, some things worth looking into: Make sure you're setting the property in the right place (right pipeline). Also, is there a reason you want to go through the BTS.Operation + Adapter Action mapping route, instead of directly setting the WCF.Action property?
tomasr
Well in the books I've got it says that's the way it had to been done and then me googling around to find the answer on how you do it I found no other solution... so I've never thought of doing it any other way. But you are right setting the WCF.Action property is probably the better solution to the problem. So now I've got two send ports that uses the single action header to decide what method to call in the web service.