Send messages from MABS to BizTalk Server On Premise


In BizTalk Server you can use WCF-BasicHttpRelay or WCF-NetTcpRelay adapter to receive the messages.

In BizTalk Admin Console, create a new Receive Port “RPForMABSRelayTest”.

RPForMABSRelayTest

Add a new receive location “RL_HTTPTestRx” with type WCF-BasicHttpRelay

RL_HTTPTestRx

Click on “Configure” and provide the Service Bus Namespace URI + logical name with which this relay will be identified. Here I gave name “HTTPInbound”.

URI

Click on Security tab and provide “Access control service” information. Note that this ACS information is for Service Bus and not the MABS connection information. You need to capture this information from Azure Management Portal by selecting Service Bus namespace of your interest. Complete the configuration of the port by clicking on OKs.

ACSCredentials

Enable the receive location. now if you go to the Relays section under the Service Bus Namespace on the Azure Management Portal, you will see a listener with the name HTTPInbound.

listner

Create and sample send port to send the messages to a file location. Add the Filter to get messages from the receive port created above. Start the Send Port.

SendPort

Now create a BizTalk Service project in VS.
In the MessageFlowItinerary update the BizTalk Service URL property to use your BizTalk Service name.
From “Bridges”, drag and drop Pass-Through Bridge on the itinerary designer. Name it as MABSRelayTest
From “Destinations”, drag and drop One-Way Relay Endpoint on the itinerary designer.
Double click on the One-Way Relay Endpoint to open the config file. Modify the address to use the URI that was used in the BizTalk Server Receive Location.

<endpoint
        name="OneWayRelayServiceReference1"
        address=https://sbnamespace.servicebus.windows.net/HTTPInbound
        binding="basicHttpRelayBinding"
        bindingConfiguration="basicHttpRelayBinding1"
        behaviorConfiguration="serviceBusCredentialsBehavior"
        contract="System.ServiceModel.Routing.ISimplexDatagramRouter"/>

Modify the behaviour “serviceBusCredentialsBehavior" to update Service bus namespace connection information (same way you configured “Access control service” for BizTalk Receive Location.

<behavior name="serviceBusCredentialsBehavior">
    <!-- TODO: Uncomment the transportClientEndpointBehavior block below if RelayAccessToken -->
    <!-- security will be used. Also update the issuerName and issuerSecret values -->
    <transportClientEndpointBehavior>
        <tokenProvider>
            <sharedSecret issuerName="owner" issuerSecret="issuerSecretissuerSecretissuerSecretissuerS=" />
        </tokenProvider>
    </transportClientEndpointBehavior>
</behavior>

And lastly for basicHttpRelayBinding make sure the security mode is set to Transport.

<security mode="Transport" relayClientAuthenticationType="RelayAccessToken" />

Save the config file and close it.

From “Bridges” use the connector to connect “MABSRelayTest” and “OneWayRelayServiceReference1”
For the connector “One Way Route Connection” properties , set the Filter to “Match All”.
Deploy the solution. (The steps are similar for the WCF-NetTcpRelay adapter.)

VSProject

Go to Server Explorer and open “Windows Azure BizTalk Services”. Expand your BizTalk service and send test message to the bridge “MABSRelayTest”
You may refer to Test the Bridges - Post messages – 3 easy tools for the developers

And I get the error message “FAILED. 500 Internal Server Error” : The one-way operation returned a non-null message with Action=''.

If I go to the BizTalk Service Portal and check the Tracking, it shows that the Routing was successful and Route Activity Showing the same error.

Tracking

Error

If you are using WCF-NetTcpRelay, then error looks like

"The channel received an unexpected input message with Action '' while closing.  You should only close your channel when you are not expecting any more input messages."

Now, when I go and check the Send Port’s destination folder, I see that the message is delivered successfully and no error on the BizTalk side..

So why this error is coming in MABS? This is an issue with the BizTalk Server on premise – and its by design – WCF Adapter cannot handle one-way contracts so gracefully out of the box.
To get around this error, you can send back a null message as explained in Using One-Way Operations with the WCF Adapter in BizTalk by using the sample binding provided by Mustansir .
NOTE mentioned in his blog: In order to use any of the workarounds above you need to use the WCF-Custom adapter, since that is the only adapter which allows you to add behaviors or configure the customBinding binding with user-specified binding elements.


Comments (0)

Skip to main content