Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ASP.NET SOAP Server/Client with Complex Types

ASP.NET SOAP Server/Client with Complex Types

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netvisual-studiowcfsysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    captainone
    wrote on last edited by
    #1

    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.NullReferenceException: 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(RequestorInformation 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.RequestorInformation info = new VerifyInsurance.RequestorInformation();
    info.Organization.Name = "Test Org";

    VerifyInsurance verify = new VerifyInsurance();
    verify.CoverageRequest(info);

    S 1 Reply Last reply
    0
    • C captainone

      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.NullReferenceException: 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(RequestorInformation 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.RequestorInformation info = new VerifyInsurance.RequestorInformation();
      info.Organization.Name = "Test Org";

      VerifyInsurance verify = new VerifyInsurance();
      verify.CoverageRequest(info);

      S Offline
      S Offline
      sri_3464 0
      wrote on last edited by
      #2

      The Organization present in the object info is null. Try this VerifyInsurance.RequestorInformation info = new VerifyInsurance.RequestorInformation(); info.Organization = new Organization(); info.Organization.Name = "Test Org"; VerifyInsurance verify = new VerifyInsurance(); verify.CoverageRequest(info); This should work.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups