Do you think the quotes are the problem? If so, you can try formatting it like
this:
$json = '{"input1":"0", "input2":"1", ...'
In PHP you can nest "" inside '' without having to escape the characters.
Dave
From: Nadeem Anjum [mailto:[email protected]]
Sent: Thursday, June 12, 2014 11:59 AM
To: [email protected]
Subject: Re: [GSoC] Passing a json string as input to an applciation in PHP-SDK
Correction:
$json has value:
"{\"input1\":\"0\",\"input2\":\"1\",\"input3\":\"on\",\"_logon\":\"\",\"_project\":\"\",\"_uuid\":\"c9894860-f236-11e3-8708-19a98ecc24ae\",\"_base_directory\":\"/var/www/html/nadeemtest/results/5399ad3f791f5\",\"_udphost\":null,\"_udpport\":37779,\"resourcedefault\":\"local\"}"
On Thu, Jun 12, 2014 at 5:57 PM, Nadeem Anjum
<[email protected]<mailto:[email protected]>> wrote:
Hello Everyone,
I have registered an application (A Genapp Module) which takes a json string as
input. I am using PHP client samples', createExperiment Method
I use the follopwing code:
$input->value = $json;
where $json has value
"{\"input1\\":\\"0\\",\\"input2\\":\\"1\\",\\"input3\\":\\"on\\",\\"_logon\\":\\"\\",\\"_project\\":\\"\\",\\"_uuid\\":\\"c9894860-f236-11e3-8708-19a98ecc24ae\\",\\"_base_directory\\":\\"/var/www/html/nadeemtest/results/5399ad3f791f5\\",\\"_udphost\\":null,\\"_udpport\\":37779,\\"resourcedefault\\":\\"local\\"}";
However, the in response received, $input->value gets changed to
"{"input1":"0","input2":"1","input3":"on","_logon":"","_project":"","_uuid":"c9894860-f236-11e3-8708-19a98ecc24ae","_base_directory":"/var/www/html/nadeemtest/results/5399ad3f791f5","_udphost":null,"_udpport":37779,"resourcedefault":"local"}"
which being malformed, does not give me the expected output.
The response is given below:
object(Airavata\Model\Workspace\Experiment\Experiment)#12 (18) {
["experimentID"]=>
string(21) "DO_NOT_SET_AT_CLIENTS"
["projectID"]=>
string(42) "align_16b50043-1f92-491a-a276-d658e8b2018b"
["creationTime"]=>
NULL
["userName"]=>
string(6) "nadeem"
["name"]=>
string(4) "exp1"
["description"]=>
NULL
["applicationId"]=>
string(5) "align"
["applicationVersion"]=>
NULL
["workflowTemplateId"]=>
NULL
["workflowTemplateVersion"]=>
NULL
["userConfigurationData"]=>
NULL
["workflowExecutionInstanceId"]=>
NULL
["experimentInputs"]=>
array(1) {
[0]=>
object(Airavata\Model\Workspace\Experiment\DataObjectType)#9 (4) {
["key"]=>
string(3) "inp"
["value"]=>
string(240)
"{"input1":"0","input2":"1","input3":"on","_logon":"","_project":"","_uuid":"c9894860-f236-11e3-8708-19a98ecc24ae","_base_directory":"/var/www/html/nadeemtest/results/5399ad3f791f5","_udphost":null,"_udpport":37779,"resourcedefault":"local"}"
["type"]=>
int(0)
["metaData"]=>
NULL
}
}
["experimentOutputs"]=>
array(1) {
[0]=>
object(Airavata\Model\Workspace\Experiment\DataObjectType)#11 (4) {
["key"]=>
string(3) "out"
["value"]=>
string(0) ""
["type"]=>
int(0)
["metaData"]=>
NULL
}
}
["experimentStatus"]=>
NULL
["stateChangeList"]=>
NULL
["workflowNodeDetailsList"]=>
NULL
["errors"]=>
NULL
}
Any ideas on how to deal with this situation will be appreciated.
Thanks,
Nadeem