Connecting Tech Pros Worldwide Forums | Help | Site Map

File Upload Web Service

Alphonse Giambrone
Guest
 
Posts: n/a
#1: Nov 18 '05
I am trying to develop a web service to accept a file uploaded via http post
from a vba (Access) application.
Thanks to helpful links in a vb newsgroup and my previous work with WinInet
api I was able to write the code to do the upload. I know this works because
I tested by posting to an asp page that saves the file.
Now I need to create a .NET web service to accept and save the file. Of all
the web service samples I found, the only ones that deal with file upload
receive the file as a byte array from another .net object (like a webform).
How can I access the http post and extract the uploaded file in a web
service.
Or if that is not possible, how about from a aspx page?

TIA

--

Alphonse Giambrone
Email: a-giam at customdatasolutions dot us




Steven Cheng[MSFT]
Guest
 
Posts: n/a
#2: Nov 18 '05

re: File Upload Web Service


Hi Alphonse,

From your description, you are wanting to generate a webserivie or a
webform page which can help process the uploaded file postd from a
client(OFFICE VBA ?).

As for this question, here are my suggestions:
1. If use WebService, it is general that we define a certain webmethod
which takes a byte array param and a string param such as
pubic void UploadFile(bytes as Byte() , filename as String)

And then, we can easily call it in .NET application since we can use the
WSDL.EXE or the VS.NET to generate a easytouse client proxy class.

However, since you'd like to call the webservice in VBA application, I
think two mean in VBA can help to call webservice:
a) use MXXML COM component to send raw XML soap message, this will have us
to write the soap http message manually and post it via XMLHTTP component.

b) There is a webservice add-in in OFFICE which can help to generate a
webservice proxy. I think this will be more convenient. You may have a
search in MSDN to see whether the certain ADD-IN will help.


2. In addition to webservice, I think a simple asp.net webform page is also
capable of handling client uploaded file. The ASP.NET 's butildin
Request(HttpRequest class) object has a "Files" member which can help to
handle the client uploaded files. Here are some references on the
HttpRequest.Files member and handle upload files in ASP.NET:
#HttpRequest.Files Property
http://msdn.microsoft.com/library/en...webhttprequest
classfilestopic.asp?frame=true

#Uploading Files Using the File Field Control
(this article is focus on use webform to upload, but you can also get ideas
on how to handle the file steam from other clients)
http://msdn.microsoft.com/library/en...eupload.asp?fr
ame=true

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx






Wei-Dong XU [MSFT]
Guest
 
Posts: n/a
#3: Nov 18 '05

re: File Upload Web Service


Hi Alphonse,

For Office XP & 2003 VBA Web service development, Microsoft has released Office web service Toolkit which will provide some assistance on your
scenario.
Microsoft Office 2003 Web Services Toolkit 2.01
http://www.microsoft.com/downloads/d...DisplayLang=en

Microsoft Office XP Web Services Toolkit 2.0
http://www.microsoft.com/downloads/d...displaylang=en

Some MSDN technique articles will introduce more info regarding this.
Microsoft Office XP Web Services Toolkit
http://msdn.microsoft.com/library/en...itoverview.asp

Please feel free to let me know if you have any further questions.

Best Regards,
Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Alphonse Giambrone
Guest
 
Posts: n/a
#4: Nov 18 '05

re: File Upload Web Service


Thanks both for the replies.

The Office toolkits are not an option. I should have mentioned that I am
using vba with wininet api for the upload because I need the solution to
work with Access 97 and up without any additional references or installs. It
is pretty safe to assume my users have IE and therefore wininet.dll.

It seems that you are saying I can't post the file to a web service, but can
to a web page. This would be ok if need be, but I would prefer using a web
service.
Am I understanding this correctly?

--

Alphonse Giambrone
Email: a-giam at customdatasolutions dot us


"Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
news:yJ$BPhqHEHA.3904@cpmsftngxa06.phx.gbl...[color=blue]
> Hi Alphonse,
>
> From your description, you are wanting to generate a webserivie or a
> webform page which can help process the uploaded file postd from a
> client(OFFICE VBA ?).
>
> As for this question, here are my suggestions:
> 1. If use WebService, it is general that we define a certain webmethod
> which takes a byte array param and a string param such as
> pubic void UploadFile(bytes as Byte() , filename as String)
>
> And then, we can easily call it in .NET application since we can use the
> WSDL.EXE or the VS.NET to generate a easytouse client proxy class.
>
> However, since you'd like to call the webservice in VBA application, I
> think two mean in VBA can help to call webservice:
> a) use MXXML COM component to send raw XML soap message, this will have us
> to write the soap http message manually and post it via XMLHTTP component.
>
> b) There is a webservice add-in in OFFICE which can help to generate a
> webservice proxy. I think this will be more convenient. You may have a
> search in MSDN to see whether the certain ADD-IN will help.
>
>
> 2. In addition to webservice, I think a simple asp.net webform page is[/color]
also[color=blue]
> capable of handling client uploaded file. The ASP.NET 's butildin
> Request(HttpRequest class) object has a "Files" member which can help to
> handle the client uploaded files. Here are some references on the
> HttpRequest.Files member and handle upload files in ASP.NET:
> #HttpRequest.Files Property
>[/color]
http://msdn.microsoft.com/library/en...webhttprequest[color=blue]
> classfilestopic.asp?frame=true
>
> #Uploading Files Using the File Field Control
> (this article is focus on use webform to upload, but you can also get[/color]
ideas[color=blue]
> on how to handle the file steam from other clients)
>[/color]
http://msdn.microsoft.com/library/en...eupload.asp?fr[color=blue]
> ame=true
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
>
>
>
>
>[/color]


Michael Mayer [C# MVP]
Guest
 
Posts: n/a
#5: Nov 18 '05

re: File Upload Web Service


You'll have to remember that a webservice uses SOAP/XML for all method
post/requests. While you can certainly encode a file to send through a web
service (e.g. a byte array, or otherwise) I think you'll find much better
built in support to older office files for doing a more standard file post
over http.

You can create a very basic web page... just a class that descends from the
Page class, and on the Page load event, you can check for the files being
uploaded. It sounds like you already have that working on the office/client
side -- getting it to work on the server side should be easy.

I wonder, then, why you are wanting to use the web service? I guess
Microsoft has done a lot of marketing work on how great web services are --
but if the client can't easily consume the web service, it's not much use.

That's just my two cents.

--
Mike Mayer, C# MVP
mike@mag37.com
http://www.mag37.com/csharp/


"Alphonse Giambrone" <NOSPAMa-giam@example.invalid> wrote in message
news:uwLmYqzHEHA.3848@tk2msftngp13.phx.gbl...[color=blue]
> Thanks both for the replies.
>
> The Office toolkits are not an option. I should have mentioned that I am
> using vba with wininet api for the upload because I need the solution to
> work with Access 97 and up without any additional references or installs.[/color]
It[color=blue]
> is pretty safe to assume my users have IE and therefore wininet.dll.
>
> It seems that you are saying I can't post the file to a web service, but[/color]
can[color=blue]
> to a web page. This would be ok if need be, but I would prefer using a web
> service.
> Am I understanding this correctly?
>
> --
>
> Alphonse Giambrone
> Email: a-giam at customdatasolutions dot us
>
>
> "Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
> news:yJ$BPhqHEHA.3904@cpmsftngxa06.phx.gbl...[color=green]
> > Hi Alphonse,
> >
> > From your description, you are wanting to generate a webserivie or a
> > webform page which can help process the uploaded file postd from a
> > client(OFFICE VBA ?).
> >
> > As for this question, here are my suggestions:
> > 1. If use WebService, it is general that we define a certain webmethod
> > which takes a byte array param and a string param such as
> > pubic void UploadFile(bytes as Byte() , filename as String)
> >
> > And then, we can easily call it in .NET application since we can use the
> > WSDL.EXE or the VS.NET to generate a easytouse client proxy class.
> >
> > However, since you'd like to call the webservice in VBA application, I
> > think two mean in VBA can help to call webservice:
> > a) use MXXML COM component to send raw XML soap message, this will have[/color][/color]
us[color=blue][color=green]
> > to write the soap http message manually and post it via XMLHTTP[/color][/color]
component.[color=blue][color=green]
> >
> > b) There is a webservice add-in in OFFICE which can help to generate a
> > webservice proxy. I think this will be more convenient. You may have a
> > search in MSDN to see whether the certain ADD-IN will help.
> >
> >
> > 2. In addition to webservice, I think a simple asp.net webform page is[/color]
> also[color=green]
> > capable of handling client uploaded file. The ASP.NET 's butildin
> > Request(HttpRequest class) object has a "Files" member which can help to
> > handle the client uploaded files. Here are some references on the
> > HttpRequest.Files member and handle upload files in ASP.NET:
> > #HttpRequest.Files Property
> >[/color]
>[/color]
http://msdn.microsoft.com/library/en...webhttprequest[color=blue][color=green]
> > classfilestopic.asp?frame=true
> >
> > #Uploading Files Using the File Field Control
> > (this article is focus on use webform to upload, but you can also get[/color]
> ideas[color=green]
> > on how to handle the file steam from other clients)
> >[/color]
>[/color]
http://msdn.microsoft.com/library/en...eupload.asp?fr[color=blue][color=green]
> > ame=true
> >
> > Regards,
> >
> > Steven Cheng
> > Microsoft Online Support
> >
> > Get Secure! www.microsoft.com/security
> > (This posting is provided "AS IS", with no warranties, and confers no
> > rights.)
> >
> > Get Preview at ASP.NET whidbey
> > http://msdn.microsoft.com/asp.net/whidbey/default.aspx
> >
> >
> >
> >
> >
> >[/color]
>
>[/color]


Alphonse Giambrone
Guest
 
Posts: n/a
#6: Nov 18 '05

re: File Upload Web Service


Thanks for your response Mike.
Yes, you are correct. After all I have read about web services, it just
seemed like the right thing to use since the process will not require any
human intervention other than to agree to the upload. Plus, I have also read
that a web service can accept http get and post, not just SOAP/XML.
Once I get the upload process working I will need to implement some security
and thought it might be easier using a web service to pass a token to my vba
app which would then include it with the file to provide authentication.

--

Alphonse Giambrone
Email: a-giam at customdatasolutions dot us


"Michael Mayer [C# MVP]" <mike@mag37.com> wrote in message
news:uppW7Q0HEHA.3356@TK2MSFTNGP11.phx.gbl...[color=blue]
> You'll have to remember that a webservice uses SOAP/XML for all method
> post/requests. While you can certainly encode a file to send through a web
> service (e.g. a byte array, or otherwise) I think you'll find much better
> built in support to older office files for doing a more standard file post
> over http.
>
> You can create a very basic web page... just a class that descends from[/color]
the[color=blue]
> Page class, and on the Page load event, you can check for the files being
> uploaded. It sounds like you already have that working on the[/color]
office/client[color=blue]
> side -- getting it to work on the server side should be easy.
>
> I wonder, then, why you are wanting to use the web service? I guess
> Microsoft has done a lot of marketing work on how great web services[/color]
are --[color=blue]
> but if the client can't easily consume the web service, it's not much use.
>
> That's just my two cents.
>
> --
> Mike Mayer, C# MVP
> mike@mag37.com
> http://www.mag37.com/csharp/
>
>
> "Alphonse Giambrone" <NOSPAMa-giam@example.invalid> wrote in message
> news:uwLmYqzHEHA.3848@tk2msftngp13.phx.gbl...[color=green]
> > Thanks both for the replies.
> >
> > The Office toolkits are not an option. I should have mentioned that I am
> > using vba with wininet api for the upload because I need the solution to
> > work with Access 97 and up without any additional references or[/color][/color]
installs.[color=blue]
> It[color=green]
> > is pretty safe to assume my users have IE and therefore wininet.dll.
> >
> > It seems that you are saying I can't post the file to a web service, but[/color]
> can[color=green]
> > to a web page. This would be ok if need be, but I would prefer using a[/color][/color]
web[color=blue][color=green]
> > service.
> > Am I understanding this correctly?
> >
> > --
> >
> > Alphonse Giambrone
> > Email: a-giam at customdatasolutions dot us
> >
> >
> > "Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
> > news:yJ$BPhqHEHA.3904@cpmsftngxa06.phx.gbl...[color=darkred]
> > > Hi Alphonse,
> > >
> > > From your description, you are wanting to generate a webserivie or a
> > > webform page which can help process the uploaded file postd from a
> > > client(OFFICE VBA ?).
> > >
> > > As for this question, here are my suggestions:
> > > 1. If use WebService, it is general that we define a certain webmethod
> > > which takes a byte array param and a string param such as
> > > pubic void UploadFile(bytes as Byte() , filename as String)
> > >
> > > And then, we can easily call it in .NET application since we can use[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > WSDL.EXE or the VS.NET to generate a easytouse client proxy class.
> > >
> > > However, since you'd like to call the webservice in VBA application, I
> > > think two mean in VBA can help to call webservice:
> > > a) use MXXML COM component to send raw XML soap message, this will[/color][/color][/color]
have[color=blue]
> us[color=green][color=darkred]
> > > to write the soap http message manually and post it via XMLHTTP[/color][/color]
> component.[color=green][color=darkred]
> > >
> > > b) There is a webservice add-in in OFFICE which can help to generate[/color][/color][/color]
a[color=blue][color=green][color=darkred]
> > > webservice proxy. I think this will be more convenient. You may have a
> > > search in MSDN to see whether the certain ADD-IN will help.
> > >
> > >
> > > 2. In addition to webservice, I think a simple asp.net webform page is[/color]
> > also[color=darkred]
> > > capable of handling client uploaded file. The ASP.NET 's butildin
> > > Request(HttpRequest class) object has a "Files" member which can help[/color][/color][/color]
to[color=blue][color=green][color=darkred]
> > > handle the client uploaded files. Here are some references on the
> > > HttpRequest.Files member and handle upload files in ASP.NET:
> > > #HttpRequest.Files Property
> > >[/color]
> >[/color]
>[/color]
http://msdn.microsoft.com/library/en...webhttprequest[color=blue][color=green][color=darkred]
> > > classfilestopic.asp?frame=true
> > >
> > > #Uploading Files Using the File Field Control
> > > (this article is focus on use webform to upload, but you can also get[/color]
> > ideas[color=darkred]
> > > on how to handle the file steam from other clients)
> > >[/color]
> >[/color]
>[/color]
http://msdn.microsoft.com/library/en...eupload.asp?fr[color=blue][color=green][color=darkred]
> > > ame=true
> > >
> > > Regards,
> > >
> > > Steven Cheng
> > > Microsoft Online Support
> > >
> > > Get Secure! www.microsoft.com/security
> > > (This posting is provided "AS IS", with no warranties, and confers no
> > > rights.)
> > >
> > > Get Preview at ASP.NET whidbey
> > > http://msdn.microsoft.com/asp.net/whidbey/default.aspx
> > >
> > >
> > >
> > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Closed Thread


Similar ASP.NET bytes