I have a DMN table and a Symfony 2 project. They communicate by WS.
In Postman, the DMN works very well:
I apply this example camunda-dmn-cloud-examples/php/dish-decision.php at master · camunda/camunda-dmn-cloud-examples · GitHub in my project:
/** * @param Request $request * @Rest\Get("/api/decisions") */ public function getBusinessRule(Request $request){ if($request->get("amountInput") !=''){ $amount = $request->get("amountInput"); } if($request->get("keyTableDecision") !=''){ $key = $request->get("keyTableDecision"); } $data = array('variable'=>array( 'amount' => array( 'type' => 'long', 'value' => intval($amount) ) ) ); $service_url = 'http://myserver/engine-rest/decision-definition/key/'.$key.'/evaluate'; $curl = curl_init($service_url); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $data_string = json_encode($data); curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string); $curl_response = curl_exec($curl); curl_close($curl); $decoded = json_decode($curl_response); echo "You should have " . $decoded->outputs->value; }
An error message displays:
Can you help me ?