Listeners - Modifying Requests before posting to a Service
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2008
09:11 AM
04-24-2008
09:11 AM
Listeners - Modifying Requests before posting to a Service
Hi,
We have a large number of optional elements in our Service requests. One of the issues I am coming accross regularly is a number of them cannot be passed as empty tags due to the type declaration.
We have build a framework driven from excel datasheets but we don't want to have to build large numbers of template requests based on different business rules.
Is there a way of only stripping the empty optional elements before a request is sent to the service? Does SoapUI Pro have this functionality or do I need to script something to handle it?
One way I thought would be to have a listener that calls a script to remove any empty elements from the request by default unless specified in the datasheet. Is this possible? I can't find any examples of using a listener on a particular test step or any examples of where I would start.
Thanks
Darren
We have a large number of optional elements in our Service requests. One of the issues I am coming accross regularly is a number of them cannot be passed as empty tags due to the type declaration.
We have build a framework driven from excel datasheets but we don't want to have to build large numbers of template requests based on different business rules.
Is there a way of only stripping the empty optional elements before a request is sent to the service? Does SoapUI Pro have this functionality or do I need to script something to handle it?
One way I thought would be to have a listener that calls a script to remove any empty elements from the request by default unless specified in the datasheet. Is this possible? I can't find any examples of using a listener on a particular test step or any examples of where I would start.
Thanks
Darren
16 REPLIES 16
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2008
01:05 AM
05-27-2008
01:05 AM
Hi Darren,
ok.. could we do a webex session so I can have a closer look at your setup/configuration to see what is happening? If so, please mail me at ole@eviware.com and I'll invite..
Sorry for the inconvenience..
regards!
/Ole
eviware.com
ok.. could we do a webex session so I can have a closer look at your setup/configuration to see what is happening? If so, please mail me at ole@eviware.com and I'll invite..
Sorry for the inconvenience..
regards!
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2008
01:08 AM
05-27-2008
01:08 AM
Hi Ole,
I had an older version of SoapUI Pro on the machine which I removed, plus I removed all my scripts. I now get teh following error at startup.
09:05:36,752 INFO [DefaultSoapUICore] Adding listeners from [C:\Program Files\e
viware\soapUI-Pro-2.0.3\bin\listeners\demo-listeners.xml]
Error initializing Listener: java.lang.RuntimeException: Listener class: soapui.
demo.DemoListener must implement interface: com.eviware.soapui.model.testsuite.T
estRunListener
Makes a bit more sense now.
Cheers
Darren
I had an older version of SoapUI Pro on the machine which I removed, plus I removed all my scripts. I now get teh following error at startup.
09:05:36,752 INFO [DefaultSoapUICore] Adding listeners from [C:\Program Files\e
viware\soapUI-Pro-2.0.3\bin\listeners\demo-listeners.xml]
Error initializing Listener: java.lang.RuntimeException: Listener class: soapui.
demo.DemoListener must implement interface: com.eviware.soapui.model.testsuite.T
estRunListener
Makes a bit more sense now.
Cheers
Darren
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2008
01:13 AM
05-27-2008
01:13 AM
Hi Darren,
duh.. the fault is mine.. the config should be
listenerInterface="com.eviware.soapui.impl.wsdl.submit.RequestFilter" />
works better?
regards,
/Ole
eviware.com
duh.. the fault is mine.. the config should be
listenerInterface="com.eviware.soapui.impl.wsdl.submit.RequestFilter" />
works better?
regards,
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2008
01:39 AM
05-27-2008
01:39 AM
Hi Ole,
Thanks for that, it now appears to be running the filter. Any way of checking if the correct request is being sent?
I've tried adding
SoapUI.log.info("request sent: "+context.getProperty( BaseHttpRequestTransport.REQUEST_CONTENT ))
after the new message is set but that prints the request unmodified. Is this correct, if so then I must have a problem with the filter?
Cheers
Darren
Thanks for that, it now appears to be running the filter. Any way of checking if the correct request is being sent?
I've tried adding
SoapUI.log.info("request sent: "+context.getProperty( BaseHttpRequestTransport.REQUEST_CONTENT ))
after the new message is set but that prints the request unmodified. Is this correct, if so then I must have a problem with the filter?
Cheers
Darren
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2008
01:44 AM
05-27-2008
01:44 AM
Hi Darren,
hmm again 🙂 In what does this not work? Gives an error? Shows the wrong request? etc..
regards!
/Ole
eviware.com
hmm again 🙂 In what does this not work? Gives an error? Shows the wrong request? etc..
regards!
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2008
01:55 AM
05-27-2008
01:55 AM
Hi Ole,
Oh yeah sorry if I add --empty-- in an element I would expect that element to be stripped out of the request. For example,
MDUserDescTyMeteor
MDAppDescTyWeb
MDAppIDTyMDS
--empty--
--empty--
I would expect the following request to be sent,
MDUserDescTyMeteor
MDAppDescTyWeb
MDAppIDTyMDS
If I add that extra line in the filter, after the setProperty call,
SoapUI.log.info("request sent: "+context.getProperty( BaseHttpRequestTransport.REQUEST_CONTENT ))
I would expect the updated request to be printed to the log?
Cheers
Darren
Oh yeah sorry if I add --empty-- in an element I would expect that element to be stripped out of the request. For example,
I would expect the following request to be sent,
If I add that extra line in the filter, after the setProperty call,
SoapUI.log.info("request sent: "+context.getProperty( BaseHttpRequestTransport.REQUEST_CONTENT ))
I would expect the updated request to be printed to the log?
Cheers
Darren
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2008
12:41 AM
05-29-2008
12:41 AM
Hi Darren,
unless you've changed the code, it should be "--remove--", not "--empty--". Is that it?
regards!
/Ole
eviware.com
unless you've changed the code, it should be "--remove--", not "--empty--". Is that it?
regards!
/Ole
eviware.com

- « Previous
-
- 1
- 2
- Next »
- « Previous
-
- 1
- 2
- Next »