Skip to content

jgh/scalaws

Repository files navigation

Purpose

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.

Goals

  • 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.

Installation

Install Maven

Maven is available bere:
http://maven.apache.org/download.html

Start jetty webserver on port 9090

Go to the root directory of the project and run:

>mvn jetty:run

Open UserDetails-soapui-project.xml with SoapUI.

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

Changing Database

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.

Install Oracle XE

Oracle XE can be downloaded from here
http://www.oracle.com/technology/products/database/xe/index.html

Create ‘test_user’ in local oracle database..

Run create-oracle.sql script.

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

Install Oracle DB driver into local maven repository

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

Add oracle driver to classpath.

In the pom.xml uncomment the oracle database driver dependency.

Change jetty configuration to point to oracle

Edit src/main/webapp/WEB-INF/jetty-env.xml
Uncomment the oracle datasource to point to a different database/user

To use another RDBMS

  1. Change the class name to an appropriate value: class=“oracle.jdbc.pool.OracleConnectionPoolDataSource”
  2. Update the jdbc connection string and user/password
    Modify the pom.xml dependencies to include the JDBC driver jar of your database.

About

Example SOAP webservice implemented in scala

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages