Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 752145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:44:51+00:00 2026-05-14T14:44:51+00:00

I am connecting to a web service to get some data back out as

  • 0

I am connecting to a web service to get some data back out as xml. The connection works fine and it returns the xml data from the service.

var remoteURL = EveApiUrl;

var postData = string.Format("userID={0}&apikey={1}&characterID={2}", UserId, ApiKey, CharacterId);

var request = (HttpWebRequest)WebRequest.Create(remoteURL);

request.Method = "POST";
request.ContentLength = postData.Length;
request.ContentType = "application/x-www-form-urlencoded";

// Setup a stream to write the HTTP "POST" data
var WebEncoding = new ASCIIEncoding();
var byte1 = WebEncoding.GetBytes(postData);
var newStream = request.GetRequestStream();

newStream.Write(byte1, 0, byte1.Length);
newStream.Close();

var response = (HttpWebResponse)request.GetResponse();

var receiveStream = response.GetResponseStream();

var readStream = new StreamReader(receiveStream, Encoding.UTF8);
var webdata = readStream.ReadToEnd();

Console.WriteLine(webdata);

This prints out the xml that comes from the service. I can also save the xml as an xml file like so;

TextWriter writer = new StreamWriter(@"C:\Projects\TrainingSkills.xml");
writer.WriteLine(webdata);
writer.Close();

Now I can load the file as an XDocument to perform queries on it like this;

var data = XDocument.Load(@"C:\Projects\TrainingSkills.xml");

What my problem is that I don’t want to save the file and then load it back again. When I try to load directly from the stream I get an exception, Illegal characters in path. I don’t know what is going on, if I can load the same xml as a text file why can’t I load it as a stream.

The xml is like this;

<?xml version='1.0' encoding='UTF-8'?>
<eveapi version="2">
  <currentTime>2010-04-28 17:58:27</currentTime>
  <result>
    <currentTQTime offset="1">2010-04-28 17:58:28</currentTQTime>
    <trainingEndTime>2010-04-29 02:48:59</trainingEndTime>
    <trainingStartTime>2010-04-28 00:56:42</trainingStartTime>
    <trainingTypeID>3386</trainingTypeID>
    <trainingStartSP>8000</trainingStartSP>
    <trainingDestinationSP>45255</trainingDestinationSP>
    <trainingToLevel>4</trainingToLevel>
    <skillInTraining>1</skillInTraining>
  </result>
  <cachedUntil>2010-04-28 18:58:27</cachedUntil>
</eveapi>

Thanks for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:44:51+00:00Added an answer on May 14, 2026 at 2:44 pm

    My guess is that you’re trying to use:

    string xml = GetXmlFromService();
    XDocument doc = XDocument.Load(xml);
    

    That’s trying to load it as if the XML was a filename!

    Instead, you want

    XDocument doc = XDocument.Parse(xml);
    

    Alternatively, use

    XDocument doc = XDocument.Load(textReader);
    

    or

    XmlReader reader = XmlReader.Create(stream);
    XDocument doc = XDocument.Load(reader);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm connecting to a web service hosted by a third-party provider. I've added a
I m working with some web services where i m requesting for web service
In the web-application I'm developing I currently use a naive solution when connecting to
I have a web app which connects to a server using a TCP connection
I'm about to get started converting a C# based desktop app to be web
I have a situation where my website needs to quickly retrieve data from my
I have a web page (.aspx) that calls a third party web service to
I am trying to make an asynchronous request with POST method from a web
I have written an application that connects to a SSL web service (including client
I am currently working on converting an existing web application to support an additional

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.