Quantcast
Channel: Zimbra Forums
Viewing all articles
Browse latest Browse all 168

Developers • Passing JSON arrays to the SOAP webservices - possible bug?

$
0
0
Hi everyone,

when trying to pass arrays/lists of elements to the (admin) webservice as JSON, I noticed that only one of the elements actually makes it through the parsing stage in the webservice. When passing the request as XML however, everything works fine.
Is this a known issue? And is that maybe why the admin GUI gladly takes JSON responses, but sends XML requests to the webservice? :D

Example with AdminCreateWaitSet:

Code:

{    "Header": {        "context": { .... }    },    "Body": {        "AdminCreateWaitSetRequest": {            "_jsns": "urn:zimbraAdmin",            "add": [                {                    "a": {                        "folderInterests": "2",                        "name": "test_a@myzimbra",                        "types": "all"                    }                },                {                    "a": {                        "folderInterests": "2,5",                        "name": "test_b@myzimbra",                        "types": "all"                    }                }            ]        }    }}
In this example, only the second AdminCreateWaitSetRequest->add->a element is applied. I can see that by tracing through the ZCS source code while debugging remotely; and the WaitSet's behavior confirms that.

Another one, GetLoggerStats:

Code:

{    "Header": {        "context": { .... }        }    },    "Body": {        "GetLoggerStatsRequest": [            {                "_jsns": "urn:zimbraAdmin",                "endTime": {                    "time": "1692366330"                },                "startTime": {                    "time": "1692366180"                },                "stats": {                    "name": "cpu.csv",                    "values": [                        {                            "stat": {                                "name": "cpu:user"                            }                        },                        {                            "stat": {                                "name": "cpu:iowait"                            }                        }                    ]                }            }        ]    }}
In this example, only the first GetLoggerStatsRequest->stats->values->stat element is honored. The second one gets lost. I can see that during remote debugging and the webservice reponse reflects that as well.

I tried to find out whether this only affects the "zimbraAdmin" webservice, so I tried to cross-check with the "zimbraMail" service. One suitable example request I could find is ModifyContactRequest (with multiple ModifyContactRequest->cn->a elements).
This request works correctly, but looking at the Java code it turns out the request data is parsed in a different way and not like the aforementioned example requests in the admin service.

With XML requests however, there are no such problems.

Has anybody else noticed this? Am I on to something or am I just doing it wrong?
Thanks for any thoughts on this.

Statistics: Posted by leading zero — Sun Aug 20, 2023 9:47 am



Viewing all articles
Browse latest Browse all 168

Trending Articles