SOAP Newbie Help
| From: | Roger Ferber | Date: | Fri, 12 Mar 2004 18:06:58 +0000 |
| Subject: | SOAP Newbie Help | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1426@lists.php.net to get a copy of this message | ||
Trying to figure out how to create the proper SOAP request for WSDL. Below
is the definition from generateProxyCode(). Can't figure out how to create
$basket parameter. Any help would be appreciated.
function &getExchangeQuote($merchantAccessCode, $sessionID, $basket) {
// basket is a ComplexType Basket,
//refer to wsdl for more info
$basket =& new
SOAP_Value('basket','{http://www.themindelectric.com/package/com.borderfree.
api.client/}Basket',$basket);
return $this->call("getExchangeQuote",
$v =
array("merchantAccessCode"=>$merchantAccessCode, "sessionID"=>$sessionID,
"basket"=>$basket),
array('namespace'=>'http://www.borderfree.com',
'soapaction'=>'getExchangeQuote',
'style'=>'rpc',
'use'=>'encoded' ));
}
WSDL definition:
- <xsd:complexType name="Basket">
- <xsd:all>
<xsd:element name="countryOfPurchase" nillable="true"
type="xsd:string" />
<xsd:element name="countryOfDestination" nillable="true"
type="xsd:string"
/>
<xsd:element name="merchantWebRefNum" nillable="true"
type="xsd:string" />
<xsd:element name="taxes" nillable="true" type="n10:ArrayOfTax"
/>
<xsd:element name="discounts" nillable="true"
type="n10:ArrayOfDiscount"
/>
<xsd:element name="items" nillable="true"
type="n10:ArrayOfBasketItem" />
<xsd:element name="orderValue" type="xsd:decimal" />
</xsd:all>
</xsd:complexType>
- <xsd:complexType name="Tax">
- <xsd:all>
<xsd:element name="type" nillable="true" type="xsd:string" />
<xsd:element name="name" nillable="true" type="xsd:string" />
<xsd:element name="location" nillable="true" type="xsd:string"
/>
<xsd:element name="value" type="xsd:decimal" />
</xsd:all>
</xsd:complexType>
- <xsd:complexType name="ArrayOfTax">
- <xsd:complexContent>
- <xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="n10:Tax[]" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
- <xsd:complexType name="Discount">
- <xsd:all>
<xsd:element name="type" nillable="true" type="xsd:string" />
<xsd:element name="name" nillable="true" type="xsd:string" />
<xsd:element name="discount" type="xsd:decimal" />
</xsd:all>
</xsd:complexType>
- <xsd:complexType name="ArrayOfDiscount">
- <xsd:complexContent>
- <xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="n10:Discount[]"
/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
- <xsd:complexType name="BasketItem">
- <xsd:all>
<xsd:element name="lineNumber" nillable="true" type="soapenc:int"
/>
<xsd:element name="id" nillable="true" type="xsd:string" />
<xsd:element name="linkedID" nillable="true" type="xsd:string"
/>
<xsd:element name="name" nillable="true" type="xsd:string" />
<xsd:element name="url" nillable="true" type="xsd:string" />
<xsd:element name="description" nillable="true" type="xsd:string"
/>
<xsd:element name="categoryID" nillable="true" type="xsd:string"
/>
<xsd:element name="type" nillable="true" type="xsd:string" />
<xsd:element name="additionalShipping" type="xsd:decimal" />
<xsd:element name="additionalHandling" type="xsd:decimal" />
<xsd:element name="unitPrice" type="xsd:decimal" />
<xsd:element name="discount" type="xsd:decimal" />
<xsd:element name="size" nillable="true" type="xsd:string" />
<xsd:element name="color" nillable="true" type="xsd:string" />
<xsd:element name="attributes" nillable="true"
type="n11:Hashtable" />
</xsd:all>
</xsd:complexType>
- <xsd:complexType name="ArrayOfBasketItem">
- <xsd:complexContent>
- <xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="n10:BasketItem[]"
/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
Thanks,
Roger Ferber