cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP UI 5.0-groovy Automation

Community Hero

Re: SOAP UI 5.0-groovy Automation

Please look at my previous reply and respond accordingly.


Regards,
Rao.
Occasional Contributor

Re: SOAP UI 5.0-groovy Automation

SOAP RESPONSE 1:

<?xml version="1.0"?>

<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">

<soap:Body>
<m:basicObj xmlns:m="https://www.w3schools.com/prices">
<mSmiley TongueersonId>22345</mSmiley TongueersonId>
<mSmiley TongueersonType>M</mSmiley TongueersonType>
</m:basicObj>
<n:addressObj xmlns:n="https://www.w3schools.com/address">
<n:addressLine1>Rajaji nagar</n:addressLine1>
<n:city>Mumbai</n:city>
<nSmiley TongueinCode>245321</nSmiley TongueinCode>

</n:addressObj>
</soap:Body>

 

SOAP RESPONSE 2:

<?xml version="1.0"?>

<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">

<soap:Body>
<m1:basicObject xmlns:m1="https://www.w3schools.com/prices">
<m1Smiley TongueersonIdentification>22345</m1Smiley TongueersonIdentification>
<m1:AdminPersonType>M</m1:AdminPersonType>
</m1:basicObject>
<m1:basicObject xmlns:m1="https://www.w3schools.com/prices">
<m1Smiley TongueersonIdentification>12456</m1Smiley TongueersonIdentification>
<m1:AdminPersonType>F</m1:AdminPersonType>
</m1:basicObject>
<k:addressObject xmlns:k="https://www.w3schools.com/address">
<k:address>Rajaji nagar</k:address>
<k:cityAddress>Mumbai</k:cityAddress>
<k:stateAddress>DF</k:stateAddress>
<kSmiley Tonguein>245321</kSmiley Tonguein>
</k:addressObject>
</soap:Body>

</soap:Envelope>

</soap:Envelope>

 

 

Now I wanted to compare personId with personIdentification i.e if 22345(personId from response 1) is present in response2 I wanted to display both personId:22345 and personIdentification:22345 along with the tagNames in excel sheet.

Expected output:

 

basicObj basicObject
personId=22345 personIdentification=22345
personType=M AdminPersonType=M
addressObj addressObject
addressLine1=Rajaji nagar address=Rajaji nagar
city=Mumbai cityAddress=Mumbai
pinCode=245321 pin=245321
   

If the data(1st response) is present in 2nd response it should give the corresponding element with tag name from 2nd response.If not, display only data(1st response) with tag name.

 

I have only id value if I hit that id in the wsdl, different id's will produce different responses.I will not know the tagNames and tagValues before hitting the wsdl.

NOTE: I will hit the two wsdl's with same id, only then corresponding data will come but in different tagNames, that is were problem starts. i have to compare responses and give the result.

 

Now you are clear with the problem?

Occasional Contributor

Re: SOAP UI 5.0-groovy Automation

sorry those smileys are actually : P that is why it got messed up...

Occasional Contributor

Re: SOAP UI 5.0-groovy Automation

I have given the data please do review

Occasional Contributor

Re: SOAP UI 5.0-groovy Automation

Community Hero

Re: SOAP UI 5.0-groovy Automation

People don't get time to formulate your message and create xml out of it.

It would be helpful if you can post exact xml structure that you are dealing with.


Regards,
Rao.
Occasional Contributor

Re: SOAP UI 5.0-groovy Automation

Hey I forgot to mention this I cant give you the exact response It is in separate server I dont have internet access over there

 

Community Hero

Re: SOAP UI 5.0-groovy Automation

@Mohan_hbk,
Hope nobody interested in your data. It is only for representational purpose, so that you wont stuck again with solution if you can't apply the solution for yourself and adopt the required changes.

Had the samples provided in the initial request, lot of time have been saved.

Anyways, hope you provided the sample data in the same structure as you get though it needed not be the exactly same.

Here is the groovy script and follow the comments inside the script
https://github.com/nmrao/soapUIGroovyScripts/blob/master/groovy/compare/CompareTwoDiffXmls.groovy


Regards,
Rao.
Occasional Contributor

Re: SOAP UI 5.0-groovy Automation

Hi really sorry I am not able to give the original response but still i have made an fake response resembling the same which I am working...

 

I that code u have defined map with sample data what If I dont know the response tagNames?

How to do dynamically?@nmrao

Community Hero

Re: SOAP UI 5.0-groovy Automation

If you don't know, then how do you compare? Even manually?


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors