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

  • Home
  • SEARCH
  • 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 6658959
In Process

The Archive Base Latest Questions

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

I have a webservice that always returns a ReturnObject that is a class I

  • 0

I have a webservice that always returns a ReturnObject that is a class I have written like this:

public class ReturnObject
{
    public Status Status { get; set; }
    public Object Data { get; set; }
}

When I return a single object like an int or string etc in Data it is OK but when I want to return a list of typed objects the client that running the webservice as a WebReference getting this exception:

System.Web.Services.Protocols.SoapException: Server was unable to process request.
—> System.InvalidOperationException: There was an error generating the XML document
—> System.InvalidOperationException:
Typen
System.Collections.Generic.List`1[[Transticket.Domain.Models.ApsisMailingList,
Transticket.Domain, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null]] kan inte användas i den här kontexten. vid
System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String
name, String ns, Object o, Boolean xsiType) vid
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_Object(String
n, String ns, Object o, Boolean isNullable, Boolean needType) vid
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write3_ReturnObject(String
n, String ns, ReturnObject o, Boolean isNullable, Boolean needType)
vid
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write6_GetListsResponse(Object[]
p) vid
Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer5.Serialize(Object
objectToSerialize, XmlSerializationWriter writer) vid
System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter,
Object o, XmlSerializerNamespaces namespaces, String encodingStyle,
String id) — Slut på stackspårning för interna undantag —
vid System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter
xmlWriter, Object o, XmlSerializerNamespaces namespaces, String
encodingStyle, String id) vid
System.Web.Services.Protocols.SoapServerProtocol.WriteReturns(Object[]
returnValues, Stream outputStream) vid
System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[]
returnValues) vid
System.Web.Services.Protocols.WebServiceHandler.Invoke() — Slut
på stackspårning för interna undantag —

This exception is not in the webservice, it’s in the client call to the webservice after returning the data.

If I do another ReturnObject there and I specify a list of typed objects as data, it works well.

Someone have an idea how I generalize this? I have always thought that List is a type of Object but looks like a .NET bug, or I have missed something?

  • 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-26T01:58:30+00:00Added an answer on May 26, 2026 at 1:58 am

    XmlSerializer does not include type information in the output (contrast with BinaryFormatter); as such, there is no robust way of deserializing object, as the xml could be (quite literally) anything.

    The same is true of most contract-based serializers (DataContractSerializer, protobuf-net, etc).

    Basically: don’t do that. object is not a useful thing to use on a web-service, and that cannot work.

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

Sidebar

Related Questions

I have a WebService that returns XML in a SOAP response: <?xml version=1.0 encoding=utf-8
I have a webservice that returns a list of Clinics near a certain lat/long.
I have a webservice method that reads a photo and returns its byte data.
So I have made a webservice that interfaces with a set of data contained
I have this 'web service' I made that when accessed: http://192.168.0.1/api/v1/search/?query=thequery returns a JSON
I have some sample webservice like below, <WebMethod()> _ Public Function ExecuteCMD() As Boolean
I have a webservice that when called without specifying a callback will return a
I have a webservice that exists in an asp.net website. When I publish the
I have a webservice that is called by up to 10 clients. The webservice
We have developed a webservice that sits and runs in the context of a

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.