Steps on create Biztalk
1 Create BizTalk project
1. Create a WCF service “OrderService” and enable the service on IIS. (Figure1.1)
Figure1.1
2. Create another WCF service “SampleService” and enable the service on IIS.(Figure 1.2)
Figure1.2
3. Create a new biztalk project named WcfTransactionInbiztalk.Consume two WCF services in biztalk we created right now. (Add->Add generated items ->consume WCF service). (Figure 1.3)
Figure 1.3
4. Delete OrderProcessServiceType.odx, and we will only useSampleProcessServiceType.odx .
5. Add a new schema named InAndOutMessageSchema.xsd.
6. Create five messages.
InMessage, Message type is “InAndOutMessageSchema”.
OutMessage, Message type is “InAndOutMessageSchema”.
OrderServiceRequestMessage , Message type is “OrderServiceRequest”
OrderServicerResponseMessage, Message type is “OrderServiceResponse”
SampleServiceRequestMessage, Message type is “SampleServiceRequest”
SampleServicerResponseMessage, Message type is “SampleServiceResponse”
In SampleProcessServiceType.odx:
7. Create a scope, set the transaction type to “Long Running”; Create a new one way receives port “InMessagePort” on port surface and set the transport to “file”, set the URI to a local directory (such as d:\in\*.xml). And set message to “InAndOutMessageSchema” schema.(Figure 1.4)
Figure 1.4
8. Create a new receive “InMessageReciever”, set the message to InMessage and set Operation to InMessagePort.Operation_1.Request.
9. Create a transform, set the source to “InMessage”, set the destination to OrderServiceRequestMessage.(Figure 1.5)
(Figure 1.5)
10. Create a new send “OrderRequestSend”, set the message to OrderServiceRequestMessage.
11. Create a new Receive “OrderResponseRecieve”, set the message to OrderServiceRequestMessage.
12. Create a new Request-Response port “OrderServicePort”, and set the message type of request to OrderServiceRequest schema, set the message type of response to OrderServiceResponse schema.(Figure 1.6 & Figure 1.7)
Figure 1.6
Figure 1.7
13. Set the operation of “OrderRequestSend” to the request of “OrderServicePort”, set the operation of OrderRequestRecieve to the response of “OrderServicePort”.(Figure 1.8)
Figure 1.8
14. Create a transform, set the source to “OrderResponseRecieve”, set the destination to SampleServiceRequestMessage.(Figure 1.9)
Figure 1.9
15. Create a new send “SampleRequestSend”, set the message to SampleServiceRequestMessage.
16. Create a new Receive “SampleResponseRecieve”, set the message to SampleServiceRequestMessage.
17. Create a new Request-Response port “SampleServicePort”, and set the message type of request to SampleServiceRequest schema, set the message type of response to SampleServiceResponse schema.
18. Set the operation of “SampleRequestSend” to the request of “SampleServicePort”, set the operation of “SampleRequestRecieve” to the response of “SampleServicePort”.(Figure 1.10)
Figure 1.10
19. Create a transform, set the source to “SampleServiceResponseMessage”, set the destination to “OUtMessage”.(Figure 1.11)
Figure 1.11
20. Create a send port “OutMessageSend”, set the transport to “file”, set the URI to a local directory (such as d:\out\%MessageID%.xml). And set message to “InAndOutMessageSchema” schema.(Figure 1.12)
Figure 1.12
21. Set the solution properties.(Figure 1.13 & Figure 1.14)
Figure 1.13
Figure 1.14
22. Set transaction type of “SampleProcessServiceTypeClient” to “Long Running”; Set “Activate” of “InMessageReciever” to “true”.
23. Rebuild BizTalk project. And deploy project.(Figure 1.15 show the whole Business flow)
|
Figure 1.15 Business flow (SampleProcessServiceType.odx ) |
2 Config BizTalk server
- Binding.
Open Biztalk server 2006 Administration console, Console Root -> BizTalk Server 2006 Administration->BizTalk Group->Applications ->WCFTransationProject. Right click -> import->binding (binding OrderProcessServiceType.BindingInfo.xml & SampleProcessServiceType.BindingInfo.xml)
2. Config ports.
WCFTransationProject->Orchestrations
->Double click “SampleService.SampleProcessServiceTypeClient”.
On left panel, select bindings.
On right panel, select “host” in host dropdown list. And select sendports/sendport groups in the related dropdown list. (Figure 2.1)
Figure 2.1
- Set actions
WCFTransationProject->Send ports.
On right panel, double click “WcfSendPort_SampleProcessServiceType_ServiceEndpoint”
On left panel, select “General”, on right panel click configure… button. Edit the soap action header in the new form. (Figure 2.2)
WCFTransationProject->Send ports.
On right panel, double click “WcfSendPort_OrderProcessServiceType_ServiceEndpoint”
On left panel, select “General”, on right panel click configure… button. Edit the soap action header in the new form. (Figure 2.3)
Figure 2.2
Figure 2.3
- Start Application
WCFTransationProject->right click, click start.
3 Test application
a. Normal case: Prepare an xml file which generated by “InAndOutMessageSchema.xsd”, and set the value of field. Copy this file to URI of “InMessagePort” (such as d:\in\).Check the output in the URI of “OutMessageSend” (such as d:\out\%MessageID%.xml).
b. Transaction case:
In the WCF service “SampleService”, let it throw an exception when call it. And redo the normal case. The expectant result is the service in OrderService has rollback. But it’s not.
浙公网安备 33010602011771号