Skip to content

Instantly share code, notes, and snippets.

@jlengstorf
Created October 14, 2010 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlengstorf/626483 to your computer and use it in GitHub Desktop.
Save jlengstorf/626483 to your computer and use it in GitHub Desktop.
<?php
$client = new SoapClient(
"https://www.clix.ca/scripts/ismartpoints.wsdl",
array(
'exceptions'=>true,
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE
)
);
define(SVID, "AAAE1EE8-8435-4447-9918-4DCDADA1F551");
define(CTCUSTNO, 1859);
//Method 1: Customer array
$customer = array(
'Result' => true,
'ErrorCode' => '0',
'ErrorString' => '',
'CustomerNo' => 'web00000001',
'Status' => 'R',
'Level' => '',
'LastName' => 'Testerton',
'FirstName' => 'Testy',
'Company' => '',
'HomePhone' => '8005551234',
'WorkPhone' => '8005551235',
'Address' => '123 Address Street',
'Address2' => 'Ste 2',
'City' => 'Somewhere',
'PostalCode' => '00000',
'ProvinceNo' => 'WideString',
'CountryNo' => 'WideString',
'ShipLastName' => '',
'ShipFirstName' => '',
'ShipCompany' => '',
'ShipHomePhone' => '',
'ShipAddress' => '',
'ShipAddress2' => '',
'ShipCity' => '',
'ShipPostalCode' => '',
'ShipProvinceNo' => '',
'ShipCountryNo' => '',
'EmailAddr' => 'test@example.com',
'Updated' => '',
'FieldList' => '',
'DataList' => '',
'PollDate' => '',
'DataType' => 'WEB'
);
// Define a class to hold the SOAP structure
class SoapStruct
{
public function __construct( $data_arr=array() )
{
foreach( $data_arr as $key=>$val )
{
$this->$key = $val;
}
}
}
// Use output buffering to capture what's coming out of the SOAP call
ob_start();
// Create a SOAP Structure
$structure = new SoapStruct($customer);
$customer_soap = new SoapVar($structure, SOAP_ENC_OBJECT, "TWebCustomerResult");
try
{
print_r($client->UpdateCustomer(SVID, CTCUSTNO, $customer_soap));
}
catch( Exception $e)
{
echo $e->getMessage();
}
echo "\n\n";
print_r(wordwrap(htmlentities(str_replace('><', ">\n<", $client->__getLastRequest())), 160, "\n "));
$call = ob_get_clean();
echo "<h1>SOAP Call</h1>\n<pre>", $call, "</pre>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment