09-30-04 01:03 AM
Hello,
>I have a requirement where I need to invoke orchestration through code. I
>found the SubmitDirect adapter in SDK was perfect for me. I will be invoki
ng
>orchestration through a web application. Web server is hosted on a differen
t
>machine and BizTalk server is on different machine. If I use the dll provid
ed
>in the SDK on my web application, how will it know which BizTalk server to
>connect to and where. Please advice me what I need to do to get this workin
g.
>Is registering the TransportProxyUtils.dll(supplied with SubmitDirect adapt
er
>sample), on web server enough.
The direct submit allows you to submit mesasges to the message box directly.
As a result,
an orchestartion with the right subscription will be activated.
Is there any reason why you cannot send a message from your web application
to a port (perhaps an HTTP port)?
This is really simple, in fact simpler that the submit direct: you define an
HTTP receive port (and an optional pipeline).
In your web application, use the .NET object HttpWebRequest or equivalent (W
ebClient) to post a message.
That would work for any machine, remote or not. I believe this solution is s
uperior to yours, at least with the limited amount
of information I have gleaned from your post.
The Biztalk tutorial has already such a sample application that you could re
use in your web application.
Make sure you download the tutorial (free):
http://www.microsoft.com/downloads/...&displaylang=en
After installing it, look under <bts install directory>\SDK\Tutorial\Lessons
\BAS\HttpPost.
If you cannot install it for some reason, I have copied the code below:
byte[] buffer = null;
Stream f = null; // File stream
Stream s = null; // Http Request stream
// Initialize the web request
WebClient cli=new WebClient();
// <-- Put the proper credentials here, if any are needed -->
cli.Credentials=CredentialCache.DefaultCredentials;
// Loop through the files and post them to the passed in URL
buffer = new byte[1024];
// <-- Make sure f is a stream to the data you want to send -->
// <-- Maybe a string reader or a file -->
f=File.OpenRead(<file> );
// <-- Replace url below with the actual URL of the receive location -->
// <-- This perhaps comes from web.config -->
s=cli.OpenWrite(url,"POST");
while(f.Position<f.Length)
{
int bytes=f.Read(buffer,0,1024);
s.Write(buffer,0,bytes);
}
s.Close();
s = null;
f.Close();
f = null;
You can even use other methods in WebClient to facilitate the upload process
(UploadData for instance).
Thanks,
-Gilles.
[ Post a follow-up to this message ]
|