Marcus Santodonato
Marcus Santodonato

Reputation: 136

Can't get WCF service to send XML Document to BizTalk Receive Location

I'm new to BizTalk and WCF services and am trying to figure out how to use a WCF service to deliver XML data to Biztalk. I think I'm close but when I call the WCF service operation, the operation executes successfully but does not appear to generate any kind of a message in Biztalk. Am I wrong in assuming that simply calling an operation is enough to trigger a message to BizTalk?

Below is my code and some details about my BizTalk configuration:

WCF service:

public interface IService1
{
       [OperationContract, XmlSerializerFormat]
       XmlDocument GetXMLDocument(string sourceXML);
}

public class Service1 : IService1  
{  
    public XmlDocument GetXMLDocument(string sourceXML)
    {
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(sourceXML);
        return doc;
    }
}  

Calling application (button click calls the service):

protected void Button2_Click(object sender, EventArgs e)
{
        XmlDocument doc = new XmlDocument();     
        doc.AppendChild(doc.CreateNode(XmlNodeType.Element, "Patients", "test"));
        SendDoc(doc);             
}

protected void SendDoc(XmlDocument doc)
{
      //use a Service Client Object to call the service   
      objServiceClientobjService.GetXMLDocument(doc.OuterXml);      
}

BizTalk configuration:

Receive Port:

Receive Location:

Upvotes: 0

Views: 652

Answers (2)

flashbeir
flashbeir

Reputation: 45

The solution I always use, is to expose an endpoint. Take a look at this example:

Upvotes: 0

Vikas Bhardwaj
Vikas Bhardwaj

Reputation: 1510

Your implementation is not correct. There is no link between your WCF service and BizTalk. If you want to receive xml in BizTalk then you need to expose either an Orchestration or Xml Schema as WCF service using BizTalk WCF Web Service Publishing Wizard. This gets installed with BizTalk. Please see link for more details: msdn link

Upvotes: 1

Related Questions