Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Biztalk
|
Biztalk General discussion about Biztalk server.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Biztalk section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2005, 05:23 AM
Authorized User
 
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending message to Biztalk Orchestration from WS

Hi All,

I need to send a message from .NET Web Service to a receive port in BizTalk orchestration. I'm using HTTP Adapter for this. I've used a HTTPWebRequest to send the message (after converting it in bytes) to a receive location (BTSHTTPReceive.dll which is a BizTalk ISAPI dll).
I've already configured the location and have specified the location in the Receive Port Location properties. But when I use the HAT tool to see the orchestration, I find that the orchestration hasn't executed even the first step, that is, the message hasn't reached the orchestration in the first place.

My code in the .NET Web Service looks like this:
Code:
[WebMethod]
        public void getTemperature(string Temp)
        {
            double Result = 0;
            Result = (Convert.ToDouble(Temp) * 1.8) + 32 ;

            // indicates the location where the HTTP request is to be sent
            string requestLocation = "http://localhost/HTTPReceiveLocation/BTSHTTPReceive.dll";

            // create an XML object
            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.PreserveWhitespace = true;

            // create the root node (Temperature)
            XmlNode tempXmlNode = xmlDocument.CreateNode(XmlNodeType.Element, "Temperature", "");
            xmlDocument.AppendChild(tempXmlNode);

            // create the child element (Celsius)
            tempXmlNode = xmlDocument.CreateNode(XmlNodeType.Element, "Celsius", "");
            tempXmlNode.InnerText = Temp;
            xmlDocument.DocumentElement.AppendChild(tempXmlNode);

            // create the child element (Farenheit)
            tempXmlNode = xmlDocument.CreateNode(XmlNodeType.Element, "Farenheit", "");
            tempXmlNode.InnerText = Result.ToString();
            xmlDocument.DocumentElement.AppendChild(tempXmlNode);

            try 
            {
                // create a web request and set the method of the request to POST
                HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create(requestLocation);
                request.Method = "POST";

                // encode the data and store the byte representation in an array
                ASCIIEncoding encoding = new ASCIIEncoding();
                byte[] requestData = encoding.GetBytes(xmlDocument.OuterXml);

                // set the content type of the data being posted.
                request.ContentType="application/x-www-form-urlencoded";

                // set the content length of the string being posted
                request.ContentLength = xmlDocument.OuterXml.Length;

//                NetworkCredential cred = new NetworkCredential("administrator", "mbt123", "dscp01076");
//                request.Credentials = cred;
//                request.PreAuthenticate = true;
                Stream requestStream = request.GetRequestStream();
                requestStream.Write(requestData,0,requestData.Length);

                // flush out the data to the underlying stream and close it
                requestStream.Flush();
                requestStream.Close();

            } 
            catch (WebException wex) 
            {

            }   
        }
Can somebody tell me where I'm wrong or am I missing something??

TIA
Debsoft
__________________
cheers,
debsoft





Similar Threads
Thread Thread Starter Forum Replies Last Post
Orchestration WS-call with “object” parameter ershad Biztalk 0 August 26th, 2008 01:12 AM
BizTalk Orchestration terminated Suddenly gmk51080 Biztalk 0 August 4th, 2008 03:07 AM
question:biztalk 2004 subscription/orchestration pratdevil Biztalk 1 February 21st, 2006 05:11 AM
How to start Biztalk orchestration from .NET code? omshaath Biztalk 1 October 1st, 2004 09:08 AM
Problem in using BizTalk Orchestration as WebServi ahtisham_a Biztalk 0 August 27th, 2004 05:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.