文件上载Web服务 [英] File Upload Web Service

查看:67
本文介绍了文件上载Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个Web服务来接受从vba(Access)应用程序通过http post

上传的文件。

感谢vb中的有用链接新闻组和我以前使用WinInet的工作

api我能够编写代码来进行上传。我知道这有效,因为

我通过发布到保存文件的asp页面进行测试。

现在我需要创建一个.NET Web服务来接受并保存文件。在我找到的Web服务示例中,唯一处理文件上传的文件

从另一个.net对象(如webform)接收文件作为字节数组。

如何访问http帖子并在网页上提取上传的文件

服务。

如果不可能,怎么样来自aspx页面?


TIA


-


Alphonse Giambrone
电子邮件:a-giam at customdatasolutions dot us

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

推荐答案

您好Alphonse,


从您的描述中,您想要生成一个webserivie或

webform页面,它可以帮助处理从

客户端发布的上传文件(OFFICE VBA? )。


至于这个问题,我的建议如下:

1.如果使用WebService,我们通常会定义某个webmethod

它接受一个字节数组参数和一个字符串参数如

pubic void Uplo adFile(字节为Byte(),文件名为String)


然后,我们可以在.NET应用程序中轻松调用它,因为我们可以使用

WSDL .EXE或VS.NET生成一个easytouse客户端代理类。


但是,既然你想在VBA应用程序中调用webservice,我就是

认为VBA中的两个意思可以帮助调用webservice:

a)使用MXXML COM组件发送原始XML soap消息,这将有我们

写肥皂http消息手动并通过XMLHTTP组件发布。


b)OFFICE中有一个web服务加载项,可以帮助生成一个

webservice代理。我觉得这会更方便。您可以在MSDN中进行

搜索以查看某些ADD-IN是否有用。

2.除了webservice,我认为一个简单的asp.net webform页面也是

能够处理客户端上传的文件。 ASP.NET的butildin

请求(HttpRequest类)对象有一个文件对象。会员可以帮助

处理客户端上传的文件。以下是一些关于

HttpRequest.Files成员的参考资料,并处理ASP.NET中的上传文件:

#HttpRequest.Files Property
http://msdn.microsoft.com/library/en...webhttprequest

classfilestopic.asp?frame = true


#使用文件字段控件上传文件

(本文是专注于使用webform上传,但你也可以获得关于如何处理来自其他客户端的文件的想法


http://msdn.microsoft.com/library/en...eupload.asp? fr

ame = true


问候,


Steven Cheng

Microsoft在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)


在ASP.NET上获取预览whidbey
< a rel =nofollowhref =http://msdn.microsoft.com/asp.net/whidbey/default.aspxtarget =_ blank> http://msdn.microsoft.com/asp.net/whidbey /default.aspx

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



您好Alphonse,


适用于Office XP和amp ; 2003年VBA Web服务开发,Microsoft发布了Office Web服务工具包,它将为您的b $ b b方案提供一些帮助。

Microsoft Office 2003 Web服务工具包2.01
< a rel =nofollowhref =http://www.microsoft.com/downloads/details.aspx?FamilyID=fa36018a-e1cf-48a3-9b35-169d819ecf18&DisplayLang=entarget =_ blank> http:/ /www.microsoft.com/downloads/d ... .DisplayLang = en

Microsoft Office XP Web服务工具包2.0
http://www.microsoft.com /downloads/d...displaylang=en

一些MSDN技术文章将介绍更多相关信息。

Microsoft Office XP Web服务工具包
http:// msdn .microsoft.com /李brary / en ... itoverview.asp


如果您有任何其他问题,请随时告诉我。


最好的问候,

Wei-Dong Xu

微软产品支持服务

安全! - www.microsoft.com/security

此帖子原样是按原样提供的。没有保证,也没有授予任何权利。
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.


感谢您的回复。


Office工具包不是一个选项。我应该已经提到我使用带有wininet api的vba进行上传,因为我需要解决方案

与Access 97一起使用而不需要任何额外的引用或安装。它可以非常安全地假设我的用户有IE,因此wininet.dll。


看来你说我不能发帖子到一个网络服务,但可以

到一个网页。如果需要,这可以,但我更喜欢使用网页

服务。

我能理解这一点吗?


-


Alphonse Giambrone

电子邮件:a-giam at customdatasolutions dot us

Steven Cheng [MSFT]" ; <,V - ****** @ online.microsoft.com>在消息中写道

新闻:yJ ************** @ cpmsftngxa06.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...
嗨Alphonse,

根据您的描述,您希望生成一个webserivie或
webform页面,它可以帮助处理从
客户端发布的上传文件(OFFICE VBA?)。

至于这个问题,这里有我的建议:
1.如果使用WebService,我们通常会定义一个特定的web方法,它采用一个字节数组参数和一个字符串参数,如
pubic void UploadFile(字节为Byte(),文件名为String)

然后,我们可以在.NET应用程序中轻松调用它,因为我们可以使用
WSDL.EXE或VS.NET生成一个easytouse客户端代理类。

但是,既然你想在VBA应用程序中调用webservice,我认为在VBA中有两个意思可以帮助调用webservice:
a)使用MXXML COM组件发送原始XML soap消息,这将让我们手动编写soap http消息d通过XMLHTTP组件发布它。

b)OFFICE中有一个web服务加载项,可以帮助生成一个
webservice代理。我觉得这会更方便。您可能在MSDN中搜索某个ADD-IN是否有帮助。

2.除了webservice之外,我认为一个简单的asp.net webform页面是
还能够处理客户端上传的文件。 ASP.NET的butildin
Request(HttpRequest类)对象有一个Files对象。可以帮助处理客户端上传文件的成员。以下是关于
HttpRequest.Files成员的一些参考,并处理ASP.NET中的上传文件:
#HttpRequest.Files属性
http://msdn.microsoft.com/library/en...webhttprequest classfilestopic.asp?frame = true

#Uploading文件使用文件字段控件
(本文重点介绍如何使用webform上传,但您还可以获得有关如何处理文件流的
想法来自其他客户)
http://msdn.microsoft.com/library/en...eupload.asp?fr ame = true

问候,

Steven Cheng
Microsoft在线支持

获得安全! www.microsoft.com/security
(此帖已提供按原样,没有任何保证,也没有授予
权利。)

在ASP.NET上预览whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

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



这篇关于文件上载Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆