Webservice : Unable to serialize the interface

Posted on 2005-03-16
Medium Priority
Last Modified: 2012-05-05
Hi Experts,

I have a project with contains my interface ( ITest ).

public interface ITest
void myfunction(string data);            

In my webservices project (second one), I build the service1.asmx like this:

public string HelloWorld(ITest test)
      return "Hello World";

When I add a webreference to my last project to test my webservice service1.asmx, Visual Studio throw me the exception:
Unable to serialize the interface.

Thanks in advance for helping me to solve my problem.
Question by:noulouk
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 17

Accepted Solution

Jesse Houwing earned 1600 total points
ID: 13559435
Interfaces cannot be passed as webmethod parameters, nor can they be returned.

You'll need to write a real object and pass that instead. This has to do with the fact that although all methods of an interface are known, it cannot be properly deserialized back into an object as there is no explicit knowledge of the underlying type.
LVL 10

Assisted Solution

jonvaughan earned 400 total points
ID: 13560219
In addition to this you have to make sure that the object you do choose is serializable too .
LVL 17

Expert Comment

by:Jesse Houwing
ID: 13560265
ofcourse ;)

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question