Skip to content

Instantly share code, notes, and snippets.

@sparkweb
Created April 3, 2014 20:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sparkweb/9962184 to your computer and use it in GitHub Desktop.
Save sparkweb/9962184 to your computer and use it in GitHub Desktop.
VeraCore SOAP AddOrder
<?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" => "test@test.com",
),
"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()));
}
@thinksaydo
Copy link

Hi, we're doing a VeraCore integration for a small client project, but cannot find documentation on how to work with them. I saw your gist here and thought you might be able to tell me how you wrote the code above. Thank you for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment