In my day job I write a lot of SOAP webservice using a variety of tools/frameworks/languages. I wrote this as a way to show how easily this can be done in scala.
- Functioning SOAP webservice
- Interacts with database
- 100 LOC (I went a little over)
- Show off features of scala language
- No libraries/frameworks just core scala code.
Maven is available bere:
http://maven.apache.org/download.html
Go to the root directory of the project and run:
>mvn jetty:run
SOAP UI is an free soap testing toolkit available here: http://www.soapui.org/
Or the wsdl is served from http://localhost:9090/UserDetails.wsdl
By default this project uses an embedded HSQL database. HSQL does not require any installation, it also does not preserve data between
restarts. The Bootstrap class creates the database tables on startup.
Alternatively you can use a Oracle XE database. If you are doing this disable the Bootstrap class by removing it from the
web.xml.
Oracle XE can be downloaded from here
http://www.oracle.com/technology/products/database/xe/index.html
This will create the database objects and populate some data
Note. this is an oracle specific script, for other RDBMS you will have to modify
Due to licensing issues the Oracle DB driver can not be installed into any public maven repositories
If installed Oracle XE is installed on windows driver will be here:
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar
Run maven install:
>mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar
Otherwise you can go here to download it:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
In the pom.xml uncomment the oracle database driver dependency.
Edit src/main/webapp/WEB-INF/jetty-env.xml
Uncomment the oracle datasource to point to a different database/user
To use another RDBMS
- Change the class name to an appropriate value: class=“oracle.jdbc.pool.OracleConnectionPoolDataSource”
- Update the jdbc connection string and user/password
Modify the pom.xml dependencies to include the JDBC driver jar of your database.