# Soap complex type example

**URL:** <https://rubytalk.org/t/soap-complex-type-example/29947>\
**Category:** ruby-talk\
**Created:** [14 August 2006 14:34 UTC](https://rubytalk.org/t/soap-complex-type-example/29947 "2006-08-14T14:34:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francois\_Paul](https://avatars.discourse-cdn.com/v4/letter/f/7bcc69/32.png) [@Francois\_Paul](https://rubytalk.org/u/Francois_Paul)\
**Post date:** [14 August 2006 14:34 UTC](https://rubytalk.org/t/soap-complex-type-example/29947/1 "2006-08-14T14:34:42Z")

</div>

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](https://www.encryptedserver2.com/alturawebservicedev/storewebservice.asmx?WSDL)

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

\<s:element name="PlaceOrderV1"\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<s:complexType\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<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\>

&nbsp;&nbsp;&nbsp;&nbsp;\<s:complexType name="PlaceOrderRequest"\>

&nbsp;&nbsp;&nbsp;&nbsp;\<s:complexContent mixed="false"\>

&nbsp;&nbsp;&nbsp;&nbsp;\<s:extension base="tns:BaseRequest"\>

&nbsp;&nbsp;&nbsp;\<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\>

&nbsp;&nbsp;&nbsp;&nbsp;\<s:complexType name="ArrayOfLineItem"\>

&nbsp;&nbsp;&nbsp;&nbsp;\<s:sequence\>  
\<s:element minOccurs="0" maxOccurs="unbounded" name="LineItem" nillable="true" type="tns:LineItem"/\>  
\</s:sequence\>  
\</s:complexType\>

&nbsp;&nbsp;&nbsp;&nbsp;\<s:complexType name="LineItem"\>

&nbsp;&nbsp;&nbsp;&nbsp;\<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:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wsdl\_url = "[https://www.encryptedserver2.com/alturawebservicedev/storewebservice.asmx?WSDL](https://www.encryptedserver2.com/alturawebservicedev/storewebservice.asmx?WSDL)"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soap = SOAP::WSDLDriverFactory.new(wsdl\_url).create\_rpc\_driver  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soap.wiredump\_file\_base = "soapresult"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;param = {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'StorefrontID' =\> '112',  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Username' =\> 'wszaadz',  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Password' =\> 'wsdev',  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'AccessPwd' =\> 'zaadzda',  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;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

---

<div class="post-metadata">

**Author:** ![NAKAMURA\_Hiroshi4](https://avatars.discourse-cdn.com/v4/letter/n/3ab097/32.png) [@NAKAMURA\_Hiroshi4](https://rubytalk.org/u/NAKAMURA_Hiroshi4)\
**Post date:** [27 August 2006 02:53 UTC](https://rubytalk.org/t/soap-complex-type-example/29947/2 "2006-08-27T02:53:17Z")

</div>

Hi,

Sorry for late reply.

Francois Paul wrote:

> from various simple examples i get this far:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wsdl\_url =  
> "[https://www.encryptedserver2.com/alturawebservicedev/storewebservice.asmx?WSDL&quot](https://www.encryptedserver2.com/alturawebservicedev/storewebservice.asmx?WSDL&quot);
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soap = SOAP::WSDLDriverFactory.new(wsdl\_url).create\_rpc\_driver  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soap.wiredump\_file\_base = "soapresult"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;param = {  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'StorefrontID' =\> '112',  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Username' =\> 'wszaadz',  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Password' =\> 'wsdev',  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'AccessPwd' =\> 'zaadzda',  
> &nbsp;&nbsp;&nbsp;&nbsp;}  
> &nbsp;&nbsp;&nbsp;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 = {  
&nbsp;&nbsp;'StorefrontID' =\> '112',  
&nbsp;&nbsp;'Username' =\> 'wszaadz',  
&nbsp;&nbsp;'Password' =\> 'wsdev',  
&nbsp;&nbsp;'AccessPwd' =\> 'zaadzda',  
&nbsp;&nbsp;'PlaceOrderRequest' =\> {  
&nbsp;&nbsp;&nbsp;&nbsp;'ShipToCountryID' =\> 99,  
&nbsp;&nbsp;&nbsp;&nbsp;'ShipMethodID' =\> 99,  
&nbsp;&nbsp;&nbsp;&nbsp;'LineItemArray' =\> {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'LineItem' =\> [  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'ProductID' =\> 99,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Qty' =\> 99  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'ProductID' =\> 98,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Qty' =\> 98  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]  
&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;}  
}

Regards,  
// NaHi
