cancel
Showing results for 
Search instead for 
Did you mean: 

How do you convert SOAP Response to double or integer?

SOLVED
Highlighted
Regular Visitor

How do you convert SOAP Response to double or integer?

I am new to SOAPUI/Groovy.  I manage to connect to a web service and get a response.  I manage to see the response in groovy script.  The response is a string like "1.0966" and when I try to convert I get NumberFormatExpection.  Below is my code:

 

def conversionRate = context.expand( '${EuroConvertorRequest#Response#declare namespace ns1=\'http://tempuri.org/\'; //ns1:EuroConvertorResponse[1]}' )

double convertedNumber = Double.parseDouble(conversionRate);
log.info("Conversion Rate: " + convertedNumber);

 

Error message is: java.lang.NumberFormatException: For input string: " 1.0966 " error at line: 11

 

BUT, when I do double convertedNumber = Double.parseDouble("1.0966") it works fine then!!

 

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: How do you convert SOAP Response to double or integer?

1 REPLY 1
Highlighted
Community Hero

Re: How do you convert SOAP Response to double or integer?

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Filtering data retrieved from a DataSource

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors