Tuesday, September 09, 2014

Remove BOM sending a document

At the beginning of UTF-8 or UTF-16 documents, usually are a set of not visible characters called BOM (http://en.wikipedia.org/wiki/Byte_order_mark).

There are some systems that doesn’t allow these characters on documents, then when we are developing solutions on BizTalk and want to send a document to a system that doesn’t understand BOM characters, we can add at the send pipeline an assembler (XML or FLAT) and use their property Preserve byte order mark.


If we set to false this property, the assembler will delete BOM characters of the outgoing document.

Friday, September 05, 2014

Expose BizTalk schemas as RPC Encoded

It's very easy to expose BizTalk schemas as RPC encoded. Do these steps:

1) On the service App_Code folder, open your csharp service files.

2) Comment SoapDocumentServiceAttribute:

//[System.Web.Services.Protocols.SoapDocumentServiceAttribute(Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Default)]

3) Use instead SoapRpcService

    [System.Web.Services.Protocols.SoapRpcService]

4) Comment each SoapDocumentMethodAttribute:

//[System.Web.Services.Protocols.SoapDocumentMethodAttribute("namespaceAndMethod", OneWay=false, Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Default)]

5) Use instead SoapRpcMethod

[System.Web.Services.Protocols.SoapRpcMethod]

And that's all!

Direct bound port error: "Illegal direct binding partner port"

If you get an "Illegal direct binding port" as a compilation error when you have a Direct Port Binding between 2 orchestrations:

Illegal direct binding partner port

 Maybe you have set different Port on partner orchestration on the two ports that are direct binding.

To configure correctly a Direct Port Binding, check the steps given on http://msdn.microsoft.com/en-us/library/aa949436.aspx. Here is an full example:

1.     In Orchestration A, select the Port shape in the orchestration Toolbox. This starts the Port Configuration Wizard.
2.     On the Port Properties page, in the Name field, type MyReceivePort. Click Next.
Configure BizTalk Direct Binding Partner Port - Step 1
3.     On the Select a Port Type page, select Create a new Port Type. In the Port Type Name field, type MyPartnerPortType. Click Next.
Configure BizTalk Direct Binding Partner Port - Step 2
4.     On the Port Binding page, in the Port direction of communication drop-down list, select I'll always be receiving messages on this port. In the Port binding drop-down list, select Direct.
5.     Select To receive messages from other orchestrations, select this port here and in those orchestrations, and then in the Port on partner orchestration drop-down list, select OrchestrationA.MyReceivePort. Click Next.
Configure BizTalk Direct Binding Partner Port - Step 3
6.     On the Completing the Port Wizard page, click Finish.
7.     In Orchestration B, select the Port shape in the orchestration Toolbox. This starts the Port Configuration Wizard.
8.     On the Port Properties page, in the Name field, type MySendPort. Click Next.
Configure BizTalk Direct Binding Partner Port - Step 4
9.     On the Select a Port Type page, select Use an existing Port Type. Under Available Port Types, select MyPartnerPortType, and then click Next.
Configure BizTalk Direct Binding Partner Port - Step 5
10. On the Port Binding page, in the Port direction of communication drop-down list, select I'll always be sending messages on this port. In the Port binding drop-down list, select Direct.
11. Select To send messages to other orchestrations, select this port here and in those orchestrations, and then in the Port on partner orchestration drop-down list, select OrchestrationA.MyReceivePort. Click Next.
Configure BizTalk Direct Binding Partner Port - Step 6
12. On the Completing the Port Wizard page, click Finish.