Share ideas, ask questions, and get feedback about developing for ProcessMaker
Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
By nsoonhui
#2151
Try the below code:
Code: Select all

$wsdl = "";   //your wsdl 
$client = new SoapClient($wsdl); 

$dwer= $client->login(array('userid'=>$usr, 'password'=>$pass)); 

$sessionId = $dwer->message;
$aVariables = array('CaseTitle'=>'big case',);
    $aVariables = array();
      foreach ( $variables as $key => $val ) {
        $obj = new stdClass();
        $obj->name = $key;
        $obj->value = $val;
        $aVariables[] = $obj;
      }	

        $params = array('sessionId'=>$sessionId, 'processId'=> $proUid, 'taskId'=> $taskUid, 
      'variables'=>$aVariables  );
      echo serialize($aVariables).'<br/>';

      $result = $client->__SoapCall('NewCase', array($params));
The program will enter into the workflow\engine\methods\services\soap.php, inside the function NewCase($params), at this particular sub-routine:
Code: Select all
    else {
      if ( is_object ($variables) ) {
      	foreach ( $variables as $key=>$val ) {
          $name  = $val->name;
          $value = $val->value;
          $Fields[ $val->name ]= $val->value ;
        }
        //$Fields[ $variables->name ]= $variables->value ;
      }
with the serialized array for $variables
Code: Select all
a:1:{i:0;O:8:"stdClass":2:{s:4:"name";s:9:"CaseTitle";s:5:"value";s:8:"big case";}}
Note that the above code in NewCase doesn't handle the $variables properly.

This is a bug, and I hope that you guys can fix it fast.

If you want to know the best technique to export P[…]

Nursing dissertation help topics

Home of Dissertations is the most used platform th[…]

A Dream11 clone script is a pre-made software solu[…]

A stake clone script is a pre-designed, error-free[…]