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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:43:27+00:00 2026-05-14T04:43:27+00:00

I have a .NET web service (using asmx…have not upgraded to WCF yet) that

  • 0

I have a .NET web service (using asmx…have not upgraded to WCF yet) that exposes the following:

public class WidgetVersion1 : IWidget {}
public class WidgetVersion2 : IWidget {}

When I attempt to bind to the web service, I get the following serialization error:

Cannot serialize member WidgetVersion1 of type IWidget because it is an interface.

I have tried adding various attributes to the IWidget interface (XmlIgnore, SoapIgnore, NonSerialized), but they are not valid on an interface.

Does anyone know why I am unable to expose the interface? I assume WSDL does not support interfaces, but couldn’t .NET get around this by simply not serializing the interface? Are there any ways around this apart from removing the IWidget interface from the WidgetVersion1 and WidgetVersion2 class definitions?

  • 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-14T04:43:27+00:00Added an answer on May 14, 2026 at 4:43 am

    WCF can’t serialize an interface either; in fact, it’s impossible to serialize an interface over SOAP.

    The reason (simplified) is that, when deserializing, .NET has to be able to create some actual concrete class. An interface is an abstract concept; there always has to be a “real” class implementation behind it in order for an actual instance to exist.

    Since you can’t construct a physical instance of an interface, it also can’t be serialized.

    If you’re trying to use the XmlIgnoreAttribute, understand that applying it to the type won’t accomplish anything. It needs to be applied to the member instead. In other words:

    public class SerializableClass
    {
        [XmlElement]
        public int ID { get; set; }
    
        [XmlElement]
        public string Name { get; set; }
    
        [XmlIgnore]
        public IMyInterface Intf { get; set; }
    }
    

    …will serialize OK, because the serializer won’t try to serialize the Intf property. You just can’t add the [XmlIgnore] attribute to the IMyInterface type definition (it won’t compile).

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

Sidebar

Related Questions

I have a .NET web-service client that has been autogenerated from a wsdl-file using
I have an ASP.net web service that I'm using for a web application which
I am trying to hit the following web service with axis2: http://www.webservicex.net/geoipservice.asmx?WSDL I have
We have an ASMX web service which we invoke from our ASP.NET application using
I have a .net web-service hosted in IIS 6.0 that periodically fails with an
I have a .NET Web Service running in VS2005 and a client that consumes
i have an ASP.NET web service that returning a custom entity object (Staff): [WebMethod]
Using Visual Studio 2008 and VB.Net: I have a working web app that uses
I have the following web service method (.ASMX file): [WebMethod(EnableSession = true)] [ScriptMethod(ResponseFormat =
I'm building a traditional ASP.NET Web Service -- the style built using asmx. It's

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.