473,486 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem in debugging a Web Service

I've written a Web Service that has main service class. Let's call the
main class that exposes the service interface as Service1.

So, we have:

public class Service1: System.Web.Services.WebService
{
//code
}
I also have a business object that I am going to name BusinessObject,
for example's sake. This object is built in the service module/dll as a
class like so:
namespace BusinessObjects
{
public class BusinessObject
{

private SomeOtherClass mReferenceTypeMember;
//the field mReferenceTypeMember is exposed through a property
called ReferenceTypeMember
//code
public BusinessObject()
{
//nothing for now
}
}
}

Note that there is only one default ctor for the BusinessObject class
and that doesn't do anything.

I compile. Build a DLL. Then I add a test project to this project. I
add a Web Reference in the Test project to point to the asmx for the
above-mentioned service. The test project and the service are both a
part of the same solution. The test project is created to test the
service.

In the test project I do,

//call the default constructor
TheAliasOfTheWebReference.Service1.BusinessObject bo = new
TheAliasOfTheWebReference.Service1.BusinessObject( );

bo.ReferenceTypeMember.SomeValueTypeMember = "Value";
I get an object not set to an instance exception. Reasonable!
So, I go back to the service asmx.cs file and go straight to the class
BusinessObject and modify the default constructor to do this:
namespace BusinessObjects
{
public class BusinessObject
{

private SomeOtherClass mReferenceTypeMember;
//the field mReferenceTypeMember is exposed through a property
called ReferenceTypeMember
//code
public BusinessObject()
{
this.mRefrenceTypeMember = new SomeOtherClass();
}
}
}

Then, I rebuild the service.
I go to the test project. I delete the old Web Reference. I add a new
Web Reference to the same DLL (I've burnt my fingers there in not
doing that).

I insert a breakpoint at the following line

//call the default constructor
TheAliasOfTheWebReference.Service1.BusinessObject bo = new
TheAliasOfTheWebReference.Service1.BusinessObject( );
in the test project.
I expect it to step through the source code in my service. It doesn't.
And it still throws the object instance set to nothing exception.

What gives?

Feb 10 '06 #1
1 1302
"Sathyaish" <sa*******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I've written a Web Service that has main service class. Let's call the
main class that exposes the service interface as Service1.
.... I insert a breakpoint at the following line

//call the default constructor
TheAliasOfTheWebReference.Service1.BusinessObject bo = new
TheAliasOfTheWebReference.Service1.BusinessObject( );
in the test project.
I expect it to step through the source code in my service. It doesn't.
And it still throws the object instance set to nothing exception.


Hi Sathyaish,
The reason that you have object not set to instance exception is that the
object on the client side does not instantiate the same constructor that you
have defined at the service. The definition of your class goes to the client
only by the means of WSDL description. Hence no methods or code are
delivered to the client side. That makes pretty much sense since the goal of
web services is to provide interoperable way for communication. After all
there is no way to execute C# code on JVM. You need to have common
initialization class available to both projects, if you want to reuse the
code.

Regards,

--
Martin Kulov
http://www.codeattest.com/blogs/martin

MCAD Charter Member
MCSD.NET Early Achiever
MCSD

Feb 14 '06 #2

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

Similar topics

8
2007
by: Fabio Papa | last post by:
I am trying to write a windows service that sends emails to clients at specific times based on information in a sql db. Since this is done for multiple cities, I start a thread for each city and...
3
1834
by: David Evans | last post by:
Hi I have a service created in VS.NET, which I can install and run quite happily. After teh service is running, I can attach and run the debugger. However, if I set a breakpoint in the IDE the...
0
1235
by: PL | last post by:
Since installing Windows 2000 Service Pack 4, I cannot debug ASP.Net projects, starting without debugging works fine. I am the administrator on the machine running IIS and VS.Net Everything...
0
1297
by: Mel | last post by:
I have read the debugging document created by M.K Park (which has been referenced on this newsgroup), but unfortunately, it has not helped with solving my problem. I've spent time on the MS KB and...
3
4835
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be...
5
4060
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
0
1057
by: Innes MacKenzie | last post by:
I have an application (a .NET 2.0 windows service) which launches numerous short-lived processes (also a .NET 2.0 application). Occasionally, one or two of these processes will not run properly but...
3
1702
by: William LaMartin | last post by:
I have had the following happen to me for the third time in several months on my laptop but never on my desktop computer while working with a VB.et project in Visual Studio 2005. I was working...
4
3601
by: John Wilmot | last post by:
I have a service that is set up to use remoting. Is there a way that calls from a web page to this service can be debugged in Visual Studio 2005?
0
1136
by: krystian | last post by:
Hello, I've been following the previous thread "Windows Service Starts and Immediately Stops" and I have a similar problem. I've been trying to get started on a windows service and have...
0
6964
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
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7305
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
5427
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,...
0
3066
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...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.