Issue in using the Adapter in a Request-response port

Topics: Developer Forum, Project Management Forum, User Forum
May 8, 2007 at 12:42 PM
I tried to use this WCF Adapter (with .Net 3.0 RTM) from a BizTalk 2006 Orchestration to invoke a WCF Service exposed on wsHttpBinding using a Request-response port. I am getting an error that the adapter failed to transmit message going to send port with an exception “Object reference not set to an instance of an object”. I tried to debug using the source code and found that the exception occurs in the line 81 of WcfTransmitterProperties.cs where the 'Uri' property is null. Analyzing further, the reason for 'null' value of 'Uri' property is because '_uri' is set as 'null' in line 58 of WcfAdapterProperties.cs file. The 'InboundTransportLocation' property of 'SystemMessageContext' of the 'msg.Context' (msg is of type IBaseMessage) is 'null'. So, the message received in the BizTalk server does not contain the 'InboundTrasportLocation' and I am not able to understand the reason for the same. I have followed the steps listed below to configure the WCF Adapter in the Port. The WCF Adapter works fine with the Demo application provided for One-way port. So, I feel this problem is only for a Request-response port. Can anybody please help me to identify this issue? Thank you.

P.S. I had put a same message in another discussion 'Using adapter with .net 3.0 RC1' but wanted to change the discussion topic because I am using .Net 3.0 RTM.

Steps done to configure WCF Adapter to invoke WCF Service from BizTalk Orchestration (This also can help as documentation to use WCF Adapter for the new users):

1. Create sample WCF Service and invoke it from another client to verify the service works. Note this WCF Service should have the 'Action' as part of each OperationContractAttribute. (Refer the demo application NewsSubscriberB\NewsChannelContract.cs)
2. Create a BizTalk project with an Orchestration that listens to a File Port for the input data and sends the results to a File Port for the result data.
3. Right-click the BizTalk project and select 'Add generated items' -> Add Adapter Metadata -> Select 'WCF' -> Provide 'Service url' -> Get all the generated schemas.
4. Add a map to Transform the input data schema of file to the generated schema for the input data contract of WCF Service and add a 'Transform' in orchestration to transform to the input data contract of WCF Service.
5. Similarly do the above step for transformation of Output result data from output data contract to the output data schema of file.
6. Add a Send to a 'Request-response' port with a new Port type and 'sending a request and receiving a response' to communicate with WCF service and connect the Send and receive to the Send-receive port.
7. BindingConfiguration for the WCF Service has to be added to BTSNTSvc.exe.config. Go the sample client App.Config file (created in step 1) and copy the complete text between the 'bindings' tag and paste it in the System.Service tag in BTSNTSvc.exe.config. The 'binding name' for this binding is 'WCF_EndPoint'. (This step is similar to the 'MyWSRMBinding' BindingConfiguration used in the demo application)
8. Configure the Send port of WCF service in the Administration console to use Transport type 'WCF' and click on 'Configure' and click on 'Endpoint wizard' to provide the WCF Url and select the appropriate Action and click 'Ok'.
9. Now, 'Endpoint Uri', 'Endpoint Action', 'Endpoint Wizard' is filled up in the ‘WCF Transport properties’ screen. Select the Binding as 'HTTP-WS' and Binding configuration as 'WCF_Endpoint'. Select the 'NativeOneWay' as 'False'. (This is a Request-response port)
10. Drop the input file in the location and look in BizTalk Group overview page in Administration console and the Send port is in 'Retrying and idling ports' and the Event viewer has the warning message detailing the reason.