473,320 Members | 1,952 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,320 software developers and data experts.

webservice

Hi

I have an existing code-base with some functions which are used by a web
application (aspx and ascx).

Now I want to add a web-service front to these functions, so they are
available via webservice calls.

The problem I am running into is that the functions in the existing
codebase have return values which are interfaces, and when I try to consume
the webservice I get exceptions like: Cannot serialize interface
Alpha.Access.IAnnounce".

How do I work around this? Do I need to provide my own concrete
implementations of all the various interfaces used by the various
functions, and return/convert them via my webservice? This could be very
tedious and difficult in light of that many of these interfaces in turn
contain methods with other interfaces...
Thanks,
Peter
May 24 '07 #1
2 1180
Hi,

take a look at System.Xml.Serialization.XmlIncludeAttribute.

Using this you only have to refactor your interfaces to abstract
classes (interfaces are not serializable).

Example:

You have an interface IInterface with implementaions ImplA and ImplB.

After refactoring you hav an abstract class AbstractClass with derived
classes ImplA and ImplB.

For the AbstractClass class apply the XmlIncludeAttribute as follows:

[XmlInclude(typeof(ImplA)), XmlInclude(typeof(ImplB))]
public abstract class AbstractClass {...}

May 24 '07 #2
Roman Wagner <ro**********@gmail.comwrote in
news:11**********************@q75g2000hsh.googlegr oups.com:
take a look at System.Xml.Serialization.XmlIncludeAttribute.

Using this you only have to refactor your interfaces to abstract
classes (interfaces are not serializable).

Example:

You have an interface IInterface with implementaions ImplA and ImplB.

After refactoring you hav an abstract class AbstractClass with derived
classes ImplA and ImplB.

For the AbstractClass class apply the XmlIncludeAttribute as follows:

[XmlInclude(typeof(ImplA)), XmlInclude(typeof(ImplB))]
public abstract class AbstractClass {...}
Thanks for the pointers. Unfortunately as this requires changes to the
existing code-base it is not possible for me. I may not change this, only
add a new "front" to the functionality (that is, a webservice).

Thanks,
Peter
May 24 '07 #3

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

Similar topics

8
by: DraguVaso | last post by:
Hi, I'm new to WebServices, and I'm doing some tests (with a small VB.NET-application) to know the performance-difference between a WebService and the 'normal'-way of getting data (just...
6
by: Davie | last post by:
I want to authorise a user of a web service by using the AuthHeaderValue for some reason I keep getting a null reference exception when I try to run the following code: It seems to work fine on a...
1
by: Nalaka | last post by:
Hi, I am testing with Visual studio 2005, web projects. Situation: I have one solution with two web projects, created as file system projects. (I am tesing using the built in server, not IIS)...
2
by: Miguel | last post by:
Hi, I'm developing an application in C# with Windows Forms for my company that is similar to the MSN Messenger. This application uses a webservice for registering users, etc... and as 2...
7
by: Alessandro Benedetti | last post by:
Hi. I'm calling two methods of a .NET Webservice (A) from another Webservice (B). The A Webservice is made like this: public class WSA: System.Web.Services.WebService { private int X = 0;
7
by: Nalaka | last post by:
Hi, I created a sinple web service that returns a dataSet. Then I created a client program that uses this web service (that returns the Dataset). My question is, how did the client figure...
5
by: AliR | last post by:
Hi Everyone, I have a Visual C++ MFC program, and I am trying to use a webservice written in C#. When I add the webservice to my project using Add Web Reference the sproxy compiler complains...
5
by: | last post by:
Hi, How long do webservice objects live for? In particular, if i have static variables filled with data from a static constructor in a webservice, how long will that data persist? thxs
0
by: =?Utf-8?B?TWFuaQ==?= | last post by:
Hi All, Problem in deploying my WebService developed using Asp.net WebServices 2005. I have designed simple WebService using Asp.net Webservices 2.0 , The webservice look this , using System;...
4
by: =?Utf-8?B?QmlsbEF0V29yaw==?= | last post by:
Hi, We recently converted a 1.1 project to 2.0 and this included a webservice which accepted XML for one of the parameters. Since converting to 2.0 I am getting the following message: --- A...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.