Forum Discussion

CamillaR's avatar
CamillaR
Occasional Contributor
4 years ago

Showing json response as xml, wrong value in xmlns

Hi,

 

I test a REST-service that respond with a json.

My request: GET https://develop-sys.test.abc.se/mom/19820224/201907

The json response looks fine, both i tab "JSON" and tab "Raw":

{
"period" : "201907",
"error" : false
}

 

Since I use ReadyApi I can select to show the response in xml format in the "XML" tab. The data that was in the json is correct also in the xml view.

But I get a different path in the xmlns-element than the one I sent the request to. A colleague even got another environment in the path.

<Response xmlns="https://develop-sys.test.abc.se/mom/19710518/202101">
    <period>201907</period>
    <error>false</error>
</Response>

 

Where does ReadyApi get the value for the xmlns element? I recognize the values because I have tested with those values also but not in my latest test. 

Has anyone else seen this behavior when showing a json response as xml?

 

Kind regards,

Camilla

  • Hey CamillaR,

    I suspect the issue is a cpnsequence of readyapi trying to convert your json response i to xml. If your datatype (Content-Type header) is json (e.g. application/json) readyapi converts your json responseto xml, and that is what your seeing.

    The xmlns attribute is typically includedin a schema and can have any value. Itsjust used so the elememts can have unique identifiers (nsmespace prefix). Your xmlns attribute doesnt include a prefix value so this is a default namespace.
    All thatboring stuff aside, you can ignore the contents of the xml tab if your content is json anyway.

    Hope this helps explain,

    Ta

    Rich
  • richie's avatar
    richie
    Community Hero
    Hey CamillaR,

    I suspect the issue is a cpnsequence of readyapi trying to convert your json response i to xml. If your datatype (Content-Type header) is json (e.g. application/json) readyapi converts your json responseto xml, and that is what your seeing.

    The xmlns attribute is typically includedin a schema and can have any value. Itsjust used so the elememts can have unique identifiers (nsmespace prefix). Your xmlns attribute doesnt include a prefix value so this is a default namespace.
    All thatboring stuff aside, you can ignore the contents of the xml tab if your content is json anyway.

    Hope this helps explain,

    Ta

    Rich
    • CamillaR's avatar
      CamillaR
      Occasional Contributor

      Yes, my response is json (Content-type application/json) so I suspected that I could ignore this. Thank's for the confirmation richie