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

overloading default constructor in web services

I have an ASP.Net web service class, DataLayer.asmx.cs. I have two
constructors for the DataLayer class. One is the default parameter-less one
and the second one accepts a string argument. When I am trying to consume
this web service from another asp.net application, only the default
parameter-less constructor shows up. And if i try creating an instance of the
second constructor, it gives me a compiler error saying that No overload of
DataLayer() takes 1 argument. I checked the proxy class Reference.cs in my
client application and I couldn't find the overloaded constructor. Is it that
web services do not support overloaded constructors? Am i missing something?
Nov 23 '05 #1
4 12623
Hello indigator,
What you see in the Reference.cs is a proxy and not the service itself.
The proxy itself has no knowledge of the implementation of the service. It
just knows any methods that are exposed by the service based on whats defined
on the wsdl. Possibly what you need in the constructor could be passed as
a parameter to the webservice.. or configured in the web.config that the
service can lookup

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
I have an ASP.Net web service class, DataLayer.asmx.cs. I have two
constructors for the DataLayer class. One is the default
parameter-less one and the second one accepts a string argument. When
I am trying to consume this web service from another asp.net
application, only the default parameter-less constructor shows up. And
if i try creating an instance of the second constructor, it gives me a
compiler error saying that No overload of DataLayer() takes 1
argument. I checked the proxy class Reference.cs in my client
application and I couldn't find the overloaded constructor. Is it that
web services do not support overloaded constructors? Am i missing
something?

Nov 23 '05 #2
Hey Dilip,

Thanks for the reply. So does this mean Webservices do not support
Overloaded constructors? I am trying to pass some information as a parameter
to the constructor, so that the webservice can initialize the fields once the
instance is created. To be more precise, I am trying to create a datalayer
using webservices. So i need to pass the connection string as a parameter to
the webservice class. Currently, when i try to create an instance of the
webservice class from an asp.net application, it shows only the default
parameter-less constructor, even though I have specified 2 constructors. If I
ignore this and try to create an instance using the 2nd constructor(with
parameter), it gives me a compilation error saying that "No overload for
method 'MethodName' takes '1' arguments.

I cannot specify this in the web.config file, since everytime, they need to
connect to a new database, the web.config has to be changed. So does this
mean I should have another Web method which will perform the same function
and not use the constructor? I hope I am clear.

Thanks.

"Dilip Krishnan" wrote:
Hello indigator,
What you see in the Reference.cs is a proxy and not the service itself.
The proxy itself has no knowledge of the implementation of the service. It
just knows any methods that are exposed by the service based on whats defined
on the wsdl. Possibly what you need in the constructor could be passed as
a parameter to the webservice.. or configured in the web.config that the
service can lookup

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
I have an ASP.Net web service class, DataLayer.asmx.cs. I have two
constructors for the DataLayer class. One is the default
parameter-less one and the second one accepts a string argument. When
I am trying to consume this web service from another asp.net
application, only the default parameter-less constructor shows up. And
if i try creating an instance of the second constructor, it gives me a
compiler error saying that No overload of DataLayer() takes 1
argument. I checked the proxy class Reference.cs in my client
application and I couldn't find the overloaded constructor. Is it that
web services do not support overloaded constructors? Am i missing
something?


Nov 23 '05 #3
Hello indigator,
Why not just pass in an (encrypted ??) connection string as a parameter
to the web method?

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Hey Dilip,

Thanks for the reply. So does this mean Webservices do not support
Overloaded constructors? I am trying to pass some information as a
parameter to the constructor, so that the webservice can initialize
the fields once the instance is created. To be more precise, I am
trying to create a datalayer using webservices. So i need to pass the
connection string as a parameter to the webservice class. Currently,
when i try to create an instance of the webservice class from an
asp.net application, it shows only the default parameter-less
constructor, even though I have specified 2 constructors. If I ignore
this and try to create an instance using the 2nd constructor(with
parameter), it gives me a compilation error saying that "No overload
for method 'MethodName' takes '1' arguments.

I cannot specify this in the web.config file, since everytime, they
need to connect to a new database, the web.config has to be changed.
So does this mean I should have another Web method which will perform
the same function and not use the constructor? I hope I am clear.

Thanks.

"Dilip Krishnan" wrote:
Hello indigator,
What you see in the Reference.cs is a proxy and not the service
itself.
The proxy itself has no knowledge of the implementation of the
service. It
just knows any methods that are exposed by the service based on whats
defined
on the wsdl. Possibly what you need in the constructor could be
passed as
a parameter to the webservice.. or configured in the web.config that
the
service can lookup
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
I have an ASP.Net web service class, DataLayer.asmx.cs. I have two
constructors for the DataLayer class. One is the default
parameter-less one and the second one accepts a string argument.
When I am trying to consume this web service from another asp.net
application, only the default parameter-less constructor shows up.
And if i try creating an instance of the second constructor, it
gives me a compiler error saying that No overload of DataLayer()
takes 1 argument. I checked the proxy class Reference.cs in my
client application and I couldn't find the overloaded constructor.
Is it that web services do not support overloaded constructors? Am i
missing something?

Nov 23 '05 #4
Hey Dilip,

I guess I will do that. I just preferred passing it as a parameter to the
constructor since I didn't want client applications to call one extra method
to set the connection string. :)

Thanks for your help.
"Dilip Krishnan" wrote:
Hello indigator,
Why not just pass in an (encrypted ??) connection string as a parameter
to the web method?

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Hey Dilip,

Thanks for the reply. So does this mean Webservices do not support
Overloaded constructors? I am trying to pass some information as a
parameter to the constructor, so that the webservice can initialize
the fields once the instance is created. To be more precise, I am
trying to create a datalayer using webservices. So i need to pass the
connection string as a parameter to the webservice class. Currently,
when i try to create an instance of the webservice class from an
asp.net application, it shows only the default parameter-less
constructor, even though I have specified 2 constructors. If I ignore
this and try to create an instance using the 2nd constructor(with
parameter), it gives me a compilation error saying that "No overload
for method 'MethodName' takes '1' arguments.

I cannot specify this in the web.config file, since everytime, they
need to connect to a new database, the web.config has to be changed.
So does this mean I should have another Web method which will perform
the same function and not use the constructor? I hope I am clear.

Thanks.

"Dilip Krishnan" wrote:
Hello indigator,
What you see in the Reference.cs is a proxy and not the service
itself.
The proxy itself has no knowledge of the implementation of the
service. It
just knows any methods that are exposed by the service based on whats
defined
on the wsdl. Possibly what you need in the constructor could be
passed as
a parameter to the webservice.. or configured in the web.config that
the
service can lookup
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
I have an ASP.Net web service class, DataLayer.asmx.cs. I have two
constructors for the DataLayer class. One is the default
parameter-less one and the second one accepts a string argument.
When I am trying to consume this web service from another asp.net
application, only the default parameter-less constructor shows up.
And if i try creating an instance of the second constructor, it
gives me a compiler error saying that No overload of DataLayer()
takes 1 argument. I checked the proxy class Reference.cs in my
client application and I couldn't find the overloaded constructor.
Is it that web services do not support overloaded constructors? Am i
missing something?


Nov 23 '05 #5

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

Similar topics

12
by: Marcelo Pinto | last post by:
Hi all, In practice, what is the diference between a default constructor and an explicit default constructor? class Ai { public: Ai() {} };
18
by: Matt | last post by:
I try to compare the default constructor in Java and C++. In C++, a default constructor has one of the two meansings 1) a constructor has ZERO parameter Student() { //etc... } 2) a...
19
by: Andrew J. Marshall | last post by:
I want to create a class that must receive a parameter when instantiated. In other words, I do not want it to have a "Public Sub New()". 1) Does VB.NET create a default public constructor if I do...
4
by: Rich | last post by:
Public Class clsTest Public Sub New() Console.WriteLine("inside default constructor") End Sub Public Sub clsTest(ByVal s As String) Console.WriteLine(s) End Sub Public Sub clsTest(ByVal s...
12
by: Dave A | last post by:
I have a class that does not have a default constructor. The nature of the class inherently excludes it from having one and to put one in will blatantly misrepresent the object that it is modelling....
7
by: =?Utf-8?B?TWlrZQ==?= | last post by:
I'm building a C# application that uses web services. I have a class with a default constructor, an overloaded constructor, and some web methods. When VS creates the asmx file, it doesn't include...
74
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the...
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: 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
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?
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...
0
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...
0
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...
0
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,...

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.