Re: BizTalk 2006 R2 WCF-basicHttp adapter configuration – Getting message in service – with null value

Home Page Forums BizTalk 2004 – BizTalk 2010 BizTalk 2006 R2 WCF-basicHttp adapter configuration – Getting message in service – with null value Re: BizTalk 2006 R2 WCF-basicHttp adapter configuration – Getting message in service – with null value

#21515

I am having the same issue (WCF Contract Mismatch with BizTalk 2006 R2 EDI XML Schema). Rather than start a new thread, I’ll just jump in here.

I’m kind of new to BizTalk and to WCF and am having what I believe to be a small issue with deserializing a message in a WCF service. What I have is a very basic sample application just trying to get the concept working:

A BizTalk 2006 R2 orchestration is up and running that will receive an X12 270 Eligibility Request message (schema from the MicrosoftEdiXSDTemplates.exe file that comes with BizTalk 2006 R2), sends the request to a trading partner via a Send/Receive port, and sends the X12 271 Eligibility Response (once received from the trading partner) to a send port.

When the Send Port is configured to simply write the X12 271 response to an XML file on disk, the whole thing works great. However, what I really way is to send it to a WCF service. So, I created the below, very simple, WCF service hosted in a console application (only added reference is System.ServiceModel). When the process is executed, the web service does get called, but the “response” (message) parameter on the “WriteResponse” method is always null (although if I check the message in the BizTalk admin tool, it looks good), and I get the error detailed at the bottom of this post. What am I missing?

*******************
Service.cs
*******************
[ServiceContract(Namespace=”http://myuri.org”), 
XmlSerializerFormat(Style = OperationFormatStyle.Document, Use = OperationFormatUse.Literal)]public interface IResponseToSQL
{
 [OperationContract(IsOneWay = true, Action = “http://myuri.org/IResponseToSQL/WriteResponse”)] 
 void WriteResponse(MyNamespace.X12_00401_271 response);}

public class ResponseToSQL : IResponseToSQL
{
 #region IResponseToSQL Members

 public void WriteResponse(MyNamespace.X12_00401_271 response)
 {
  Console.WriteLine(“WriteResponse method called…”);

  if (response == null)
  Console.WriteLine(“The response message is null.”);
  else
  Console.WriteLine(“The response message is not null. Save the response to SQL…”);
 }
}

*******************
Program.cs
*******************
class Program
{
 static void Main(string[] args)
 {
  Console.ForegroundColor = ConsoleColor.Yellow;
  Console.WriteLine(“ResponseToSQL service is up and running with the following endpoints:”);

  using (ServiceHost host = new ServiceHost(typeof(EligibilityLookup.WCF.Host.ResponseToSQL), new Uri(“http://localhost:8000/ResponseToSqlService”)))
  {
  // HTTP
  host.AddServiceEndpoint(typeof(EligibilityLookup.WCF.Host.IResponseToSQL), new BasicHttpBinding(),
  “basic”);

  // WS Http
  host.AddServiceEndpoint(typeof(EligibilityLookup.WCF.Host.IResponseToSQL), new WSHttpBinding(),
  “ws”);

  // Named Pipes
  host.AddServiceEndpoint(typeof(EligibilityLookup.WCF.Host.IResponseToSQL), new NetNamedPipeBinding(),
  “net.pipe://localhost/ResponseToSqlService/pipe”);

  // TCP/IP
  host.AddServiceEndpoint(typeof(EligibilityLookup.WCF.Host.IResponseToSQL), new NetTcpBinding(),
  “net.tcp://localhost:8082/ResponseToSqlService/tcp”);

  host.Open();

  foreach (System.ServiceModel.Description.ServiceEndpoint endPoint in host.Description.Endpoints)
  Console.WriteLine(endPoint.Address.ToString());

  Console.WriteLine(“Press a key to terminate host.”);
  Console.ReadLine();
  }
 }
}

I also generated a class file using XSD.exe to get the X12_00401_271 class. I generated it off the same XSD schema I used in the BizTalk orchestration to define the response message (which, again was plucked out of the MicrosoftEdiXSDTemplates.exe file that comes with BizTalk 2006 R2). The command I used was:

xsd.exe X12_00401_271.xsd /c /namespace:MyNamespace

*******************
BizTalk 2006 R2 Send Port Configuration
*******************
–Main Property Page–
Type: WCF-BasicHttp
Send Handler: BizTalkServerApplication
Send pipeline: PassThruTransmit
(rest of settings are default)

–Type Configuration (WCF-BasicHttp)–
Endpoint Address:http://machinename:8000/ResponseToSqlService/basic
SOAP Action Header Action: http://is.org/IResponseToSQL/WriteResponse
(rest of settings are default)

*******************
Resulting Error (from Windows Event Viewer)
*******************
Event Type: Error
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006 
Event ID: 5754
Date: 1/16/2009
Time: 1:08:50 PM
User: N/A
Computer: VIRTUALBIZTALK
Description:
A message sent to adapter “WCF-BasicHttp” on send port “WcfResponseSendPort” with URI “http://machinename:8000/ResponseToSqlService/basic” is suspended. 
 Error details: System.ServiceModel.CommunicationException: The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

Server stack trace: 
  at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
  at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
  at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
  at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)

Exception rethrown at [0]: 
  at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
  at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
  at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result) 
 MessageId: {7FD75D76-04C8-4136-987D-F674C4321611}
 InstanceID: {A6B69FCF-D16A-47A2-8CB1-A6F17327E433}

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Thanks in advance!