CR: Using XML Items

T

Tony

I am developing web aplication in C#. I need to connect to some web service.
I need to enter value for some fields, but these fields are not included in
this object. My wsdl is this:
<xsd:complexType name="NameRQ">
<xsd:sequence>
<xsd:element name="RowNumber" type="xsd:int" />
<xsd:choice>
<xsd:element minOccurs="1" maxOccurs="1" name="GuestCode"
type="xsd:string" />
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="FirstName"
type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="MiddleName"
type="xsd:string" />
<xsd:element name="LastName" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="DateOfBirth"
type="xsd:string" />
<xsd:element name="Gender" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Nationality"
type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Disable"
type="xsd:boolean" />
<xsd:element minOccurs="0" maxOccurs="1" name="PassportNumber"
type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1"
name="PassportExpiryDate" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="GuestTypeCode"
type="xsd:string" />
</xsd:sequence>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>

I can declare NameRQ object in C#, but I can find only RowNumber property
(first property in WSDL). Other fields is not present in intellisense. I am
trying to declare object ItemsChoiceType which have this fields
(ItemsChoiceType.FirstName, ItemsChoiceType.LastName etc.). Problem is how
to add some String to this fields (like "Jim" for the FirstName, "Morrison"
for the last name etc.). I am trying like this:

ItemsChoiceType[] ItemsChoiceTypeObj = new ItemsChoiceType[8];
ItemsChoiceTypeObj[0] = new ItemsChoiceType();

I can add this now:
ItemsChoiceTypeObj[0] =ItemsChoiceType.FirstName;

But on that way I can add only field FirstName, but how can I add Value for
the first name (John, Jim, Jack...)
Any idea? I need code in C# or VB.NET (maybe Java code can also help)

Thanks
 
M

Marc Gravell

Well it is hard to tell since this isn't exactly complete or clear;
however as far as I can tell, the following should work:

YourType foo = new YourType();
foo.ItemsElementName = new ItemsChoiceType[] {
ItemsChoiceType.LastName, ItemsChoiceType.FirstName };
foo.Items = new object[] { "Flintstone", "Fred" };

Any use?

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top