471,317 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

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
0 995

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Fabio Papa | last post: by
3 posts views Thread by David Evans | last post: by
reply views Thread by PL | last post: by
reply views Thread by Mel | last post: by
3 posts views Thread by Kris van der Mast | last post: by
5 posts views Thread by Segfahlt | last post: by
3 posts views Thread by William LaMartin | last post: by
4 posts views Thread by John Wilmot | last post: by

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.