There's an example to a simple AX service client, using two access methods of trivial AX service:
- getOrder with one string argument - orderId, returning some set of orderIds;
- setCost with multiple argumens - some of the values of order, that must be set.
All of this is operating under some kind of WS_Security, so there's shown also a way to set appropriate header values. Althrough this is obviously not a complete example, as complying with real WS_Security and SSL needs much more actions. I just left there this setting of headers as some piece of useful code.
You can find a way more sophisticated example at
http://www.sis.utoronto.ca/web_servi...lient.php.html.
Be sure, that you have uncommented in your php.ini php_soap.dll extension prior to start playing with PHP as SOAP service client.
X++:
<?php
$login = "login";
$password = "password";
class argumentObject
{
public $number = "";
public $number_string = "";
public $cost = 0.0;
public $discount = 0.0;
public $discount2 = 0.0;
public $status = "";
}
try {
$cl = new SoapClient('YOUR_URL_TO_WSDL');
$cl->__setSoapHeaders(array(new SoapHeader('namespace_name', 'security_token', array($login, $password), 1)));
$result = $cl->getOrder("Some_order_id");
print($result->orders[0]->number);
$placementArray = array();
$argumentObject = new argumentObject();
$argumentObject->number=$result->orders[0]->number;
$argumentObject->number_string=$result->orders[0]->number_string;
$argumentObject->cost=0;
$argumentObject->status="Status_name";
$argumentArray[0]=$placement;
$cl->setCost($argumentArray);
} catch (SoapFault $fault) {
print("Fault string: " . $fault->faultstring . "\n");
print("Fault code: " . $fault->detail->WebServiceException->code . "\n");
}
?>