Forum Discussion

Sphujidhwaj's avatar
Sphujidhwaj
Contributor
9 years ago
Solved

How do I convert an XML Response into Java object? Can this be done in SoapUI by including jars?

I get an XML response can I convert it into Java Object by using Java API for XML Binding or XML into Java Bean so that it becomes easier to validate the response using objects.

 

Please help

6 Replies

    • Sphujidhwaj's avatar
      Sphujidhwaj
      Contributor

      If the response is simple one then assertions would suffice. But in my case the response is complex and adding so many assertions and maintaining them would be a herculean task. Hence I was looking for converting the response into Java object and then validating the same.

      • nmrao's avatar
        nmrao
        Champion Level 3

        Ok. If the question is only about validation of response, you can still use schema validation or compliance and this does not include any xpath or you require just a single assertion.

        When you talk about maintenance, that is applicable only when there are changes in the application. So, it is natural that if the behaviour of the application gets changed, obiviously, tests or assertions might change if you have xpath assertions etc provided the structure of response gets changes. But it is not so frequent, imo.

        Again that requires changes even if you use java. But it is up to the end users comfortability.

        As I mentioned in the initial response, it can be done. You can use java or groovy to do the same if you wish to do so.

        You should be able find in the forum for similar need, I remember answering few weeks back. Otherwise, I can dig it later and post it here.