[Flow] Error in JSON RPC request

toco at aimeos.org toco at aimeos.org
Sat Feb 21 17:18:51 CET 2015


Hi all

For the administration interface, there's a data exchange using JSON RPC via Sencha ExtDirect. It sends messages to the server like this:

[{"jsonrpc":"2.0","method":"Product_Type.searchItems","params":{"site":"default"},"id":2},{"jsonrpc":"2.0","method":"Service_Type.searchItems","params":{"site":"default"},"id":3},...]

Unfortunately, I get a HTTP 500 back because the following error occurs:

#1210858767: Invalid argument name (must be a non-empty string).
TYPO3\Flow\Mvc\Exception\InvalidArgumentNameException thrown in file
/Aimeos/src/flow/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Flow_Mvc_ActionRequest.php in line 448.

After digging a little bit around I've found out that the JSON payload is decoded by Flow and the error is caused by the numerical indexes of the resulting array:

00526: error_log( print_r( $arguments, true ) );
00527:   foreach ($arguments as $key => $value) {
00528:    $this->setArgument($key, $value);
00529:   }
00530:  }

Array
(
    [0] => Array
        (
            [jsonrpc] => 2.0
            [method] => Product_Type.searchItems
            [params] => Array
                (
                    [site] => default
                )

            [id] => 2
        )

    [1] => Array
        (
            [jsonrpc] => 2.0
            [method] => Service_Type.searchItems
            [params] => Array
                (
                    [site] => default
                )

            [id] => 3
        )
)

My route for the action is like this:

-
  name: 'Admin JSON RPC request'
  uriPattern: 'admin/do'
  defaults:
    '@package':    'Aimeos.Shop'
    '@controller': 'Admin'
    '@action': 'do'
    '@format': 'html'

How can I circumvent decoding the paylod? I've tried with '@format': 'json' too but without difference.

Any help is appreciated


Toco



More information about the Flow mailing list