DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Writing Files in Web Service

  1. #1
    Join Date
    Mar 2004

    Writing Files in Web Service

    I have a webservice that has a webmethod that looks like this:

    public string WriteStudentFile(string user_id, string StudentXML)
    string newFile = ConfigurationSettings.AppSettings["Student_Physical"];
    newFile += user_id + ".xml";
    //I tried both FileStream s and Stream s
    Stream s = new FileStream( newFile, FileMode.Create );
    StreamWriter sw = new StreamWriter(s);
    sw.Write( StudentXML );

    return "Complete";

    Every time I invoke the service it faluts. However it works when I test it inside a simple Page_Load Block. When I debug this code block in the Page_Load function it hits the 4th Line (Stream s = new FileStream...) it jumps back to the first line where I declare newFile. It then continues to execute the code line by line.

    Does this have to do with why it is faulting? Why does this happen. Is there any other way I can write a simple file?

    Last edited by hoyaabanks; 10-11-2005 at 11:41 PM.

  2. #2
    Join Date
    Nov 2003
    Portland, OR
    When you say that it "faults," do you mean that you get an error message? If so, what is it? If not, enclose your code in a try...catch block and log or display the Message property of the exception object in the catch block.
    Phil Weber

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. send xml file to web service
    By Bill C in forum XML
    Replies: 2
    Last Post: 06-11-2012, 08:10 PM
  2. Calling web service via SSL (https)
    By Taiwo Ayedun in forum .NET
    Replies: 1
    Last Post: 10-15-2002, 05:18 AM
  3. Why Web Services are Important
    By Constance J. Petersen in forum .NET
    Replies: 13
    Last Post: 08-28-2002, 10:06 PM
  4. Replies: 0
    Last Post: 07-12-2002, 11:17 AM
  5. Web Service - web schmervice
    By Jonny in forum .NET
    Replies: 18
    Last Post: 04-03-2001, 07:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center