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 7429415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:58:05+00:00 2026-05-29T08:58:05+00:00

I’ve got a simple .NET web service that is supposed to return a string

  • 0

I’ve got a simple .NET web service that is supposed to return a string value. It creates a DataSet and returns the GetXml() method, like so:

    [WebMethod]
    public string GetOpenIssues(string CustomerCode, string LocationShortName)
    {
        DAL.EncodedConnectionString = ConfigurationManager.ConnectionStrings["EncodedConnectionString"].ConnectionString;
        System.Data.SqlClient.SqlCommand sc = new System.Data.SqlClient.SqlCommand("GetOpenIssues");
        sc.Parameters.AddWithValue("CustomerCode", CustomerCode);
        sc.Parameters.AddWithValue("LocationShortName", LocationShortName);
        return DAL.SPDataSet(sc, "OpenIssues").GetXml();
    }

The problem is when I call this web service from either another program or run it in debug mode and view the results, it gives me the following:

<?xml version="1.0" encoding="utf-8" ?> 
<string xmlns="RemoteWebService"><OpenIssues> <Table> <IssueID>15351</IssueID>   <IssueSummary>Computer keeps crashing. This continues to be a problem</IssueSummary> <LocationName>West Side</LocationName> <Status>WIP</Status> <CustomerID>89755</CustomerID> <CustomerName>West Side Computers</CustomerName> <CustomerShortName>WSC</CustomerShortName> <Notes /> <STATUS1>Work In Progress</STATUS1> <SubmittedBy>WSC - Tom Johns</SubmittedBy> <EQ_Replaced>true</EQ_Replaced></Table> </OpenIssues></string> 

Which, as you can tell, is not properly formatted. For some reason it’s putting spaces in between each element.

Any ideas as to what I’m doing wrong? All I want to do is return the xml for this result so I can use it in other in-house apps that aren’t written in .NET.

UPDATE
Thanks for the replies but I believe formatting is an issue and here’s why. I’m writting an Android app that consumes this web service. I can connect and retrieve the xml string just fine but when I try to parse it, it misses the node because of the extra space in the string. To confirm this even more, if I copy and paste the output directly from the web service URL, into an empty file, save it as .xml and try to view it, it doesn’t open. Also, when I try to right-click on the web service output page to "view source", it says it can’t be viewed at this time. However, when I use a correctly formatted xml string, I can view it in a browser and view the source.

Not too sure what else to say here….We’ve done a lot of troubleshooting on the Android/Java side of things, here StackOverflow Android Question and when we use the XML as formatted above (meaning with the extra spaces in it), the parser doesn’t pick up the IssueSummary element. However, if I manually remove the spaces and point the app to the new file (instead of the web service), then it finds the IssueSummary element and displays the data fine. Doesn’t that lead you to believe it’s got something to do with the spaces between the nodes?

UPDATE #2 – Resolution

After digging and digging I was able to figure out a resolution. Our web method was using .GetXml() which was returning the Xml above with spaces between each node. My coworker and I tried several things with the web service and figured out if we use an XmlDocument and call the InnerXml property instead, it returns the xml without those spaces:

    [WebMethod]
    public string GetOpenIssues(string CustomerCode, string LocationShortName)
    {
        DAL.EncodedConnectionString = ConfigurationManager.ConnectionStrings["EncodedConnectionString"].ConnectionString;
        System.Data.SqlClient.SqlCommand sc = new System.Data.SqlClient.SqlCommand("GetOpenIssuesSite");
        sc.Parameters.AddWithValue("CustomerCode", CustomerCode);
        sc.Parameters.AddWithValue("ICAO", LocationShortName);
        System.Data.DataSet ds = DAL.SPDataSet(sc, "OpenIssues");

        System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
        System.IO.StringWriter sw = new System.IO.StringWriter();
        ds.WriteXml(sw);

        doc.LoadXml(sw.ToString());

        return doc.InnerXml;
    }

Once we did this, the parser on the other end (Android App) processed it perfectly. So it appears safer to use .InnerXml of an XmlDocument instead of the .GetXml() of a DataSet.

Thanks to those who have helped, very much appreciated!

  • 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-29T08:58:06+00:00Added an answer on May 29, 2026 at 8:58 am

    I think the formatting is trivial. The xml parser will parse the document as xml regardless if there is a space between them. Calls a function, gets an xml, and xml reader processes the xml. Maybe the document itself has a space.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I am doing a simple coin flipping experiment for class that involves flipping a
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.