Forum Discussion

raptor's avatar
raptor
Occasional Contributor
7 years ago
Solved

SOAP UI tutorial - Google API

Hi,

 

I am using the GOOGLE API to learn about SOAP UI.

https://www.soapui.org/tutorials/google-maps.html

 

When I imported the project and run the sample request, I dont see an xml response. Instead I see the response in text as "The content you are trying to view cannot be viewed as xml". Note that I see a json response.

 

Where am I going wrong? How to get the xml response correctly?

  • raptor,

     

    The api support both xml / json formats.

     

    User needs to provide it thru query parameter.

     

    In the resource, define a parameter format of TEMPLATE type.

     

    In the requests, provide the value for format.

     

    Please see the attachment for details.

     

     

    Hope this is clear.

3 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    raptor,

     

    The api support both xml / json formats.

     

    User needs to provide it thru query parameter.

     

    In the resource, define a parameter format of TEMPLATE type.

     

    In the requests, provide the value for format.

     

    Please see the attachment for details.

     

     

    Hope this is clear.

  • JHunt's avatar
    JHunt
    Community Hero

    These view options are just for the sake of pretty-printing the response to you (as the SoapUI user). Meaning it just applies colors, and alignment etc to make it easy to read. But it is not actually converting anything. And since the content is not XML, SoapUI won't try to pretty-print it as if it were.

     

    It is possible to convert the response to XML using Groovy. Here's one way to do it:

     

    Add an Assertion to the Test Request. Choose Script Assertion as the assertion type, and enter:

     

    log.info messageExchange.responseContentAsXml

    Then press the green Play button. The converted response will appear in the Script Log (at the bottom of your SoapUI workspace).

     

  • raptor's avatar
    raptor
    Occasional Contributor
    Thanks JHunt and nmrao for your replies. nmrao's screenshot helped me. All I had to do was just change the format from json to xml. Viola! Much appreciate the effort!