Soap complex type example

Hi,

i’ve got very limited soap experience and i’m currently stuck on how to
get a ruby soap client up and running.

the wsdl of the service i am trying to access is here:
https://www.encryptedserver2.com/alturawebservicedev/storewebservice.asmx?WSDL

and the specific method i want to call looks like this:

<s:element name=“PlaceOrderV1”>
<s:complexType>
<s:sequence>
<s:element minOccurs=“1” maxOccurs=“1” name=“StorefrontID”
type=“s:int”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“Username” type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“Password” type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“AccessPwd”
type=“s:string”/>
<s:element minOccurs=“1” maxOccurs=“1” name=“PlaceOrderRequest”
nillable=“true” type=“tns:PlaceOrderRequest”/>
</s:sequence>
</s:complexType>
</s:element>

<s:complexType name="PlaceOrderRequest">

<s:complexContent mixed="false">

<s:extension base="tns:BaseRequest">

<s:sequence>
<s:element minOccurs=“0” maxOccurs=“1” name=“StorefrontOrderID”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“ShipToFirstName”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“ShipToMiddleName”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“ShipToLastName”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“ShipToAddress”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“ShipToAddress2”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“ShipToCity”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“ShipToState”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“ShipToZip”
type=“s:string”/>
<s:element minOccurs=“1” maxOccurs=“1” name=“ShipToCountryID”
type=“s:int”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“ShipToPhone”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“ShipToEmail”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToFirstName”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToMiddleName”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToLastName”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToAddress”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToAddress2”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToCity”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToState”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToZip”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToCountry”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToPhone”
type=“s:string”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“BillToEmail”
type=“s:string”/>
<s:element minOccurs=“1” maxOccurs=“1” name=“ShipMethodID”
type=“s:int”/>
<s:element minOccurs=“0” maxOccurs=“1” name=“LineItemArray”
type=“tns:ArrayOfLineItem”/>
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>

<s:complexType name="ArrayOfLineItem">

<s:sequence>

<s:element minOccurs=“0” maxOccurs=“unbounded” name=“LineItem”
nillable=“true” type=“tns:LineItem”/>
</s:sequence>
</s:complexType>

<s:complexType name="LineItem">

<s:sequence>

<s:element minOccurs=“1” maxOccurs=“1” name=“ProductID” type=“s:int”/>
<s:element minOccurs=“1” maxOccurs=“1” name=“Qty” type=“s:int”/>
</s:sequence>
</s:complexType>

from various simple examples i get this far:
wsdl_url =
https://www.encryptedserver2.com/alturawebservicedev/storewebservice.asmx?WSDL
soap = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver
soap.wiredump_file_base = “soapresult”

param = {
    'StorefrontID' => '112',
    'Username' => 'wszaadz',
    'Password' => 'wsdev',
    'AccessPwd' => 'zaadzda',
 }
result = soap.PlaceOrderV1(param)

but i can’t for the life of me figure out how to send the values for
the PlaceOrderRequest and ArrayOfLineItems and LineItem types?

If there is no support for complex types in the standard soap libraries,
what would be the simplest way to make a soap request to such a complex
method?

any help would be much appreciated.

regards,

Francois

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Sorry for late reply.

Francois P. wrote:

   'AccessPwd' => 'zaadzda',
}

result = soap.PlaceOrderV1(param)

but i can’t for the life of me figure out how to send the values for
the PlaceOrderRequest and ArrayOfLineItems and LineItem types?

Please try this;

param = {
‘StorefrontID’ => ‘112’,
‘Username’ => ‘wszaadz’,
‘Password’ => ‘wsdev’,
‘AccessPwd’ => ‘zaadzda’,
‘PlaceOrderRequest’ => {
‘ShipToCountryID’ => 99,
‘ShipMethodID’ => 99,
‘LineItemArray’ => {
‘LineItem’ => [
{
‘ProductID’ => 99,
‘Qty’ => 99
},
{
‘ProductID’ => 98,
‘Qty’ => 98
}
]
}
}
}

Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)

iQEVAwUBRPEI0B9L2jg5EEGlAQL5Lwf/clt8AIcJb+gq/fs4q+Q8av1iD60w83Iw
EsRImsWzmI3D9fGhmro6cLuqFEs4aGrlNtZhTAC5pRC32z/9pQiuEcSxL3wlDMFA
dkaiXosiAHjDpatLGi5Yas02/4ZMORwDhAZYkpBtiA8sxbFTgXR1HG+TGVUYs+1m
v3+QAFCKaVmUeBhTSPNYfeaO00vs5jNL+bZGVibgKVcjuOnqS2PZZN5JBPFP+5ZM
rTylCEkeVB9SxTFAWChjvx+4M3wWv2GMNVDKXGdVoQRkBEN12xcfBRwXVimIuJYf
RekLF6oMsD/gIybTnGgNJ6di6z0rtMayURllhH7lkgr+6ISMXeKA3g==
=JcGm
-----END PGP SIGNATURE-----