GVCLC Custom WCF Adapter-Part 2

Posted: November 24, 2012  |  Categories: BizTalk

Ahmed posted a comment to http://connectedpawns.wordpress.com/2011/01/31/the-gvclc-adapter-my-first-wcflob-adapter/


I tried to create a adapter to connect ISO switch using TCP/IP protocol, this is the same as you project here. but i could not make it work. Can you share the code for your adapter with out your business logic? i just want to see how you handle socket connection and how receiving part is taking place from WCF LOB adapter.


I meant to post something more about my experiences. So here goes.

TryReceive  method

This first method in the Inbound Handler calls Stephenson’s socket library

// call socket library to get data


string pollMessageResponse = this.Connection.Client.ReceiveData();

returnValue = createGVCLCMessage(pollMessageResponse, out message); //test to see have to do something

this.Connection.isWaiting4BTSResponse = returnValue; // If we have to do something the polling loop stops while we wait for a response from BizTalk

A “polling loop” encapsulates this code snippet in the same way as the Microsoft WCF SQL adapter.

Reply Method

Secondly the Inbound Handler handles the response message from BizTalk. Finally this sends the response back to the socket using Stephenson’s library.

//Test for two actions. The first action is the default if you create a test client using adding addservice reference

//The second one is the default if you use the Consume WCF wizard from a BizTalk project

if (message.Headers.Action == “GVCLC/OnReceiveGVCLC/response” || message.Headers.Action == “GVCLC/OnReceiveGVCLCResponse”)




string input = message.GetBody<OnReceiveGVCLCResponse>().ToString();

//send it back to the socket



catch (Exception ex)






this._con.isWaiting4BTSResponse = false; // Start the polling the socket for requests again




Back to Top