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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:15:02+00:00 2026-05-22T01:15:02+00:00

Ok, I know I must be missing something simple. Thank-you for your help! [EDITED

  • 0

Ok, I know I must be missing something simple.

Thank-you for your help!

[EDITED to clarify]

The problem I’m having is that the JSON input is not being deserialized properly or something and is giving me an empty XML result. I want the output in XML format, I just don’t want it to be blank.

The code is a simplified version of my actual code. In my real code I’m retreiving the JSON from another website, and I’m trying to parse it and return it in an XML soap request.

To simplify things, I took the JSON string and simply hard coded it as an example.

[WebService(Namespace="my.soap")]
public class StockQuote : WebService
{

  [WebMethod(Description="",EnableSession=false)]
  public ResultSet IBM()
  {
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    string json = "{\"ResultSet\":{\"Query\":\"ibm\",\"Result\":[{\"symbol\":\"IBM\",\"name\": \"International Business Machines Corp.\",\"exch\": \"NYQ\",\"type\": \"S\",\"exchDisp\":\"NYSE\",\"typeDisp\":\"Equity\"},{\"symbol\":\"IBM.F\",\"name\": \"IBM\",\"exch\": \"FRA\",\"type\": \"S\",\"exchDisp\":\"Frankfurt\",\"typeDisp\":\"Equity\"},{\"symbol\":\"IBM.DE\",\"name\": \"IBM\",\"exch\": \"GER\",\"type\": \"S\",\"exchDisp\":\"XETRA\",\"typeDisp\":\"Equity\"},{\"symbol\":\"^AXI\",\"name\": \"Stlmt ID - NASDAQ OMX Alpha IBM\",\"exch\": \"NAS\",\"type\": \"I\",\"exchDisp\":\"NASDAQ\",\"typeDisp\":\"Index\"},{\"symbol\":\"^IVSPY\",\"name\": \"NASDAQ OMX Alpha IBM vs. SPY\",\"exch\": \"NAS\",\"type\": \"I\",\"exchDisp\":\"NASDAQ\",\"typeDisp\":\"Index\"},{\"symbol\":\"IBMSX\",\"name\": \"Invesco Multi-Sector B\",\"exch\": \"NAS\",\"type\": \"M\",\"exchDisp\":\"NASDAQ\",\"typeDisp\":\"Fund\"},{\"symbol\":\"IBM.BE\",\"name\": \"IBM\",\"exch\": \"BER\",\"type\": \"S\",\"exchDisp\":\"Berlin\",\"typeDisp\":\"Equity\"},{\"symbol\":\"IBM.SG\",\"name\": \"IBM\",\"exch\": \"STU\",\"type\": \"S\",\"exchDisp\":\"Stuttgart\",\"typeDisp\":\"Equity\"},{\"symbol\":\"IBM.BA\",\"name\": \"International Business Machines Corp.\",\"exch\": \"BUE\",\"type\": \"S\",\"exchDisp\":\"Buenos Aires\",\"typeDisp\":\"Equity\"},{\"symbol\":\"IBM.L\",\"name\": \"International Business Machines Corp.\",\"exch\": \"LSE\",\"type\": \"S\",\"exchDisp\":\"London\",\"typeDisp\":\"Equity\"}]}}";
    return serializer.Deserialize<ResultSet>(json);
  }
}

[Serializable]
public class ResultSet
{
  public string Query;
  public ResSet[] Result;
}

[Serializable]
public class ResSet
{
  public string symbol;
  public string name;
  public string exch;
  public string type;
  public string exchDisp;
  public string typeDisp;
}

I’m getting the following returned by the web service instead of the formatted object:

 <?xml version="1.0" encoding="utf-8" ?> 
    <ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="my.soap" /> 
  • 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-22T01:15:02+00:00Added an answer on May 22, 2026 at 1:15 am

    Your JSON string represents an object with a property named ResultSet, containing nested data.

    Note the difference between a JSON serialized ResultSet:

    {
       "Query": "ibm",
       "Result": [ ... ]
    }

    And a JSON serialized object which contains a ResultSet:

    {
       "ResultSet":
       {
          "Query": "ibm",
          "Result": [ ... ]
       }
    }

    In other words, it will work if you omit ResultSet from the input string:

    string json = @"{"Query":"ibm","Result":[ ... ]}";
    

    Or, if you deserialize the string into a class which has a property named ResultSet:

    public class ResultSetWrapper
    {
        public ResultSet ResultSet;
    }
    

    In which case you will need to use:

    return serializer.Deserialize<ResultSetWrapper>(json);
    

    Note that [Serializable] attribute has nothing to do with XML serialization, and is not needed. To control the output of the XmlSerializer, use attributes from the System.Xml.Serialization namespace.

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

Sidebar

Related Questions

I'm new to Python, and I know I must be missing something pretty simple,
I know I must be missing something, but in a while statement how does
I know SQL well but I must be missing something really dumb here. This
I know it must be something simple, but I just can't figure it out..
Okay, I know I must be missing something obvious here. Here's the sample code
I know I must be missing something here, but I cannot seem to get
I know I must be missing something. If I make changes to a datagriditem
I know I must be missing something really obvious here. B.GetInstance().Call() generates the error:
I know that there must be some differences. I have a Silverlight component (
I know that in Lisp a list must end with nil, but expression like

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.