Files sent via HTTP port seems to disappear.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server General > Files sent via HTTP port seems to disappear.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Files sent via HTTP port seems to disappear.  
Paw Pedersen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-02-04 11: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







[ Post a follow-up to this message ]



    RE: Files sent via HTTP port seems to disappear.  
Stefan Thurow


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-02-04 11: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 disappea
r.
> 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 c
an
> be received? Is it really nessesary to write my own HTTP adapter?
>
> Hope for an "easy" solution to my problem :-)
>
> Regards Paw
>
>
>





[ Post a follow-up to this message ]



    Re: Files sent via HTTP port seems to disappear.  
Devdutt Patnaik


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-02-04 11: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
>
>







[ Post a follow-up to this message ]



    Re: Files sent via HTTP port seems to disappear.  
Paw Pedersen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-02-04 11: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] 







[ Post a follow-up to this message ]



    Re: Files sent via HTTP port seems to disappear.  
Stefan Thurow


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-02-04 11:20 PM

You should set SendBodyPartAsAttachment to true. To debug the problem you ca
n
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 permission
s.

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 conf
ig
> of the send port, and in the general config of the HTTP send handler. I ha
ve
> 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 
>
>
>





[ Post a follow-up to this message ]



    Re: Files sent via HTTP port seems to disappear.  
Stefan Thurow


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-02-04 11: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 th
ey
> 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 fin
e,
> 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 
>
>
>





[ Post a follow-up to this message ]



    Re: Files sent via HTTP port seems to disappear.  
Paw Pedersen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-02-04 11: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] 







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:44 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register