|
Home > Archive > BizTalk Server General > September 2004 > Files sent via HTTP port seems to disappear.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Files sent via HTTP port seems to disappear.
|
|
| Paw Pedersen 2004-09-02, 6:20 pm |
| I have tried to send some files via biztalk 2004 and a http send port, but
although the HAT claims they are sent correctly they seem to have disappear.
I have then set up a testpage on my own mashine to receive the files, and
found out, that if you expect to recive them like a "file post" with .Net
code like this:
foreach(string f in Request.Files.AllKeys)
{
HttpPostedFile file = req.Files[f];
tmpFilename = file.FileName;
tmpFilename = " c:\\inetpub\\wwwroot\\sslmodtag\\Uploade
dFiles" +
tmpFilename.Substring(file.FileName.LastIndexOf("\\"));
file.SaveAs(tmpFilename);
}
}
The files will "disappear". However if you use this code:
BinaryReader r = new BinaryReader(req.InputStream);
string tmpFilename =
" c:\\inetpub\\wwwroot\\sslmodtag\\Uploade
dFiles\\test.txt";
FileStream filStream = new FileStream(tmpFilename,FileMode.CreateNew);
byte[] bytearray = r.ReadBytes(500000000);
filStream.Write(bytearray,0,bytearray.Length);
All seems to work just fine.
My question is, since the supplier I need to send theese files to, use the
first method to receive files, how do I make Biztalk sent it in a way it can
be received? Is it really nessesary to write my own HTTP adapter?
Hope for an "easy" solution to my problem :-)
Regards Paw
| |
| Stefan Thurow 2004-09-02, 6:20 pm |
| Yes, that expected because the Request.Files Property expects a MIME-encoded
HTTP request body. Also the Content-Type HTTP header needs to be set to
"multipart/form-data". (See .NET doc on the Files property for the details).
BizTalk Server can produce MIME encoded requests, but this approach makes
only sense it you need to transfer more than one file per request or if you
want to retain the file name during transfer.
To make BizTalk Server produce MIME encoded requests, you'll need to create
your own send pipeline and put the MIME encoder pipeline component in the
Encode stage.
HTH
Stefan
"Paw Pedersen" wrote:
> I have tried to send some files via biztalk 2004 and a http send port, but
> although the HAT claims they are sent correctly they seem to have disappear.
> I have then set up a testpage on my own mashine to receive the files, and
> found out, that if you expect to recive them like a "file post" with .Net
> code like this:
> foreach(string f in Request.Files.AllKeys)
>
> {
>
> HttpPostedFile file = req.Files[f];
>
> tmpFilename = file.FileName;
>
> tmpFilename = " c:\\inetpub\\wwwroot\\sslmodtag\\Uploade
dFiles" +
> tmpFilename.Substring(file.FileName.LastIndexOf("\\"));
>
> file.SaveAs(tmpFilename);
>
> }
>
> }
>
> The files will "disappear". However if you use this code:
>
> BinaryReader r = new BinaryReader(req.InputStream);
>
> string tmpFilename =
> " c:\\inetpub\\wwwroot\\sslmodtag\\Uploade
dFiles\\test.txt";
>
> FileStream filStream = new FileStream(tmpFilename,FileMode.CreateNew);
>
> byte[] bytearray = r.ReadBytes(500000000);
>
> filStream.Write(bytearray,0,bytearray.Length);
>
> All seems to work just fine.
>
> My question is, since the supplier I need to send theese files to, use the
> first method to receive files, how do I make Biztalk sent it in a way it can
> be received? Is it really nessesary to write my own HTTP adapter?
>
> Hope for an "easy" solution to my problem :-)
>
> Regards Paw
>
>
>
| |
| Devdutt Patnaik 2004-09-02, 6:20 pm |
| Have you set content type to multipart/form-data? In addition, if you want
to send file name, you need to write your custom MIME encoder.
Regards
Dev
"Paw Pedersen" <news@paws.dk> wrote in message
news:%23iqesTDkEHA.2304@TK2MSFTNGP10.phx.gbl...
> I have tried to send some files via biztalk 2004 and a http send port, but
> although the HAT claims they are sent correctly they seem to have
disappear.
> I have then set up a testpage on my own mashine to receive the files, and
> found out, that if you expect to recive them like a "file post" with .Net
> code like this:
> foreach(string f in Request.Files.AllKeys)
>
> {
>
> HttpPostedFile file = req.Files[f];
>
> tmpFilename = file.FileName;
>
> tmpFilename = " c:\\inetpub\\wwwroot\\sslmodtag\\Uploade
dFiles" +
> tmpFilename.Substring(file.FileName.LastIndexOf("\\"));
>
> file.SaveAs(tmpFilename);
>
> }
>
> }
>
> The files will "disappear". However if you use this code:
>
> BinaryReader r = new BinaryReader(req.InputStream);
>
> string tmpFilename =
> " c:\\inetpub\\wwwroot\\sslmodtag\\Uploade
dFiles\\test.txt";
>
> FileStream filStream = new FileStream(tmpFilename,FileMode.CreateNew);
>
> byte[] bytearray = r.ReadBytes(500000000);
>
> filStream.Write(bytearray,0,bytearray.Length);
>
> All seems to work just fine.
>
> My question is, since the supplier I need to send theese files to, use the
> first method to receive files, how do I make Biztalk sent it in a way it
can
> be received? Is it really nessesary to write my own HTTP adapter?
>
> Hope for an "easy" solution to my problem :-)
>
> Regards Paw
>
>
| |
| Paw Pedersen 2004-09-02, 6:20 pm |
| Thank you.
I have now put "multipart/form-data" in the content-type. Both in the config
of the send port, and in the general config of the HTTP send handler. I have
also created a custom pipeline with the MIME encoder in the encode stage.
I have then selected this custom pipeline in the send port, unenlisted and
started the port, started and stopped biztalk server, but still the file
just disappears.
I'm not sure how to configure the MIME/SMIME encoder, but I have tried it
with both the "Send body part as attachment" as true and as false, and it
dosn't make a difference.
Hope for more input on how to solve this.
Regards Paw
"Stefan Thurow" <StefanThurow@discussions.microsoft.com> wrote in message
news:F9E04C79-5CF3-4F1D-90CA-218309C511B6@microsoft.com...
> Yes, that expected because the Request.Files Property expects a
MIME-encoded
> HTTP request body. Also the Content-Type HTTP header needs to be set to
> "multipart/form-data". (See .NET doc on the Files property for the
details).
>
> BizTalk Server can produce MIME encoded requests, but this approach makes
> only sense it you need to transfer more than one file per request or if
you
> want to retain the file name during transfer.
>
> To make BizTalk Server produce MIME encoded requests, you'll need to
create[vbcol=seagreen]
> your own send pipeline and put the MIME encoder pipeline component in the
> Encode stage.
>
> HTH
>
> Stefan
>
> "Paw Pedersen" wrote:
>
but[vbcol=seagreen]
disappear.[vbcol=seagreen]
and[vbcol=seagreen]
..Net[vbcol=seagreen]
the[vbcol=seagreen]
can[vbcol=seagreen]
| |
| Stefan Thurow 2004-09-02, 6:20 pm |
| You should set SendBodyPartAsAttachment to true. To debug the problem you can
insert the following line in you code before doing anything else:
Request.SaveAs(Request.PhysicalApplicationPath + @"LogFiles\" + "_{" +
System.Guid.NewGuid().ToString() +"}.txt", true);
This will save the raw HTTP request into a directory called LogFiles. Make
sure to create this directory and that the .NET process has write permissions.
What you should see is a HTTP POST request which has the MIME encoded file
in its request body. You can also veryfy that the Content-Type is proberly
set. Once you see this, you'll know BizTalk is propertly configured and you
can focus on debugging you .NET code.
Cheers
Stefan
"Paw Pedersen" wrote:
> Thank you.
> I have now put "multipart/form-data" in the content-type. Both in the config
> of the send port, and in the general config of the HTTP send handler. I have
> also created a custom pipeline with the MIME encoder in the encode stage.
> I have then selected this custom pipeline in the send port, unenlisted and
> started the port, started and stopped biztalk server, but still the file
> just disappears.
> I'm not sure how to configure the MIME/SMIME encoder, but I have tried it
> with both the "Send body part as attachment" as true and as false, and it
> dosn't make a difference.
> Hope for more input on how to solve this.
>
> Regards Paw
>
> "Stefan Thurow" <StefanThurow@discussions.microsoft.com> wrote in message
> news:F9E04C79-5CF3-4F1D-90CA-218309C511B6@microsoft.com...
> MIME-encoded
> details).
> you
> create
> but
> disappear.
> and
> ..Net
> the
> can
>
>
>
| |
| Stefan Thurow 2004-09-02, 6:20 pm |
| Unfortunately I don't see your attachments. Please send them to
mail@ecs-dubai.com
"Paw Pedersen" wrote:
> Thanks for the quick reply.
> I have put the log code in the code.
> Unfortunately I don't have the possibility to correct the receiving code
> (execpt my test reciece code) since its another compagny recieving, and they
> are allready receiving files from other compagnys.
> A simple html form post page with the following lines in body:
>
>
>
> works fine, but even though I have made the corrections you surgested the
> file still seem to disappear.
> I have attached the log file from the simple http form post that works fine,
> and the log from the Biztalk http send that doesn't work. Do you have any
> more surgestions for what I could do?
> I have also tried to change the "Content transfer encoding" on the MIME
> encoder from Base64 to binary or 7bit, but still the file disappears.
>
> Regards Paw
> "Stefan Thurow" <StefanThurow@discussions.microsoft.com> wrote in message
> news:B0DDEAE6-63BC-4096-BEE0-CF65973ED3EB@microsoft.com...
> can
> permissions.
> you
> config
> have
> stage.
> and
> it
> it
> message
> to
> makes
> if
> the
> port,
> files,
> FileStream(tmpFilename,FileMode.CreateNew);
> use
> way it
>
>
>
| |
| Paw Pedersen 2004-09-02, 6:20 pm |
| I have sent the files to your email adress. If you need the code for the
receive page as well, just let me know, and I will mail that for you as
well.
Thanks in advance
Regards Paw
"Stefan Thurow" <StefanThurow@discussions.microsoft.com> wrote in message
news:0231C452-3F443E6-8276-18EC7D68B9D4@microsoft.com...[vbcol=seagreen]
> Unfortunately I don't see your attachments. Please send them to
> mail@ecs-dubai.com
>
> "Paw Pedersen" wrote:
>
they[vbcol=seagreen]
the[vbcol=seagreen]
fine,[vbcol=seagreen]
any[vbcol=seagreen]
message[vbcol=seagreen]
you[vbcol=seagreen]
+[vbcol=seagreen]
Make[vbcol=seagreen]
file[vbcol=seagreen]
proberly[vbcol=seagreen]
and[vbcol=seagreen]
the[vbcol=seagreen]
handler. I[vbcol=seagreen]
unenlisted[vbcol=seagreen]
file[vbcol=seagreen]
tried[vbcol=seagreen]
and[vbcol=seagreen]
set[vbcol=seagreen]
approach[vbcol=seagreen]
or[vbcol=seagreen]
to[vbcol=seagreen]
in[vbcol=seagreen]
have[vbcol=seagreen]
with[vbcol=seagreen]
to,[vbcol=seagreen]
a[vbcol=seagreen]
adapter?[vbcol=seagreen]
|
|
|
|
|