473,383 Members | 1,748 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.

Web reference can't read base class from class library in web service

Hi

I have a web service with a reference to a class library with 2 classes;

User: The base class
Client: Inherits from User

There are also some functions which return an object of type client.

When I test the web service in a browser it all works fine but when I try and add the web service as a web reference called MercuryWeb to a windows form application I get the following error message.

error C2504: 'MercuryWeb::User' : base class undefined

Fairly new to c++ and c# programming so have absolutely no idea why this is happening if the class is defined in the class library.

Any help would be greatly appreciated.
Cheers!
Jun 21 '07 #1
4 2031
weaknessforcats
9,208 Expert Mod 8TB
error C2504: 'MercuryWeb::User' : base class undefined
I would need to see your class definition and the line of code that produces this error.

On the surface, it appears you are deriving MercuryWeb from User but in that there is no definition of User. Maybe you need a #include for the file that defines User??
Jun 21 '07 #2
User Class

using System;
using System.Collections.Generic;
using System.Text;

namespace UserClassesC
{
public class User
{
private UInt32 id;
private string name;
private string username;
private string password;
//private string categories;
private string testString;

public User()
{
//
// TODO: Add constructor logic here
//
}

public UInt32 ID
{
get
{
return this.id;
}
set
{
this.id = value;
}
}
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}

public string TestString
{
get
{
return this.testString;
}
set
{
this.testString = value;
}
}
public string Username
{
get
{
return this.username;
}
set
{
this.username = value;
}
}
public string Password
{
get
{
return this.password;
}
set
{
this.password = value;
}
}

}

}

Client Class

using System;
using System.Collections.Generic;
using System.Text;

namespace UserClassesC
{
public class Client : User
{
private System.Collections.ArrayList clientCategories;

public Client()
{

clientCategories = new System.Collections.ArrayList();

}

public System.Collections.ArrayList ClientCategories
{
get
{
return this.clientCategories;
}
set
{
this.clientCategories = value;
}
}
}
}

There is no function as such that produces the error, it happens when I try and add it as a web reference to a windows form app, when it tries to build the header file. The classes are defined in a class library which I've compiled to a dll file and added a reference to in the website project, would I still need to include the file as well?
Jun 21 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
This is C#. I am moving this to the .NET forum.
Jun 21 '07 #4
whoops, yeah sorry. My windows form is in c++, but the web service was started by one of my colleagues and he did it in c#.
Jun 22 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Moes | last post by:
struct Base{ }; struct Derived: public Base{ }; void f( Base *pBase ) { Derived *pDerived = (Derived*)pBase; }
1
by: Mercede | last post by:
Hi, I've a certain problem. I've created a Class Library project that contains the following - A Factory Class - A base Object A factory can create the Base objects or objects derived from...
9
by: Dennis | last post by:
When a class (myownclass) inheirits another class, how can I get an object reference to the underlyng MyBase class instance from within myownclass. The base class has a method that I want to...
0
by: Richard Gregory | last post by:
Hi, I have the wsdl below, for an Axis web service, and when I select Add Web Refernce in Visual Studio the proxy is missing a class representing the returnedElementsType (see reference.cs below...
1
by: Caine Chow | last post by:
I am working on a C# Class Library that does Remoting. I would like my library to call my web service so I added a Web reference to my service with out problems. I am encountering problems when...
0
by: russell.lane | last post by:
I have a web service that exposes database contents as disconnected datasets. I would to use that web service from within a class library. I have included a web reference to the service in my...
2
by: Paul | last post by:
I have a class that references/consumes a webservice, and I would like to split that class into a base class to be used as a based for classes in each of two class libraries/DLLs. I have...
8
by: Frank Hauptlorenz | last post by:
Hello out there, I changed an existing and good working webservice from an wsHttpBinding to an NetTcpBinding. This is working (after trying some time) and has real a better performance! But...
0
by: =?ISO-8859-1?Q?Jan_Thom=E4?= | last post by:
Hi, I've been trying like a madman to make my WSDL work with .net, but it seems I am out of luck. Whenever I add a service reference to Visual C#, the code gets generated fine, however all...
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
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.