I have an WSDL document and it has elements like this above.
  <s:element name="NewPortalOrder">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="1" maxOccurs="1" name="OrderType" type="tns:CardSalesType" />
        <s:element minOccurs="1" maxOccurs="1" name="Customer" type="tns:PortalCustomerContainer" />
        <s:element minOccurs="1" maxOccurs="1" name="InvoiceAddress" type="tns:AddressContainer" />
        <s:element minOccurs="1" maxOccurs="1" name="DeliveryAddress" type="tns:AddressContainer" />
        <s:element minOccurs="0" maxOccurs="1" name="Cards" type="tns:ArrayOfPortalCardContainer" />
      </s:sequence>
    </s:complexType>
  </s:element>
I added the WSDL file as a ServiceReference into the solution.
On the server side
  WS.NewPortalOrderRequest order = new WS.NewPortalOrderRequest();
  order.InvoiceAddress.AddressLine1 = txtAddress.Text;
  order.InvoiceAddress.AddressLine2 = txtAddress2.Text;
On the order.InvoiceAddress.AddressLine1 = txtAddress.Text; line I get the Object reference not set to an instance of an object. error.
When I watch the order.InvoiceAddress, I see that is null. Why can I get this error? How can I solve it?
 
     
    