-
-
Save tejastank/a4716db27f0121f8287b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Setup Items | |
$order_items = array(); | |
$order_items[] = array( | |
"Offer" => array( | |
"Header" => array( | |
"ID" => "FC-Money", | |
), | |
), | |
"Quantity" => 1, | |
"OrderShipTo" => array( | |
"Key" => 0, | |
), | |
); | |
//Setup Order | |
$order_array = array( | |
"order" => array( | |
"Header" => array( | |
"ID" => "111111", | |
"ReferenceNumber" => "111111", | |
"EntryDate" => date('c', strtotime("2014-01-01")), | |
"PONumber" => "", | |
"Comments" => "Order notes to fulfillment center", | |
), | |
"Shipping" => array( | |
"FreightCode" => "LECR", | |
"FreightCodeDescription" => "RateBot", | |
), | |
"Money" => "", | |
"Payment" => "", | |
"OrderedBy" => array( | |
"FirstName" => "John", | |
"LastName" => "Doe", | |
"Company" => "Acme", | |
"Address1" => "123 Main St", | |
"Address2" => "", | |
"Address3" => "", | |
"City" => "Anytown", | |
"State" => "CA", | |
"PostalCode" => "55555", | |
"Country" => "US", | |
"Phone" => "555-555-5555", | |
"Email" => "[email protected]", | |
), | |
"ShipTo" => array( | |
"OrderShipTo" => array( | |
"FirstName" => "John", | |
"LastName" => "Doe", | |
"Company" => "Acme", | |
"Address1" => "123 Main St", | |
"Address2" => "", | |
"Address3" => "", | |
"City" => "Anytown", | |
"State" => "CA", | |
"PostalCode" => "55555", | |
"Country" => "US", | |
"Phone" => "555-555-5555", | |
"Flag" => "Other", | |
"Key" => 0, | |
), | |
), | |
"BillTo" => array( | |
"Flag" => "OrderedBy", | |
), | |
"Offers" => array( | |
"OfferOrdered" => $order_items, | |
), | |
), | |
); | |
//Setup Login Data | |
$header_data = array( | |
'Username' => "UserTest", | |
'Password' => "test", | |
); | |
$options = array( | |
"soap_version" => SOAP_1_2, | |
"trace" => 1, | |
'exceptions' => true, | |
); | |
$wsdl_url = 'https://rhu049.veracore.com/pmomsws/oms.asmx?wsdl'; | |
//Set Client | |
$client = new \SoapClient($wsdl_url, $options); | |
//Create and set header | |
$header = new \SoapHeader('http://omscom/', 'AuthenticationHeader', $header_data); | |
$client->__setSoapHeaders($header); | |
///Giving a shot | |
try { | |
$result = $client->AddOrder($order_array); | |
//For Debug | |
die("(Success) XML:" . htmlentities($client->__getLastRequest())); | |
//Aw nuts.... | |
} catch (\Exception $e) { | |
//For Debug | |
echo $e->getMessage(); | |
die("(Error) XML:" . htmlentities($client->__getLastRequest())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment