Chris Richardson
Chris Richardson

Reputation: 80

C# consume complex type from soap webservice

I have consumed a webservice in VS2010 C#. Within the WSDL there are a few complex types, one of which is defined as:

<element name="dsPageInfo">
  <complexType>
    <sequence>
      <element maxOccurs="unbounded" minOccurs="0" name="ttPageInfo">
        <complexType>
          <sequence>
            <element name="PageTitle" nillable="true" type="xsd:string"/>
            <element name="MetaTitle" nillable="true" type="xsd:string"/>
            <element name="MetaDescription" nillable="true" type="xsd:string"/>
            <element name="MetaKeywords" nillable="true" type="xsd:string"/>
          </sequence>
        </complexType>
      </element>
    </sequence>
  </complexType>
</element>

To define and call this in VB:

Dim webService As New myWeb.wsObjClient()

Dim systemType As String

Dim ds(0) As myWeb.dsPageInfoTtPageInfo

webService.Getpageinfo(systemType, ds)

What's the equivalent to Dim ds(0) As myWeb.dsPageInfoTtPageInfo in C#?

So far I have:

string systemType = "mySysType";
myWeb.wsObjClient webService = new myWeb.wsObjClient();

webSevice.Getpageinfo (
    systemType,
    // complex type goes here);

Upvotes: 0

Views: 2208

Answers (1)

Prabhu Murthy
Prabhu Murthy

Reputation: 9261

Here is the equivalent for creating the array in C#

myWeb.dsPageInfoTtPageInfo[] ds= new myWeb.dsPageInfoTtPageInfo[1]

ds[0]= new dsPageInfoTtPageInfo();
webSevice.Getpageinfo (systemType,ds); 

Upvotes: 1

Related Questions