<?php
$client = new SoapClient(“http://192.168.1.27/soap.php?wsdl”, array(“trace” => 1, “exception” => 0));
// LOGIN
$response = $client->__soapCall(“login”,
array(
“user_auth” =>
array(
‘user_name’ => ‘user’,
‘password’ => md5(‘bitnami’),
‘version’ => “0.1”
),
“application_name” => ”
)
);
$session_id = $response->id;
echo “session_id=$session_id\n”;
// CREATE ACCOUNT
$response = $client->set_entry($session_id, ‘Accounts’, array(
array(‘name’ => ‘name’, ‘value’ => “Account Test 003”),
array(‘name’ => ‘phone’, ‘value’ => “0102031003”)
));
$account_id = $response->id;
echo “account_id=$account_id\n”;
//The “trace” parameter when creating the SoapClient instance let you play with the PHP Soap debug trace. Try to add these lines at the end of the code:
echo “LastRequest\n”;
echo $client->__getLastRequest();
echo “LastResponse\n”;
echo $client->__getLastResponse();
?>
refined as per custom module
<?php
$client = new SoapClient(“http://192.168.1.27/soap.php?wsdl”, array(“trace” => 1, “exception” => 0));
// LOGIN
$response = $client->__soapCall(“login”,
array(
“user_auth” =>
array(
‘user_name’ => ‘user’,
‘password’ => md5(‘bitnami’),
‘version’ => “0.1”
),
“application_name” => ”
)
);
$session_id = $response->id;
echo “session_id=$session_id\n”;
// CREATE entry
// sym03_soaptest is like <key>_<modulename>
$response = $client->set_entry($session_id, ‘sym03_soaptest’, array(
// array(‘name’ => ‘name’, ‘value’ => “005”),
array(‘name’ => ‘name’, ‘value’ => “Sultan”),
array(‘name’ => ‘description’, ‘value’ => “description 001”)
));
$soapid = $response->id;
echo “soapid=$soapid\n”;
//The “trace” parameter when creating the SoapClient instance let you play with the PHP Soap debug trace. Try to add these lines at the end of the code:
echo “LastRequest\n”;
echo $client->__getLastRequest();
echo “LastResponse\n”;
echo $client->__getLastResponse();
?>