I build an array of the list. Then nuSOAP helps when converting it to XML
but PHP5 can probably do the same thing.
The following builds an array of line_items to put on an order. Then
inserts that array into another array containing more order data:
for ($i = 1; $i <= $num_items; $i++) {
$new_order_item_list[$i] = array(
'line_number' => $_POST[$myline],
'item_name' => $_POST[$myprod],
'item_id' => $line_item[0]
);
}
$new_order = array(
'customer_number' => addslashes($_POST['customer_number']),
'customer_password' => addslashes($_POST['customer_password']),
'customer_email' => addslashes($_POST['customer_email']),
'send_me_email' => 'yes',
'po_number' => addslashes(trim($_POST['po_number'])),
'itemlist' => $new_order_item_list
}
This is part of the WSDL it is a client to:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:OrderService"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:OrderService">
<types><xsd:schema targetNamespace="urn:OrderService"
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="New_Order_Array">
<xsd:all>
<xsd:element name="customer_number" type="xsd:string"
new_order="customer_number"/>
<xsd:element name="customer_password" type="xsd:string"
new_order="customer_password"/>
<xsd:element name="customer_name" type="xsd:string"
new_order="customer_name"/>
<xsd:element name="customer_email" type="xsd:string"
new_order="customer_email"/>
<xsd:element name="send_me_email" type="xsd:string"
new_order="send_me_email"/>
<xsd:element name="po_number" type="xsd:string" new_order="po_number"/>
<xsd:element name="itemlist" type="tns:New_Order_ItemList_Array"
new_order="itemlist"/>
<xsd:element name="shipment_service" type="xsd:string"
new_order="shipment_service"/>
<xsd:element name="shipment_special" type="xsd:string"
new_order="shipment_special"/>
<xsd:element name="ship_phone" type="xsd:string" new_order="ship_phone"/>
<xsd:element name="ship_address_name" type="xsd:string"
new_order="ship_address_name"/>
<xsd:element name="ship_address_line1" type="xsd:string"
new_order="ship_address_line1"/>
<xsd:element name="ship_address_line2" type="xsd:string"
new_order="ship_address_line2"/>
<xsd:element name="ship_address_city" type="xsd:string"
new_order="ship_address_city"/>
<xsd:element name="ship_address_state" type="xsd:string"
new_order="ship_address_state"/>
<xsd:element name="ship_address_zip" type="xsd:string"
new_order="ship_address_zip"/>
<xsd:element name="ship_address_country" type="xsd:string"
new_order="ship_address_country"/>
<xsd:element name="order_label_url" type="xsd:string"
new_order="order_label_url"/>
<xsd:element name="comments" type="xsd:string" new_order="comments"/>
<xsd:element name="file_name" type="xsd:string" new_order="file_name"/>
<xsd:element name="file_size" type="xsd:string" new_order="file_size"/>
<xsd:element name="file_type" type="xsd:string" new_order="file_type"/>
<xsd:element name="printer_type" type="xsd:string"
new_order="printer_type"/>
<xsd:element name="file_contents" type="xsd:base64Binary"
new_order="file_contents"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="New_Order_ItemList_Array">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType"
wsdl:arrayType="tns:New_Order_ItemList[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="New_Order_ItemList">
<xsd:all>
<xsd:element name="line_number" type="xsd:string"
new_order_itemlist="line_number"/>
<xsd:element name="item_id" type="xsd:int" new_order_itemlist="item_id"/>
<xsd:element name="item_name" type="xsd:string"
new_order_itemlist="item_name"/>
<xsd:element name="label_url" type="xsd:string"
new_order_itemlist="label_url"/>
<xsd:element name="provisioned" type="xsd:string"
new_order_itemlist="provisioned"/>
</xsd:all>
</xsd:complexType>
...
...
Regards
-----Original Message-----
From: Jonathan Pitcher [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 29, 2007 2:42 PM
To: [email protected]
Subject: [PHP] WSDL Question
For the lasts day I have been fighting with PHP, and WSDL calls to a thrid
party provider.
Here is what the call needs to look like:
<SOAP-ENV:Body>
<ns1:ModifyOrganizationRequest>
<ns1:accountIdentifier>
<ns1:account>root</ns1:account>
</ns1:accountIdentifier>
<ns1:orgID>IperiaTestOrg</ns1:orgID>
<ns1:suspended>false</ns1:suspended>
<ns1:serviceSettingCollection>
<ns1:serviceSetting>
<ns1:type>SUBSCRIBER_DEFINED_TRANSFER_NUMBER</ns1:type>
<ns1:value>6179672983</ns1:value>
</ns1:serviceSetting>
<ns1:serviceSetting>
<ns1:type>TIMEZONE</ns1:type>
<ns1:value>US/CENTRAL</ns1:value>
</ns1:serviceSetting>
</ns1:serviceSettingCollection>
</ns1:ModifyOrganizationRequest>
</SOAP-ENV:Body>
I can generate most of the code in fact I can generate all of it but the
Double service setting.
Here is my relevant PHP code.
$SDT = $portal->get_post('SDT');
$SDT = new SoapVar(array('ns1:type' => 'SUBSCRIBER_DEFINED_TRANSFER_ON',
'ns1:value' => $SDT), SOAP_ENC_OBJECT);
$setting_info = array(array('ns1:serviceSetting' => $SDT));
// Getting Iperia Soap Object ...
$soap_iperia = $portal->load_special_object('soap_iperia');
$find_account_obj->accountIdentifier = new SoapVar(array('ns1:account' =>
'root'), SOAP_ENC_OBJECT);
$find_account_obj->orgID = new SoapVar('IperiaTestOrg', XSD_STRING);
$find_account_obj->suspended = new SoapVar(0, XSD_BOOLEAN);
$find_account_obj->serviceSettingCollection = new SoapVar($setting_info,
SOAP_ENC_OBJECT);
$results = $soap_iperia->modifyOrganization($find_account_obj);
That generates the following xml.
<SOAP-ENV:Body>
<ns1:ModifyOrganizationRequest>
<ns1:accountIdentifier>
<ns1:account>root</ns1:account>
</ns1:accountIdentifier>
<ns1:orgID>IperiaTestOrg</ns1:orgID>
<ns1:suspended>false</ns1:suspended>
<ns1:serviceSettingCollection>
<ns1:serviceSetting>
<ns1:type>SUBSCRIBER_DEFINED_TRANSFER_NUMBER</ns1:type>
<ns1:value>6179672983</ns1:value>
</ns1:serviceSetting>
</ns1:serviceSettingCollection>
</ns1:ModifyOrganizationRequest>
</SOAP-ENV:Body>
The question I have is how do I add in the extra:
<ns1:serviceSetting>
<ns1:type>TIMEZONE</ns1:type>
<ns1:value>US/CENTRAL</ns1:value>
</ns1:serviceSetting>
I have tried a couple ways with no success ...
Any tips would be greatly appreciated.
Jonathan Pitcher
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php