473,396 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

"cannot serialize interface" error in web service, help please

My web service has a webmethod whose return type is declared as an
interface type, for example:

[WebMethod()]
public IBusinessProcess GetBusinessProcess() {}

which generates the lovely error:

Cannot serialize interface IBusinessProcess

The returned object (which implements IBusinessProcess), however, is
marked Serializable; but I gather that doesn't matter and that this is
some limitation in web services (because of marshalling)?

Please let me know what's up here. Thanks in advance.

-NS
Nov 15 '05 #1
1 13610
Hi,

I don't think that you can serialize an interface. Here are some ideas for solving it:
1. Replace the interface with a base class. Obviously, this won't work if you need to inherit from other classes.
2. I have no idea if this will work, but:
Have the webmethod return an object (that implements your interface).
Make sure that the client app has a reference to the same interface. You probably need to have the interface in a separate dll that
both client and server has access to.
In the client, just cast the returned object to your interface.

--
Robert Jeppesen
robert.jeppesen%at%durius-dot-se
"n_o_s_p_a__m" <n_**********@mail.com> wrote in message news:1f**************************@posting.google.c om...
My web service has a webmethod whose return type is declared as an
interface type, for example:

[WebMethod()]
public IBusinessProcess GetBusinessProcess() {}

which generates the lovely error:

Cannot serialize interface IBusinessProcess

The returned object (which implements IBusinessProcess), however, is
marked Serializable; but I gather that doesn't matter and that this is
some limitation in web services (because of marshalling)?

Please let me know what's up here. Thanks in advance.

-NS

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chris | last post by:
I built small C# Web and Web Service applications in a training class last week. The applications worked in the class, but when I tried to run them again over the weekend, they both bombed....
1
by: Mary Kerrigan | last post by:
I'm tearing out my freakin' hair on this one. Trying to deploy an ASP.NET site on a Windows 2000 Advanced Server. The framework v1.0.3705 was already installed, not by me. When I tried to get to...
0
by: Abhi | last post by:
The applicaiton through which the service is created, doesnt give that error. To check the exact issue, I tested with a service containing this block of code. The service gives the error when...
0
by: dejanvesic | last post by:
Hello. Windows service is in question, Framework 2.0, operating system is Windows XP Prof. Windows service is accessing file taking turns with ASP.NET application. For synhronisation of...
4
by: ~~~ .NET Ed ~~~ | last post by:
I am facing a problem. My project is composed of several assemblies. In one of them -the backend- I have several internal classes that must implement an interface. These internal classes are only...
0
by: jonny | last post by:
The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. ...
6
by: Dave | last post by:
I really don't like the users getting an unhandled expception page, and I'm still to new with ASP.Net and C#. So please accept my appology for the 2 part question. SqlException (0x80131904) ...
2
by: =?Utf-8?B?QnJlbnQgUm9nZXJz?= | last post by:
I have a asp page that does a Respnse.Redirect() and sometimes I keep getting a "Cannot find server or DNS Error" . I have validated that the URL being redirected to is valid. The URL...
3
scubak1w1
by: scubak1w1 | last post by:
Hello, Did a search here, manuals and Googled, etc generally, so apologies if I did not find the answer to my issue - that is, I try and 'self help' as mush as I can... I adjusted my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.