473,609 Members | 1,851 Online
Bytes | Software Development & Data Engineering Community
+ 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.Serv ices.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 mReferenceTypeM ember;
//the field mReferenceTypeM ember is exposed through a property
called ReferenceTypeMe mber
//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
TheAliasOfTheWe bReference.Serv ice1.BusinessOb ject bo = new
TheAliasOfTheWe bReference.Serv ice1.BusinessOb ject();

bo.ReferenceTyp eMember.SomeVal ueTypeMember = "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 mReferenceTypeM ember;
//the field mReferenceTypeM ember is exposed through a property
called ReferenceTypeMe mber
//code
public BusinessObject( )
{
this.mRefrenceT ypeMember = 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
TheAliasOfTheWe bReference.Serv ice1.BusinessOb ject bo = new
TheAliasOfTheWe bReference.Serv ice1.BusinessOb ject();
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 1306
"Sathyaish" <sa*******@gmai l.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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
TheAliasOfTheWe bReference.Serv ice1.BusinessOb ject bo = new
TheAliasOfTheWe bReference.Serv ice1.BusinessOb ject();
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
2022
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 continue the processing from each thread. My service starts fine (gives me no errors, etc), but it doesn't seem to start the new threads. I am new to windows services, so I don't know if I'm doing something wrong. Should I maybe be doing this...
3
1851
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 break point is (presumably) hit, but after a long pause there is an error that says "Source code cannot be found" I have tried:
0
1246
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 was working fine before installing the service pack.
0
1313
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 searching Google. When I login to our domain and try to use VS.NET, I cannot debug web forms. It appears I don;t have permission to debug on the server. Debugging was working at one time, but it has since stopped working.
3
4861
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 protected by forms authentication. When I create forms authentication at root level it works but when I move my code up to the subfolder I get this error: Server Error in '/TestProjects/FormsAuthenticationTestingArea' Application.
5
4075
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 both projects. Both controls(dlls) have been signed using SN.exe and I've set up the appropriate .Net assembly permissions using those Strong Names The DLL's have been copied to the /bin directory in both web virtual directories.
0
1063
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 instead stay running, 'just sitting there', exhibiting a number of unusual properties: Memory usage about 68K - normal .NET processes take up multi-Megabytes of memory. Process has a single thread in the Wait:Suspended state. The thread's...
3
1727
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 with a Windows project and debugging fine. I only made a few minutes worth of changes (and did nothing to the VS setup as far as I know). Then all of a sudden, when I clicked on Debug | Start Debugging, the project build succeeded, the startup...
4
3608
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
1140
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 followed the following rather well known tutorial (I also make some references to it in this writeup):
0
8139
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
8091
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,...
0
8555
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8232
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
8408
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
4032
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...
0
4098
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2540
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 we have to send another system
0
1403
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.