Info on SoapUI Mockup server:
- general: http://www.soapui.org/Service-Mocking/mocking-soap-services.html
- howto: http://www.soapui.org/Getting-Started/mock-services.html
- video: http://addicted2webdesign.com/2010/07/soapui-mock-service-mp4/
To make it even transparent, place an Apache webserver in front of the OSB/SOA and mock-up server and let Apache decide of the service call is being executed on the OSB/SOA server or on the mock-up server.
With de deploy server (your workstation or a central deploy server) you deploy your OSB and/or SOA artefacts as normally to the server. You also deploy your SoapUI project to the mock-up server.
With Apache you control via rewrite rules if the request for tht service is passed to the OSB/SOA Server or to the mock-up server.
Apache Rewrite
To rewrite your request to the OSB/SOA server or the Mockup server is done in the Apache config file. Create a separate file to read this. Here is an example
# # This files shows the list of services that are being stubbed/mock-uped. # # # GENERIC, DO NOT CHANGE # LoadModule proxy_module modules/mod_proxy.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule proxy_http_module modules/mod_proxy_http.so # Enable rewrite engine RewriteEngine On RewriteLogLevel 9 RewriteLog /data/www/logs/stub_rewrite.log # # # OFF: GENERIC, DO NOT CHANGE # # Add here your stubbed services # RewriteRule ^/MyProject/MyService http://mockupserver.vijfhuizen.com:8080/MyProject/MyService [P]
SoapUI Mockup Server
A lot of discussing is going on on the SOapUI mockup server how to start and stop it as a background process. Here is a script to stop and start this in the background.
#!/bin/bash # # soapui_mockupserver: Start the Eviware SoapUI Mockup Server # # chkconfig: 23 99 5 # description: Start the Eviware SoapUI Mockup Server # # # Source function library. . /etc/rc.d/init.d/functions SOAPPID=`ps -ef | grep mockservicerunner.sh | grep -v grep | awk ' { print $2 }'` BAD_USER="This script should be run as root or as weblogic user. Exiting......." if [ "$USER" != 'root' -a "$USER" != 'weblogic' -a "$USER" != '' ]; then echo $BAD_USER && exit 1;fi if [ "$USER" == 'root' -o "$USER" == '' ]; then SOAPUI_DIR=`su - weblogic -c 'echo $SOAPUI_DIR'`;fi cd $SOAPUI_DIR/bin start() { echo -n $"Starting $0" if [ "$USER" == 'root' -o "$USER" == '' ]; then su -c 'nohup $SOAPUI_DIR/bin/mockservicerunner.sh /data/mockup/mockup-services-soapui-project.xml -p 8080 -Djava.awt.headless=true -f /data/mockup/output 2>&1 &' - weblogic else nohup $SOAPUI_DIR/bin/mockservicerunner.sh /data/mockup/mockup-services-soapui-project.xml -p 8080 -Djava.awt.headless=true -f /data/mockup/output 2>&1 & fi echo echo "Restart Apache gracefully..." for i in `ls /etc/init.d/*fon` do echo $i graceful $i graceful done } stop() { echo -n $"Shutting down $0" for i in `ps -ef | grep soap | grep -v $0 | awk ' { print $2 }'` do echo -n " $i" kill -9 $i done unset SOAPPID echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop; start ;; condrestart) stop; start; ;; status) if [ $SOAPPID ]; then echo "Running"; else echo "Not running";fi ;; *) echo $"Usage: $0 {start|stop|restart|reload|condrestart}" exit 1 esac exit 0