Hi, I'm trying to consume a SOAP web service that requires
complex datatypes. The relevant portions of the WSDL:
<s:element name="SearchHotels">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="sDestination" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1"
name="sHotelCityName" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1"
name="sHotelLocationName" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="sHotelName"
type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="dtCheckIn"
type="s:date"/>
<s:element minOccurs="1" maxOccurs="1" name="dtCheckOut"
type="s:date"/>
<s:element minOccurs="0" maxOccurs="1"
name="roomsInformation" type="tns:ArrayOfRoomInfo"/>
<s:element minOccurs="1" maxOccurs="1" name="maxPrice"
type="s:decimal"/>
<s:element minOccurs="1" maxOccurs="1" name="starLevel"
type="s:decimal"/>
<s:element minOccurs="1" maxOccurs="1"
name="fAvailableOnly" type="s:boolean"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfRoomInfo">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded"
name="RoomInfo" nillable="true" type="tns:RoomInfo"/>
</s:sequence>
</s:complexType>
<s:complexType name="RoomInfo">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="AdultsNum"
type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="ChildNum"
type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="ChildAges"
type="tns:ArrayOfInt"/>
</s:sequence>
</s:complexType>
How do I construct these sequence sections? It's possible to
have more than once occurrance of an element with the same name
e.g. RoomInfo so I can't see how I'd use a Struct here?
I've tried this:
hotelservice = CreateObject("webservice", "
http://....?wsdl");
room1 = StructNew();
room1.AdultsNum = 1;
room1.ChildNum = 0;
ages = StructNew();
ages.ChildAge = 0;
room1.ChildAges = ages;
roomsinfo = StructNew();
roomsinfo.RoomInfo = room1;
ret = hotelservice.SearchHotels( sDestination = "NYC",
sHotelCityName = "",
sHotelLocationName = "",
sHotelName = "",
dtCheckIn = CreateDate(2007,09,09),
dtCheckOut = CreateDate(2007,09,10),
roomsInformation = roomsinfo,
maxPrice = 999.0,
starLevel = 2.0,
fAvailableOnly = true );
Any help would be welcome!