airavata-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reagan, David Michael" <dmrea...@iu.edu>
Subject RE: [GSoC] Passing a json string as input to an applciation in PHP-SDK
Date Fri, 13 Jun 2014 16:17:52 GMT
Perhaps the functions json_encode() and json_decode() could help?

http://www.php.net/manual/en/function.json-encode.php
http://www.php.net/manual/en/function.json-decode.php

Dave

From: Nadeem Anjum [mailto:nadeem.cs.iit@gmail.com]
Sent: Thursday, June 12, 2014 2:32 PM
To: dev@airavata.apache.org
Subject: Re: [GSoC] Passing a json string as input to an applciation in PHP-SDK

Hi Dave,

I have already tried

$json = '{"input1":"0", "input2":"1", ...'

but this gets converted automatically to:

"'{"input1":"0", "input2":"1", ...'"

which again does'nt work with the application.

On Thu, Jun 12, 2014 at 7:51 PM, Reagan, David Michael <dmreagan@iu.edu<mailto:dmreagan@iu.edu>>
wrote:
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:nadeem.cs.iit@gmail.com<mailto:nadeem.cs.iit@gmail.com>]
Sent: Thursday, June 12, 2014 11:59 AM
To: dev@airavata.apache.org<mailto:dev@airavata.apache.org>
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 <nadeem.cs.iit@gmail.com<mailto:nadeem.cs.iit@gmail.com>>
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



Mime
View raw message