473,383 Members | 1,832 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,383 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 2757
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...
1
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
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.