By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,562 Members | 1,222 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,562 IT Pros & Developers. It's quick & easy.

File Upload Web Service

P: n/a
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

Nov 18 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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


Nov 18 '05 #2

P: n/a
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.
Nov 18 '05 #3

P: n/a
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-******@online.microsoft.com> wrote in message
news:yJ**************@cpmsftngxa06.phx.gbl...
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


Nov 18 '05 #4

P: n/a
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
mi**@mag37.com
http://www.mag37.com/csharp/
"Alphonse Giambrone" <NO**********@example.invalid> wrote in message
news:uw**************@tk2msftngp13.phx.gbl...
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-******@online.microsoft.com> wrote in message
news:yJ**************@cpmsftngxa06.phx.gbl...
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



Nov 18 '05 #5

P: n/a
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]" <mi**@mag37.com> wrote in message
news:up**************@TK2MSFTNGP11.phx.gbl...
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
mi**@mag37.com
http://www.mag37.com/csharp/
"Alphonse Giambrone" <NO**********@example.invalid> wrote in message
news:uw**************@tk2msftngp13.phx.gbl...
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-******@online.microsoft.com> wrote in message
news:yJ**************@cpmsftngxa06.phx.gbl...
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




Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.