Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2005

Tip: Looking for answers? Try searching our database.

"Object reference not set to an instance of an object." after constructor fires

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vern DeHaven <vernet.dehaven uc [.] edu> - 21 Mar 2005 17:45 GMT
Hello all,

Working on a W2K3 box with Framework version 1.1.4322 here.  I've  
implemented a Web service in VB.NET by generating a server skeleton off  
the WSDL and overriding the abstract class.  This Web service operates  
correctly.  To conform to standards set by our group recently, I reworked  
the WSDL to reflect namespace changes and reimplemented the service in  
both VB.NET and C# (as neither work now).  When compared, the only  
syntactic differences between the original and new VB.NET services are  
namespace declarations.  The other change was the last offered update to  
my Framework for W2K3 SP1.  In both the new services, I get the subject  
error after the constructor successfully fires.  No error shows in the  
Debug window; I get exit codes of 0.

The original service still operates correctly after the Framework update.  
In all three services (working and broken), the last line added to the  
Debug window before I stop execution is the loading of a referenced  
assembly not part of the Framework.

I deployed the broken C# version to a Windows 2000 Server SP4 box with  
Framework version 1.1.4322 with the same result.

Anyone had similar issues?

Thanks,
Vern DeHaven
Vern DeHaven - 23 Mar 2005 19:12 GMT
Found the issue.  I had left out one very important detail: one of our new  
standards is to specify names of elements in Pascal case (e.g.  
ElementName).  The old, working service had element names in camel case  
(e.g. elementName).  The wsdl.exe tool names parameters exactly the same  
as their types in the generated abstract class, for example:

public abstract ReceiveBuffer  
modify([System.Xml.Serialization.XmlElementAttribute(Namespace="http://myuri.com/mod")]  
SendBuffer SendBuffer);

The mistake I made was that I had camel-cased the parameter name to  
distinguish it as such:

public abstract ReceiveBuffer  
modify([System.Xml.Serialization.XmlElementAttribute(Namespace="http://myuri.com/mod")]  
SendBuffer sendBuffer);

I did this without adding the ElementName property to the  
XmlElementAttribute to correct the serialization.  Here's how it should  
read:

public abstract ReceiveBuffer  
modify([System.Xml.Serialization.XmlElementAttribute(Namespace="http://myuri.com/mod",  
ElementName="SendBuffer")] SendBuffer sendBuffer);

Sorry about this post.

Vern

On Mon, 21 Mar 2005 11:45:21 -0500, Vern DeHaven <vernet.dehaven uc [.]  
edu> <[@]> wrote:

> Hello all,
>
[quoted text clipped - 22 lines]
> Thanks,
> Vern DeHaven

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.