473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to create a web service to take uploading file?

Hi,

I want to create a web service to upload an xml file. Do anyone have
sample code? Thanks !!!

Regards,
Rudy
Oct 6 '06 #1
5 3438
Thers an example here of accepting a binary stream from a client to a
webservice method, and returning it. No reason why you cant use the same to
accept any old file and strip out the return bit.

http://www.codeproject.com/csharp/do...nvertimage.asp

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"Rudy Ko" <rk*@lucent.comwrote in message
news:uA**************@TK2MSFTNGP02.phx.gbl...
Hi,

I want to create a web service to upload an xml file. Do anyone have
sample code? Thanks !!!

Regards,
Rudy


Oct 6 '06 #2
Rudy,
If you are talking about an attachment, and you want to be
standards-compliant, then look at the DIME attachment extension that's in WSE
(Web Service Extensions).

Otherwise, you could send any file as a byte stream as John indicated, or
you can just send the Xml Document as either a string or as an XmlDocument.
The main issue is getting it into the webservice call as a method parameter -
you can't do that with the standard "file upload control" arrangement because
it's not a multipart-encoded FORM post as it is with a web page.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Rudy Ko" wrote:
Hi,

I want to create a web service to upload an xml file. Do anyone have
sample code? Thanks !!!

Regards,
Rudy
Oct 6 '06 #3
Rudy Ko wrote:
I want to create a web service to upload an xml file. Do anyone have
sample code? Thanks !!!
XML = string

so

[WebMethod]
public void Upload(string filename, string xml)
{
...
}

should do.

BTW, simple HTTP upload is more efficient than a web service
for upload.

Arne
Oct 7 '06 #4
There are some compatability issues if you send a string. Under the sheets
..net will encode this data. If you are exchanging it with another .net
application then you won't see any problems, but if you need to exchange
this data with another application that cannot or does not understand
encoding then you will run into probems.

The best way to send and receive xml is an XmlDocument object.

"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:RSCVg.20681$2g4.16117@dukeread09...
Rudy Ko wrote:
> I want to create a web service to upload an xml file. Do anyone have
sample code? Thanks !!!

XML = string

so

[WebMethod]
public void Upload(string filename, string xml)
{
...
}

should do.

BTW, simple HTTP upload is more efficient than a web service
for upload.

Arne
Oct 7 '06 #5
Greg wrote:
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:RSCVg.20681$2g4.16117@dukeread09...
>Rudy Ko wrote:
>> I want to create a web service to upload an xml file. Do anyone have
sample code? Thanks !!!
>[WebMethod]
public void Upload(string filename, string xml)
{
...
}

should do.
There are some compatability issues if you send a string. Under the
sheets .net will encode this data. If you are exchanging it with
another .net application then you won't see any problems, but if you
need to exchange this data with another application that cannot or does
not understand encoding then you will run into probems.

The best way to send and receive xml is an XmlDocument object.
2 x wrong

A string with XML works fine with non .NET apps.

XmlDocument does not work with non .NET apps.

Arne
Oct 7 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
0
by: wym | last post by:
I have written a web service that provides the following methods: UploadFile SetNTFSSecurity Their purpose is to allow a user to Upload a file to a shared folder with "Everyone" as permission...
2
by: Troy | last post by:
I installed the default hello world web service on my site and get the error below. My site is being hosted by a 3rd party and i copied the asmx file to a folder in my root, the /bin is in the same...
1
by: Ramesh Chawla | last post by:
I am making a web service which accesses a shared directory on the netwoek to upload a file there. Here comes the problem, When I use impersonation and give the userName & password of an...
1
by: Kevin Yu | last post by:
hi All is there any good solution to uploading/passing file as parameter to a web service call? thx Kevin
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
0
by: mrinalaryan | last post by:
create folder & upload file in the web server through web service-C# -------------------------------------------------------------------------------- im using web service to connect windows form...
2
by: Niclas | last post by:
Hi, I have developed a WCF service that I am planning to host with a service provider. After spending some time uploading the service and fiddling around with the .svc file and Web.config, I...
1
by: Faisal Shafiq | last post by:
I want to upload a file direct to the Silverlight Streaming Service from a Web Client such as silverlight application. As per our product requirement we want to upload a .WMV file directly from...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.