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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:56:23+00:00 2026-06-06T15:56:23+00:00

I have a simple web service method which I’m trying to convert: <WebMethod()> _

  • 0

I have a simple web service method which I’m trying to convert:

<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=True)> _
Public Function GetEmployees() As Object
    Dim _db As New DataClasses1DataContext()

    Return New With {.data = _db.Employees}
End Function

And this is my C# code:

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
public object GetEmployees()
{
    DBModelDataContext _db = new DBModelDataContext();
    return new { data = _db.Employees };
}

But when I run my service I get an error:

System.InvalidOperationException: Wystąpił błąd podczas generowania dokumentu XML. --->
System.InvalidOperationException: Aby serializacja XML była możliwa, dla typ&#243;w dziedziczących po elemencie IEnumerable należy zaimplementować metodę Add(System.Object) na wszystkich poziomach hierarchii dziedziczenia. Dla elementu System.Data.Linq.Table`1[[Scheduler.db.Employee, Scheduler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] metoda Add(System.Object) nie jest implementowana.
w System.Xml.Serialization.TypeScope.GetEnumeratorElementType(Type type, TypeFlags& flags)
w System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, MemberInfo memberInfo, Boolean directReference)
w System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError)
w System.Xml.Serialization.XmlSerializationWriter.CreateUnknownTypeException(Type type)
w System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String name, String ns, Object o, Boolean xsiType)
w Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_Object(String n, String ns, Object o, Boolean isNullable, Boolean needType)
w Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write2_anyType(Object o)
w Microsoft.Xml.Serialization.GeneratedAssembly.ObjectSerializer.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
w System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- Koniec śladu stosu wyjątków wewnętrznych ---
w System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
w System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces)
w System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
w System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue)
w System.Web.Services.Protocols.HttpServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
w System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
w System.Web.Services.Protocols.WebServiceHandler.Invoke()

I’m stuck for 4 hours now with this :/

I have a simple sql server database with 2 tables Employee and Plans.

I need this kind of format to work with Ext Scheduler.
VB code is from demo on Ext Scheduler webpage, I just want to convert it to C#.

EDIT:
I’m using Visual Studio 2008 (.NET 3.5) and the demo in VB was created in 2010(.NET 4.0).

  • 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-06-06T15:56:24+00:00Added an answer on June 6, 2026 at 3:56 pm

    The problem was result format. XML crashed, but JSON works.
    I’ve needed that webservice to return JSON data, so problem solved (partially)

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

Sidebar

Related Questions

I have a simple web service and I want to make a method which
I have written a simple WCF web service in C# which returns records from
I have written a simple HelloWorld web service. Which takes an ArrayList as parameter.
I have written this code which accesses the Delete method on Web Service x,
Hello I have a simple wcf service like this, with a test method which
i have a simple asmx page with one web method which return array of
I have a simple WCF web service on my machine which I have developed
I have a web service which outputs a JSON serialised string object. This is
I have a simple web service that uses an oracle database. When I test
I have a simple web service that has an API third party developers are

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.