473,326 Members | 2,010 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,326 software developers and data experts.

web service that return XML file

Hi,
I need to generate an XML file in my web service function, I did a little testing: to select a table from database & save in XML format, this is my code:
Expand|Select|Wrap|Line Numbers
  1.  <WebMethod()> Public Sub myTest()
  2.         Dim cn As OdbcConnection
  3.         Dim myDataAdapter As OdbcDataAdapter
  4.         Dim myDataset As DataSet
  5.         Dim cmdString As String
  6.         cmdString = "select * from myTable"
  7.         cn = New OdbcConnection("DSN=mydsn;srvr=myserver;DB=mydatabase;UID=sa;PWD=sa")
  8.         myDataAdapter = New OdbcDataAdapter(cmdString, cn)
  9.         myDataset = New DataSet
  10.         myDataAdapter.Fill(myDataset, "triage")
  11.         myDataset.WriteXml(HttpContext.Current.Server.MapPath("test.xml"))
  12.     End Sub
I got error: System.UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\WebServTest\test.xml" is denied.

But when I use the same code for normal webform, it works & create the test.xml for me.

so what is my problem here??? please help!
thanks
Twee
Aug 29 '08 #1
4 1343
Shashi Sadasivan
1,435 Expert 1GB
You might need to give write access to the application from the iis server settings for that service.
Aug 29 '08 #2
I add these 2 users with modify access to the folder I need to write XML to: ASPNET & IUSR_pcname
then it works
thank you
Twee
Sep 3 '08 #3
Hi Shashi,
I now do not write XML to the same folder where the application stays, I write it to other server say:
myDataset.WriteXml(HttpContext.Current.Server.MapP ath("http://10.60.64.102/APP/XML/test.xml"))
then I got this error:
System.ArgumentException: URI formats are not supported.

Help please
Thank you
Twee
Sep 3 '08 #4
Curtis Rutland
3,256 Expert 2GB
Well, how can one server map a path to another one? IIS on Server A doesn't see or know what a path pointing to Server B actually maps to. You simply can't do it that way. ASP.NET can write to a network share, as far as I know. You might be able to write to a UNC path.
Sep 3 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: jabailo | last post by:
I wrote a program that loops through a file of records. It parses each line in the file and sends them to a web service that inserts them into an AS400DB2 database using Asynch calls. This is...
5
by: SP | last post by:
Please advice. I am not familiar with the concepts of windows service. I am trying to access a xml configuration file from windows service. But it is failing. configuration file is in the same...
0
by: Seth | last post by:
For some reason my service works fine except that it will create the file in my c drive, but will not write to the file. Sorry if this is a duplicate post, i have found some that ask the same...
3
by: Doug Bailey | last post by:
I am trying to control a Windows Service via a Web Service interface. (I am developing in .NET2003) I am using the ServiceController object which allows me to read the state of the services with...
4
by: kkt49 | last post by:
# vim: et sw=4 ts=8 sts from wxPython.wx import * import sys, os, time import pywintypes import win32serviceutil import win32service import win32event import win32process
4
by: rikleo2001 | last post by:
Hello Experts. I need your help, I am new to XML web service, and I have to complete one task. Here is current situation. 1. I have web service running to recieve SOAP message from an...
1
by: Alan Sloan | last post by:
I have written a Web Service that interacts with a COM component to extract a file from another system. Basically the Web Service accepts a part number and a rev and extracts the file to a...
20
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
I was executing the steps given in http://suppor.microsoft.com/kb/308359 for testing a sample web service application. However, the following line gives a compilation error: localhost.Service1...
5
by: TompIfe | last post by:
Hi, I have a web service that reads data from an Access database using datareader and place the data in an array that the web method returns. Now, I want to make the web service also to return an...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.