You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airavata.apache.org by Nadeem Anjum <na...@gmail.com> on 2014/06/12 17:57:36 UTC

[GSoC] Passing a json string as input to an applciation in PHP-SDK

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

RE: [GSoC] Passing a json string as input to an applciation in PHP-SDK

Posted by "Reagan, David Michael" <dm...@iu.edu>.
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 <dm...@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<ma...@gmail.com>]
Sent: Thursday, June 12, 2014 11:59 AM
To: dev@airavata.apache.org<ma...@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 <na...@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



Re: [GSoC] Passing a json string as input to an applciation in PHP-SDK

Posted by Nadeem Anjum <na...@gmail.com>.
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 <dm...@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]
> *Sent:* Thursday, June 12, 2014 11:59 AM
> *To:* 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 <na...@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
>
>
>

RE: [GSoC] Passing a json string as input to an applciation in PHP-SDK

Posted by "Reagan, David Michael" <dm...@iu.edu>.
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]
Sent: Thursday, June 12, 2014 11:59 AM
To: 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 <na...@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


Re: [GSoC] Passing a json string as input to an applciation in PHP-SDK

Posted by Nadeem Anjum <na...@gmail.com>.
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 <na...@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
>