TMenasco
11 years agoOccasional Contributor
REST JSON responses not being converted in XML consitently
Ok, I've got a curious problem, hoping for SmartBear support since I am a SoapUI Pro user. I have a situation where some JSON responses are being "translated" into XML, while others are not, wrecking havoc on my "success" assertions for test steps. I am working on some confidential stuff, so object names have been changed to protect the innocent.
Description:
Our fooList is a container for Foo's and their fooDetails for each. All requests have Accept - application/json HTTP headers set for all GET REST requests. Assertions with Xquery have been set for //*:Response/*:success of Y. Some work, others do not, even though the JSON formatted response has a "success": "Y" return. Some of the returns faithfully convert to XML, some do not. Here's an example of 2 different REST steps, calling same service, getting what looks to me to be VERY similar response object JSONs, but one generates XML to use for Xquery, the other does not.
First request return response JSON readout is:
"metadata": {
"request": "getFoo",
"user": "ba808d19-ba24-4a1c-a554-157424d776c4",
"version": "v1"
},
"id": null,
"success": "Y",
"resultCode": 1,
"message": null,
"errors": [],
"data": {"fooList": [{"fooDetail": {
"status": "ACTIVE",
"dateCreated": 1401214098304,
"dateUpdated": 1401214098304,
"userCreated": "ba808d19-ba24-4a1c-a554-157424d776c4",
"userUpdated": "ba808d19-ba24-4a1c-a554-157424d776c4",
"version": 1,
"compositeId": "5a7f0d2d-c2b3-46bf-b6e4-3dd65f9e5375#1392398806730#1392403599248#1392744390077#902e084e-73aa-4089-804f-848374c69554",
"projectId": "5a7f0d2d-c2b3-46bf-b6e4-3dd65f9e5375",
"ownerId": "ba808d19-ba24-4a1c-a554-157424d776c4",
"createDate": null,
"type": "S",
"description": null,
… yada yada, rest of Foo list of details for each foo. XML translation, as copied from the REST requests' response panel:
<data>
<fooList>
<e>
<fooDetail>
<compositeId>5a7f0d2d-c2b3-46bf-b6e4-3dd65f9e5375#1392744390059#a4d60838-d15d-4d5c-8ed3-7fba754a482d</compositeId>
<createDate null="true"/>
<dateCreated>1400464639749</dateCreated>
<dateUpdated>1400464639749</dateUpdated>
<description null="true"/>
… yada more XML describing the rest of the list as above.
Next request, calling a different Foo list, gives the following response JSON object:
{
"metadata": {
"request": "getFoo",
"user": "ba808d19-ba24-4a1c-a554-157424d776c4",
"version": "v1"
},
"id": null,
"success": "Y",
"resultCode": 1,
"message": null,
"errors": [],
"data": {"fooList": [
{"fooDetail": {
"status": "ACTIVE",
"dateCreated": 1400464639749,
"dateUpdated": 1400464639749,
"userCreated": "ba808d19-ba24-4a1c-a554-157424d776c4",
"userUpdated": "ba808d19-ba24-4a1c-a554-157424d776c4",
"version": 1,
"compositeId": "5a7f0d2d-c2b3-46bf-b6e4-3dd65f9e5375#1392744390059#a4d60838-d15d-4d5c-8ed3-7fba754a482d",
"projectId": "5a7f0d2d-c2b3-46bf-b6e4-3dd65f9e5375",
"ownerId": "ba808d19-ba24-4a1c-a554-157424d776c4",
"createDate": null,
"type": "S",
"description": null,
… yada yada more Foo list object details. Looks identical to me, but the XML translation returns as:
<xml/>
Nothing else. I check the full JSON structures, nothing violates the XML naming standards. I've searched the forum, bumpkis. Stumped. Anyone else seen this?
Description:
Our fooList is a container for Foo's and their fooDetails for each. All requests have Accept - application/json HTTP headers set for all GET REST requests. Assertions with Xquery have been set for //*:Response/*:success of Y. Some work, others do not, even though the JSON formatted response has a "success": "Y" return. Some of the returns faithfully convert to XML, some do not. Here's an example of 2 different REST steps, calling same service, getting what looks to me to be VERY similar response object JSONs, but one generates XML to use for Xquery, the other does not.
First request return response JSON readout is:
"metadata": {
"request": "getFoo",
"user": "ba808d19-ba24-4a1c-a554-157424d776c4",
"version": "v1"
},
"id": null,
"success": "Y",
"resultCode": 1,
"message": null,
"errors": [],
"data": {"fooList": [{"fooDetail": {
"status": "ACTIVE",
"dateCreated": 1401214098304,
"dateUpdated": 1401214098304,
"userCreated": "ba808d19-ba24-4a1c-a554-157424d776c4",
"userUpdated": "ba808d19-ba24-4a1c-a554-157424d776c4",
"version": 1,
"compositeId": "5a7f0d2d-c2b3-46bf-b6e4-3dd65f9e5375#1392398806730#1392403599248#1392744390077#902e084e-73aa-4089-804f-848374c69554",
"projectId": "5a7f0d2d-c2b3-46bf-b6e4-3dd65f9e5375",
"ownerId": "ba808d19-ba24-4a1c-a554-157424d776c4",
"createDate": null,
"type": "S",
"description": null,
… yada yada, rest of Foo list of details for each foo. XML translation, as copied from the REST requests' response panel:
<data>
<fooList>
<e>
<fooDetail>
<compositeId>5a7f0d2d-c2b3-46bf-b6e4-3dd65f9e5375#1392744390059#a4d60838-d15d-4d5c-8ed3-7fba754a482d</compositeId>
<createDate null="true"/>
<dateCreated>1400464639749</dateCreated>
<dateUpdated>1400464639749</dateUpdated>
<description null="true"/>
… yada more XML describing the rest of the list as above.
Next request, calling a different Foo list, gives the following response JSON object:
{
"metadata": {
"request": "getFoo",
"user": "ba808d19-ba24-4a1c-a554-157424d776c4",
"version": "v1"
},
"id": null,
"success": "Y",
"resultCode": 1,
"message": null,
"errors": [],
"data": {"fooList": [
{"fooDetail": {
"status": "ACTIVE",
"dateCreated": 1400464639749,
"dateUpdated": 1400464639749,
"userCreated": "ba808d19-ba24-4a1c-a554-157424d776c4",
"userUpdated": "ba808d19-ba24-4a1c-a554-157424d776c4",
"version": 1,
"compositeId": "5a7f0d2d-c2b3-46bf-b6e4-3dd65f9e5375#1392744390059#a4d60838-d15d-4d5c-8ed3-7fba754a482d",
"projectId": "5a7f0d2d-c2b3-46bf-b6e4-3dd65f9e5375",
"ownerId": "ba808d19-ba24-4a1c-a554-157424d776c4",
"createDate": null,
"type": "S",
"description": null,
… yada yada more Foo list object details. Looks identical to me, but the XML translation returns as:
<xml/>
Nothing else. I check the full JSON structures, nothing violates the XML naming standards. I've searched the forum, bumpkis. Stumped. Anyone else seen this?