Script Library - messageExchange
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2008
04:10 AM
05-19-2008
04:10 AM
Script Library - messageExchange
Hi,
Is it possible to call the following from a method in the script library?
def response = messageExchange.responseContent
def soapVersion = messageExchange.operation.getInterface().soapVersion
I'm trying to externalise all my assertions for easier maintainence and I want to use the following to get the current response details in a testcase. I cannot get them to work in a preceeding groovy test step either. Any suggestions?
Cheers
Cormac
Is it possible to call the following from a method in the script library?
def response = messageExchange.responseContent
def soapVersion = messageExchange.operation.getInterface().soapVersion
I'm trying to externalise all my assertions for easier maintainence and I want to use the following to get the current response details in a testcase. I cannot get them to work in a preceeding groovy test step either. Any suggestions?
Cheers
Cormac
8 REPLIES 8
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2008
04:15 AM
05-19-2008
04:15 AM
Hi Cormac,
you need to get hold of the messageExchange and pass it to your method in the script-library.. from what context are you calling it?
regards,
/Ole
eviware.com
you need to get hold of the messageExchange and pass it to your method in the script-library.. from what context are you calling it?
regards,
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2008
04:48 AM
05-19-2008
04:48 AM
Hi Ole,
Excuse my ignorance my Java/Groovy skills are rubbish but i'm not really sure what you mean by what context I call it?
Cormac
Excuse my ignorance my Java/Groovy skills are rubbish but i'm not really sure what you mean by what context I call it?
Cormac
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2008
04:50 AM
05-19-2008
04:50 AM
Hi Cormac,
sorry, I should have been clearer. Are you calling this method from a Groovy Script Step? Or a Script Assertion? Or from "somewhere else"?
regards!
/Ole
eviware.com
sorry, I should have been clearer. Are you calling this method from a Groovy Script Step? Or a Script Assertion? Or from "somewhere else"?
regards!
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2008
05:01 AM
05-19-2008
05:01 AM
Hi Ole,
I'm calling the method from a script assertion (I tried to get it to work in a groovy script step also).
The idea is I have a number of scripted assertions as public methods in the external library. Some of the assertions require the Soap Version and Response to be passed as parameters. I was hoping that I could just create a couple of private methods which would retrieve this info for the request executed and I could call these methods as an alernative to passing the parameters. Hope this makes sense?
Cheers
Cormac
I'm calling the method from a script assertion (I tried to get it to work in a groovy script step also).
The idea is I have a number of scripted assertions as public methods in the external library. Some of the assertions require the Soap Version and Response to be passed as parameters. I was hoping that I could just create a couple of private methods which would retrieve this info for the request executed and I could call these methods as an alernative to passing the parameters. Hope this makes sense?
Cheers
Cormac
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2008
05:43 AM
05-19-2008
05:43 AM
Hi Cormac,
sure, this makes great sense! You'll need to pass the messageExchange as an argument to the method, from there your method can extract the remquired properties.. ok?
regards!
/Ole
eviware.com
sure, this makes great sense! You'll need to pass the messageExchange as an argument to the method, from there your method can extract the remquired properties.. ok?
regards!
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2008
06:19 AM
05-19-2008
06:19 AM
Thanks Ole,
Yeah this makes sense, this is what I have but I still get null returned.
import com.eviware.soapui.model.iface.*
private def getCurrentResponse(MessageExchange messageExchange){
return messageExchange.responseContent
}
Any suggestions?
Yeah this makes sense, this is what I have but I still get null returned.
import com.eviware.soapui.model.iface.*
private def getCurrentResponse(MessageExchange messageExchange){
return messageExchange.responseContent
}
Any suggestions?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2008
06:33 AM
05-19-2008
06:33 AM
Sorry,
I think I have this sorted now. I wasn't passing through the messageExchage arguement when I was calling the method. Should this not have thrown an error though?
Cheers
Cormac
I think I have this sorted now. I wasn't passing through the messageExchage arguement when I was calling the method. Should this not have thrown an error though?
Cheers
Cormac
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2008
03:08 PM
05-19-2008
03:08 PM
Hi!
hmm.. maybe.. due to its "dynamic nature", Groovy tries to "make the best of things" when executing.. I guess you still had syntactically correct code..
regards!
/Ole
eviware.com
hmm.. maybe.. due to its "dynamic nature", Groovy tries to "make the best of things" when executing.. I guess you still had syntactically correct code..
regards!
/Ole
eviware.com
