473,326 Members | 2,805 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,326 software developers and data experts.

How to make a Web service implement an interface

sys
I have a Web service and I want it to implement an interface that I specified, say IService. So my Web service class looks like this

public class Service1 : System.Web.Services.WebService, IServic

public Service1(

InitializeComponent()
[WebMethod
...
On the client-side I want to use this Web service using my Interface

IService service = new WebService.Service1()

Unfortunately the last code line doesn't work because I get an error message saying that the conversion from WebService.Service1 to IService is not possible. Also an explicit type cast isn't possible
I think the problem is that my automatically generated proxy class for my Web service doesn't implement the interface IService. Do I have to make my proxy class implement the interface? And if yes how (doing it manually works, but my changes are lost the next time I refresh the reference)? Or is there another solution for my problem?
Nov 22 '05 #1
2 2754
I don't think what you're tyring is possible. The attribute [WebMethod]
defines your external method but thats it, it doesn't define classes or
interfaces. If you want to use an interface on your client, create a wrapper
class around the web service class and impliment your interface there.

-p

"sys" <an*******@discussions.microsoft.com> wrote in message
news:9C**********************************@microsof t.com...
I have a Web service and I want it to implement an interface that I specified, say IService. So my Web service class looks like this:
public class Service1 : System.Web.Services.WebService, IService
{
public Service1()
{
InitializeComponent();
}

[WebMethod]
....
}

On the client-side I want to use this Web service using my Interface:

IService service = new WebService.Service1();

Unfortunately the last code line doesn't work because I get an error message saying that the conversion from WebService.Service1 to IService is
not possible. Also an explicit type cast isn't possible. I think the problem is that my automatically generated proxy class for my

Web service doesn't implement the interface IService. Do I have to make my
proxy class implement the interface? And if yes how (doing it manually
works, but my changes are lost the next time I refresh the reference)? Or is
there another solution for my problem?
Nov 22 '05 #2
I don't think what you're tyring is possible. The attribute [WebMethod]
defines your external method but thats it, it doesn't define classes or
interfaces. If you want to use an interface on your client, create a wrapper
class around the web service class and impliment your interface there.

-p

"sys" <an*******@discussions.microsoft.com> wrote in message
news:9C**********************************@microsof t.com...
I have a Web service and I want it to implement an interface that I specified, say IService. So my Web service class looks like this:
public class Service1 : System.Web.Services.WebService, IService
{
public Service1()
{
InitializeComponent();
}

[WebMethod]
....
}

On the client-side I want to use this Web service using my Interface:

IService service = new WebService.Service1();

Unfortunately the last code line doesn't work because I get an error message saying that the conversion from WebService.Service1 to IService is
not possible. Also an explicit type cast isn't possible. I think the problem is that my automatically generated proxy class for my

Web service doesn't implement the interface IService. Do I have to make my
proxy class implement the interface? And if yes how (doing it manually
works, but my changes are lost the next time I refresh the reference)? Or is
there another solution for my problem?
Nov 22 '05 #3

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

Similar topics

2
by: sys | last post by:
I have a Web service and I want it to implement an interface that I specified, say IService. So my Web service class looks like this public class Service1 : System.Web.Services.WebService, IServic...
1
by: Larry Page | last post by:
Greetings, I'm using remoting to execute commands on a remote machine. My original testing used basic console client and server apps containing a common interface, which I built as a seperate...
2
by: Yi | last post by:
Hi, I am implementing a scheduler that will fire a command every 15 or 30 minutes. I would like to use web service interface to control the timer (start, stop, etc). I think a workable solution is...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
3
by: Rob R. Ainscough | last post by:
I have a Windows Service with a timer that use the .NET 2.0 Shell command. The Shell command returns a non-zero number but Task Manager shows the shelled exe running but there is NO visible...
6
by: dotNeter | last post by:
The services, talked here, are things used in IServiceContainer, IServiceProvider, etc. In my opinion, everything can be a service, and a service is generally used for providing specific features...
8
by: semedao | last post by:
Hi , I need to develop some feature of web service that can notify client - "Push" operation - and fast somebody know if it's possible , and how? When I say "Push" I mean - pure push :) , not...
0
by: =?Utf-8?B?RGlvZ28gQWx2ZXM=?= | last post by:
Greeting Nicholas, Thanks for your answer but I'm pretty new in this stuff.... I already have a class that inherits the MArshalByRefObject and I use it to get answers from the server like...
0
by: archana | last post by:
Hi all, I want to developed plug-in architecture in windows service. What i want is to develop one windows service which will monitor some folders and as soon as it gets any file on folder it...
0
by: ahk3wl | last post by:
Hi all, I am consuming two web services that are identical but on different servers. The WSDL is the same except for URL and namespace. Normally I could just add a web reference and swap URL at...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.