How to send an XML file to a Web Service (that records the XML file to HD)

I did this because I wanted to send an XML file to another computer,
whether it be next to the one I’m using  or in another country.
You will need to adapt my example in order for it to work as you want
it. All I demonstrate here is that it is possible to send an XML file
to another computer using XML Web Services.

Let me know if it works for you.

The code assumes you can use Visual Studio.

Make the Web Service

1. Make a new project, choosing to make a Web Service.
2. In the code behind-page, place the code below.
3. Build the Web Service.

<WebMethod()> Public Sub data(ByVal xml As DataSet)

        ' This is not a Function procedure because we are not sending information back to the
        ' calling application.

        ' As we are dealing with a DataSet, above, we use "As DataSet" for the Data Type requirement
        ' of that line. "xml" is just a name for the data being passed through.
        ' You'll see that "xml" is the name of the DataSet in the Web Form code.

        ' In order to "use" the supplied DataSet, we need to create a DataSet, so it can
        ' be stored.
        Dim WriteToHd As New DataSet

        ' The magical bit! We put the sent DataSet, "xml", into DataSet "WriteToHd".
        ' Below is how we do this. Quite simple.
        WriteToHd = xml

        ' Call the "WriteXml" method of the DataSet object.

        ' That's it.

    End Sub
Make the Web Form

In Visual Studio, add a reference to the Web Service, otherwise the code below won’t work. Ensure that you have compiled the Web service before doing so otherwise you’ll get an error message as you try to access the Web Service.

1. Make a new Web Form.
2. Place a clickable control, such as a BUTTON, onto the Web Form.
3. Double click it.
4. In the code behind-page, type this in (between the sub, end code), making alterations as hinted.
5. Build then browse.
6. Click the button!


To be placed inbetween the “sub“ and “end sub“ code:

        ' This code doesn't contain the actual Web Service being used because we are
        ' "setting up" the class for use. Can't use the Web Service until we do so

        ' name of the class file in solution explorer: "CalcService".
        ' name of class file, in the code: "MortgageCalculationService"

        Dim ws As New CalcService.MortgageCalculationService ' if you use different names in your Web Service code, you'll be writing
        ' something else.

        ' Create a dataset so that an XML file can be put into it
        Dim xml As New DataSet

        ' Load XML into DataSet

        ' Send to Web Service called "data".
        ' The XML file is stored in Dataset object "xml" so I use "xml" in the brackets.
        ' By placing the "xml" object into the ( ), I get to send it to the Web Service
        ' named "data".

7/7/2005 1:28:15 PM 851 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 33


Similar Artilces:

xml web service --uploading the file to the xml web service
how can we upload the file in the xml web service 1.i mean what will be the return value in the proxy class 2.and how am i going to send the file to the xml web service----regards Bipul Kumar Here are some links to articles that helped us get this done: Hope this helps....

How to send almost any file (.dll, .exe, .zip, .avi) to an XML Web Service that writes it to HD.
Send a picture, movie, zip or executable file to an XML Web Service that saves it HD. In my tests, not all binary and non-binary files would transfer. Files over the browser file size limitation can't be sent (just email these). For security reasons, store the web service code on a computer that doesn't contain anything valuable (data as well as apps), is not connected (wired or wireless) to another computer, and which can be formatted anytime. This code is not for use in any environment where security is critical. Treat this code as proof of concept. If you simply want to s...

XML Transform to 1 XML file to another XML File
Hello All  I am a novice programmer. I want to transform 1 xml file to another xml file. I am looking for a example code where user will select source xml file and create another xml file in different file with different fields with some default validation of parsing date and default values.  Can anyone help me or let me know any available source code in C#/ASP.Net?  Ms Disha I am assuming you know xslt, if not, you would have to go look at that.  But if you do, then this document will help you out

How can i add a xml file to an other xml file?
such as i have a xml file : <item1> <item2> <item3>aaa</item3> <item4>bbb</item4> </item2> <item1> an other one is: <item2> <item3>ccc</item3> <item4>ddd</item4> <item2> i wanted is: <item1> <item2> <item3>aaa</item3> <item4>bbb</item4> </item2> <item2> <item3>ccc</item3> <item4>ddd</item4> <item2> <item1> thanks. You ca...

Create an XML file from another XML file
I am using VS 2005 with C#.  I would like to create/generate an xml file from another XML with a differnt structure.  Basically, I want to create the actual xml file for my users whenever they raise my web service method. This is the actual structure of my xml i would like to create the following <Education>  <mydata>    <year>1988 - 1995</year>    <reward>High School Diploma</reward>    <school>Miami Secondary</school>  </mydata>  ...</Education> The original ...

Load XMl file and read xml file
How do I load and read nodes from the xml file in c#.??? ThankYou Sample code: Yang.NET Developer Here is how you read xml file and loop and display nodesXmlDocument xDoc = new XmlDocument();xDoc.Load(xmlPath); foreach(XmlNode node in xDoc.SelectNodes("//nodeName you want to display")){Response.Write("name: " + node.Attributes["name"].InnerText + " value: " + node.Attributes["value"].InnerText);}...

Splitting XML file to different XML files
hi,I have xml file that represent a table , one of the element(column) of the xml represent category..I want to split the xml file to different xml files base on the categories (each xml file will represent different category).The question is , if it posible to split the original xml using one xslt file, or i must create different xslt file for each category?thanks in advance one xslt for each output.You can also do this with XmlDocument and save it to two seaprate paths.HTHRegards,Rob...

After download a xml file, why my xml file has been changed?
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click        Dim fileName As String = Server.MapPath("~/Products.xml")        Response.Clear()         Response.ContentType = "text/xml"        Response.AddHeader("Content-Disposition", "attachment; filename=" & fileName)                Response.WriteFile(fileName)  ...

Need help in making xsl file to transform My given xml file to my needed xml file
 want's to need help in creating an xsl file to transform My current xml file data which is following <NewDataSet> <Table> <Title>MyFirstTitle</Title> <ExtraColumn1>2007-01-12T10:14:00+05:00</ExtraColumn1> <BookNumber>1181013</BookNumber> <CompanyName>TestComany1</CompanyName> <ZipCode>91006</ZipCode> <City>Arcadia</City> <State>CA</State> <Country>US</Country> <Description>TestDescription1</Description> <ExtraColumn2>See Book Description</ExtraCo...

Microsoft Chart control for .NET Framework about state management and serialization problem, it works OK with one XML file but fails with another XML file
I use Microsoft Chart control for .NET Framework , you can see details at The Chart1 is load data from a xml and save to ViewStateData, so even if after I click Reload button, the chart1 still display OK! I'm very strange that the chart1 works well after click Reload button if it's loaded from Chart1.Serializer.Load(HttpContext.Current.Server.MapPath("~/Template/1.xml"));but chart1 don't display fter click Reload button if it's loaded from Chart1.Serializer.Loa...

Creating XML files with existing XML file format
My XML template file looks like this: <?xml version="1.0" standalone="yes"?> <txProductivityUpdate xmlns="RetailerGUI/txProductivityUpdate.xsd"> <header> <session-id>terchymppg2uieynky3pxfuz</session-id> <trancode>113</trancode> <request-timestamp>2003102012540750</request-timestamp> </header> <body> <chn-client>111</chn-client> <chn-customer>11111</chn-customer> <chn-name1>BERGEM, PHYLLIS</chn-name1>...

How to Split a XML file to multiple small XML Files
Hello, I am trying to split a XML file to multiple small xml files in and am trying to get the best possible approach to this. Any help on this will be great... Sample example on what I am trying to do... Source XML document -------------------------- <?xml version="1.0" standalone="yes"?> <SynchronizationObjectsDocument > <ApplicationArea> <DocId>dea9593b-4c60-4c1a-ab7f-004a4e336ac5</DocId> <CreationDateTime>2004-05-13T21:31:48-04:00</CreationDateTime> </ApplicationArea> &...

is it possible to exporting XML file from a website to windows application through .Net Remoting or web services
Hello everyone ..i have a website through which i want interact with a desktop appplication to send a XML file.With .Net Remoting i think it's possible but abt webservices i m nt sure is it possible with .Net Remoting or Web Services???plz clear me abt it.    Possible with web services. Expose a web method and add a reference to the webservice to your windows application and call the web methodJeev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~If you get the answer to your question, please mark it as the answer.  Hello Jeev..sorry for replying late.But I think my scenari...

Sending XML data file to the XML channel
------_=_NextPart_001_01C885CF.D5FD4070 Content-Type: text/plain; charset="us-ascii" content-transfer-encoding: quoted-printable Hi, I want to push XML data file to the XML channel, please find the code snippet for the same. ######## #!/usr/bin/perl use LWP::UserAgent; my $browser =3D LWP::UserAgent->new; my $url =3D ''; open(FILE,"display.xml"); my @data=3D<FILE>; my $response =3D $browser->post( $url, Content =3D> @data ); print @data; ######## When I print @data,...

Web resources about - How to send an XML file to a Web Service (that records the XML file to HD) -

United States Department of Health and Human Services - Wikipedia, the free encyclopedia
The United States Department of Health and Human Services ( HHS ) is a Cabinet department of the United States government with the goal of protecting ...

Queensland Corrective Services officer suspended over relationship allegations
A prison officer has been suspended over allegations of an inappropriate relationship&nbsp;with a prisoner in a central Queensland jail.

Malcolm Turnbull pledges $300 million funding for drug treatment services
Almost $300 million will be invested in the drug addiction treatment sector as part of an historic national plan that shifts focus from policing ...

Hotel fish killers get community service
Three teenagers have been sentenced after they had headed to a luxury Cairns hotel in July and shot and killed two showpiece barramundi in the ...

Huge Creates New Global CMO, Client Services Roles
... Directors Patricia Korth-McDonnell and Eric Moore into the newly created global roles of chief marketing officer and president-client services, ...

Amazon brings Microsoft users into AWS with Active Directory service
Amazon has launched an AWS Directory Service for Active Directory , a fully managed implementation of Microsoft's authentication and user management ...

TSMC applies for 12-inch wafer fab and design service center in China
... Taiwan's Ministry of Economic Affairs for an investment project to build a wholly-owned 12-inch wafer manufacturing facility and a design service ...

Midtown's Brasserie to Close After Service on New Year's Eve
... Seagram Building. A rep from the Patina Group, Brasserie's mega-parent company , confirms that the restaurant will have its last dinner service ...

Consumers Turn to Texts for Customer Service Issues
A recent study shows some frustrated customers reported going so far as yelling at the call center agent or hanging up the phone.

It's Hard To Contain Bad Policy Ideas 'Public Service' Loan Forgiveness, For Example
Rather than debating which jobs will be regarded as "public service," we ought to dispense with the idea of forgiving student loans at all.

Resources last updated: 12/7/2015 10:57:53 AM