Reply
New Contributor

Groovy script syntax error on 'context.expand' doesn't like '#' symbol

[ Edited ]

Hi All,

I am trying to setup a simple 2 step test where I want to write the response from a web service call, to a file on my C drive. But, soapui is giving me a groovy syntax error. It does not like the '#' symbol.

If my request object name is GetContractVersionListRequest, and I write a groovy script as so:

def response = context.expand( ‘${GetContractVersionListRequest#Response}’ ) 
new File( “C:/Groovy/” + “_response.txt” ).write( response )

Why am I getting the following syntax error?

Wed Feb 07 16:55:05 PST 2018:ERROR:An error occurred [startup failed: Script4.groovy: 1: unexpected char: '#' @ line 1, column 64. {GetContractVersionListRequest#Request}’ ^ org.codehaus.groovy.syntax.SyntaxException: unexpected char: '#' @ line 1, column 64.

 

What's wrong with this attached picture?  I'm using soapui 5.3.0 and Windows 10.

Community Leader

Re: Groovy script syntax error on 'context.expand' doesn't like '#' symbol

Were the quote characters changed from ' to curly ‘? Usually Word does that.

Check the double quotes on the next line as well.