Microsoft
Software
Hardware
Network
Question : ASP.NET SOAP Server/Client with Complex Types
Trying to build a SOAP web service using complex types and hit a road block. I am using VS to create a web reference to the SOAP service. ASP.NET 2.0, C#.
Getting the following error on the client:
System.NullReferenceExcept
ion: Object reference not set to an instance of an object.
On the line setting the name on the SOAP client below, info.Organization.Name = "Test Org";
Here is what I have so far:
SOAP Web Service
[WebMethod]
public string CoverageRequest(RequestorI
nformation
info)
{
return info.Organization.Name;
}
public class RequestorInformation
{
public Organization Organization;
}
public class Organization
{
public Organization() {}
private string _Name;
public string Name
{
get { return _Name; }
set { _Name = value; }
}
}
SOAP Client
VerifyInsurance.RequestorI
nformation
info = new VerifyInsurance.RequestorI
nformation
();
info.Organization.Name = "Test Org";
VerifyInsurance verify = new VerifyInsurance();
verify.CoverageRequest(inf
o);
Answer : ASP.NET SOAP Server/Client with Complex Types
Organization is a class and it is not instantiated. Try:
VerifyInsurance.RequestorI
nformation
info = new VerifyInsurance.RequestorI
nformation
();
info.Organization = new Organization();
info.Organization.Name = "Test Org";
Random Solutions
How to start week on Monday using Lebans MonthCalendar?
Using SQL to find non-duplicate data.
How to automate the retrieval of data from Access when database name is changing twice a month
searching a database from a form
Exchange Store Error caused by AVG upgrade
Opening a form with a subform produces error:
SQL Command in Crystal Reports
"Email" icon in word 2003 grayed out and I do have an email account set up through Outlook.
Combo Box display text vs. actual text
Upgrade to Server 2008 Enterprise Error "Not enough free space for temporary files", even with plenty of space.