Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 7th, 2007, 04:30 AM
Registered User
Join Date: Jul 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Object reference not set - WebReference WS

Hi There,
Here's some puzzling one...
I've added a web reference to my project and now i cant't get it instantiated, i always get

'Object reference not set to an instance of an object.' exception.

Here's C# code:

1: OTA_AirAvailRQ OTA_AirAvailRQ_Document = new OTA_AirAvailRQ();
2: OTA_AirAvailRQ_Document.POS.Source[0].PseudoCityCode = "LAS1S210D";

I get the exception on line 2, intellisene displays everthing ok, and it compiles fine, but at runtime it blows.

Any ideas, is it something that i'm forgetting of ?
Thanks a lot.

Old July 9th, 2007, 07:47 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Something doesn't look right with your syntax:

What is the POS property of the ORA_AirAvailRQ class?

Is ORA_AirAvailRQ the web proxy class? I don't see any method calls on that. Generally, you should be making a method call and then work with what is returned.

Old August 1st, 2007, 06:23 AM
Registered User
Join Date: Aug 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts


There is a high probability that the source of the error is coming from you array element Source[0] not having been initialized to any object.

Check that the array contains something


Similar Threads
Thread Thread Starter Forum Replies Last Post
object reference not set to instant of an object shahidrasul ASP.NET 2.0 Basics 1 September 5th, 2008 02:01 PM
Object reference not set flashmanTom BOOK: Beginning VB.NET Databases 1 February 19th, 2008 06:29 AM
Object Reference not set to an instance of object srinivas_chakka ASP.NET 1.0 and 1.1 Professional 0 February 8th, 2006 11:56 AM
Object reference not set to an instance... steelman BOOK: ASP.NET Website Programming Problem-Design-Solution 6 May 7th, 2004 02:03 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.