473,804 Members | 3,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

abstract class overriding?

drb
Hi,

I'm hoping this is a stupid question, so I apologize in advance.

After creating WSDL files from scratch for a new web service, I used the
WSDL.exe tool to generate C# stubs for both the web service server methods
and the client proxy methods. The tool created the server methods as
abstract member methods of an abstract class that derived from
System.Web.Serv ices.WebService . I *thought* what I needed to do was create
another class that derived from this class, so I did, and
implemented/overrode the methods in the derived class. And everything built
in VS.NET successfully.

I then created a test client console app using the client proxy methods, and
tried to call the web service. But the call failed with the error:

An unhandled exception of type 'System.Web.Ser vices.Protocols .SoapException'
occurred in system.web.serv ices.dll
Additional information: Server was unable to process request. --> Cannot
create an abstract class.

From the error it looks like the web service was found OK, but something in
the web service (or the service itself?) couldn't be instantiated? If I run
the service in the VS.NET debugger I get an IE page displaying the service
methods/messages successfully, so I thought everything was being instantiated
properly. I tried explicitly adding all the various web service attributes
that the WSDL.exe tool placed on the abstract class definition/methods to the
derived class as well, but that didn't seem to work.

I *think* I'm missing something obvious, but don't know where to look, so I
came to the land of experts. If I can provide any more information let me
know. Thanks a lot!
Nov 23 '05 #1
4 5302
I guess you are using the /server option when you are creating your proxy
class. It will create an abstract class. If you exclude it, you will get a
concrete class.

wsdl http://myhost/mywebservice.asmx?wsdl
--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"drb" <dr*@discussion s.microsoft.com > wrote in message
news:02******** *************** ***********@mic rosoft.com...
Hi,

I'm hoping this is a stupid question, so I apologize in advance.

After creating WSDL files from scratch for a new web service, I used the
WSDL.exe tool to generate C# stubs for both the web service server methods
and the client proxy methods. The tool created the server methods as
abstract member methods of an abstract class that derived from
System.Web.Serv ices.WebService . I *thought* what I needed to do was create another class that derived from this class, so I did, and
implemented/overrode the methods in the derived class. And everything built in VS.NET successfully.

I then created a test client console app using the client proxy methods, and tried to call the web service. But the call failed with the error:

An unhandled exception of type 'System.Web.Ser vices.Protocols .SoapException' occurred in system.web.serv ices.dll
Additional information: Server was unable to process request. --> Cannot
create an abstract class.

From the error it looks like the web service was found OK, but something in the web service (or the service itself?) couldn't be instantiated? If I run the service in the VS.NET debugger I get an IE page displaying the service
methods/messages successfully, so I thought everything was being instantiated properly. I tried explicitly adding all the various web service attributes that the WSDL.exe tool placed on the abstract class definition/methods to the derived class as well, but that didn't seem to work.

I *think* I'm missing something obvious, but don't know where to look, so I came to the land of experts. If I can provide any more information let me
know. Thanks a lot!

Nov 23 '05 #2
drb
Hi Manohar,

Thanks for your reply. Yes, I did use the "/server" switch because I
thought that's what I was supposed to do to generate the server stubs. When
I saw that the tool generated an abstract class and methods, and saw the
comments in the file warning not to modify the file, it seemed to make sense.
I would override the class/methods in a separate file in the VS.NET project,
and then "somehow" .NET would hook my method overrides into the service at
runtime. When it built successfully I thought I was on the right path.

So there's really no way to use/override the abstract class generated for
the server side when using the "/server" switch? I can't believe the tool
would produce something unusable. Is the abstract class just supposed to be
some sort of "guide"? This problem seems so basic that I thought surely
someone must have hit this problem (and hopefully solved it) before.

Anyway, thanks again - I do appreciate the help so far.

Dave

"Manohar Kamath" wrote:
I guess you are using the /server option when you are creating your proxy
class. It will create an abstract class. If you exclude it, you will get a
concrete class.

wsdl http://myhost/mywebservice.asmx?wsdl
--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com

Nov 23 '05 #3
drb
I finally found this. The posted text is about 3/4 of the way through the
article.

---------------------------------------

http://msdn.microsoft.com/msdnmag/is...2/09/XMLFiles/

"When you derive your new class, make sure that you copy all of the
customization attributes from the generated class to the derived class
(including those on each method). The customization attributes are not
inherited by design. Overlooking this step will break the WSDL contract that
you started with. Then to finish off the implementation, you simply need to
create an .asmx file with a single ASP.NET directive referencing your new
class, like so:

<%@ WebService language="C#" class="Geometry ServiceImpl" %>

---------------------------------------

This was exactly what I had been hoping to find. I tried it and it worked.
Hope this helps someone else who's trying to start from scratch with WSDL and
generate the interface for both sides of the wire.
Nov 23 '05 #4
Dave,

From my previous post -- do not use the /server option when using wsdl. The
generated class will be a concrete class that you could use as-is.

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"drb" <dr*@discussion s.microsoft.com > wrote in message
news:1A******** *************** ***********@mic rosoft.com...
Hi Manohar,

Thanks for your reply. Yes, I did use the "/server" switch because I
thought that's what I was supposed to do to generate the server stubs. When I saw that the tool generated an abstract class and methods, and saw the
comments in the file warning not to modify the file, it seemed to make sense. I would override the class/methods in a separate file in the VS.NET project, and then "somehow" .NET would hook my method overrides into the service at
runtime. When it built successfully I thought I was on the right path.

So there's really no way to use/override the abstract class generated for
the server side when using the "/server" switch? I can't believe the tool
would produce something unusable. Is the abstract class just supposed to be some sort of "guide"? This problem seems so basic that I thought surely
someone must have hit this problem (and hopefully solved it) before.

Anyway, thanks again - I do appreciate the help so far.

Dave

"Manohar Kamath" wrote:
I guess you are using the /server option when you are creating your proxy class. It will create an abstract class. If you exclude it, you will get a concrete class.

wsdl http://myhost/mywebservice.asmx?wsdl
--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com

Nov 23 '05 #5

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

Similar topics

3
4308
by: Magne Ryholt | last post by:
I have a base class and a chain of derived classes. The base and its derived classes are all abstract except the last in chain (a concrete class). I want to provide some functionalities in the base class by defining a member as e.g. "protected virtual MyReturnClass MyMethod(){...}" The base classes, including the last (concrete class) adds on this functionality by defining members as e.g. "protected override MyReturnClass MyMethod(){......
6
5806
by: Dan Sikorsky | last post by:
If we were to define all abstract methods in an abstract class, thereby making that class non-abstract, and then override the heretofore 'abstract' methods in a derived class, wouldn't that remove the need to have abstract class types in C#? Derived classes from abstract base classes must overrided the abstract method defininition anyway, so why not just provide a complete definition for the abstract method when defining the containing...
2
1134
by: 0to60 | last post by:
I have a base class that defines a property. I'd like the the Get to be implemented by the base class and not overrideable. I would like the Set to be marked abstract, and thus needs to be filled in by overriding classes. Is this possible? What's the syntax?
5
1843
by: Tony Johansson | last post by:
Hello!! Assume you have an Interface called ITest with these three method declarations. interface ITest { void foo1(); void foo2(); void foo3(); }
3
38810
by: chandu | last post by:
hello, what is the difference to use the keyword virtual,abstract when we are overriding the methods.instead of abstract shall we use virtual everywhere when we need to override? i am little confusing to use these keywords. thaks..
7
4477
by: jason | last post by:
In the microsoft starter kit Time Tracker application, the data access layer code consist of three cs files. DataAccessHelper.cs DataAcess.cs SQLDataAccessLayer.cs DataAcccessHelper appears to be checking that the correct data type is used DataAcess sets an abstract class and methods
52
20916
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member 'UselessJunkForDissassembly.IInvocableInternals.OperationValidate(string)' C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
5
2233
by: Tony Johansson | last post by:
Hello! Here I have an Interface called ITest and a class called MyClass which derive this intrface. As you can see I don't implement this method myTest in class MyClass because i use the keyword abstract. I have also another class called MyDerivedClass which is a sublass to MyClass. Now to my question when I implement this method myTest in class
21
3953
by: Mr.SpOOn | last post by:
Hi, I'm going to work on a project to represent some musical theory in Python, in an object oriented way. I have to manage many elements of music such as notes, intervals, scales, chords and so on. All these elements share properties and behavior, so what I want to do is an abstract class "Note" and other subclasses, for example "NaturalNote", "FlatNote", "SharpNote" etc. The idea is not original, I read it in some papers where they...
0
9708
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10324
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.