Spring JDBC WS
Spring JDBC WS
Java Programming
Languages in Depth Series
JDBC
Spring Framework
Web Services
Marco Piccioni
May 31st 2007
What will we be talking about
Web Services
J
D JDBC ODBC Bridge
Java B Driver
code C
+ SQL JDBC
A Driver
P
I RDBMS
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”)
Architectural model
Centralized configuration
New requirements
Our application should support a simple, flexible
mechanism for changing the message, and
It should be simple to change the rendering
behavior.
<<interface>>
MessageRenderer <<interface>>
+setMessageProvider() MessageProvider
+getMessageProvider() +getMessage()
+render()
StandardOutMessageRenderer HelloWorldMessageProvider
+setMessageProvider() +getMessage()
+getMessageProvider()
+render()
class=“ch.ethz.inf.java.hello.StandardOutMessageRen
derer">
<property name="messageProvider">
<ref local="provider"/>
</property>
</bean>
<bean id="provider"
class="ch.ethz.inf.java.hello.HelloWorldMessageProv
ider"/>
</bean></beans> 29
Java Programming: Spring Framework and JDBC
Kinds of dependency handling
Dependency lookup
Dependency pull
private ConfigurableMessageProvider(String
message)
{
this.message=message;
}
…
<bean id="provider"
class="ch.ethz.inf.java.hello.Configurab
leMessageProvider">
<constructor-arg>
<value>This is a configurable
message</value>
</constructor-arg>
</bean>
…
When yes:
Shared objects with no state
Shared objects with read-only state
Shared objects with shared state (use synchronization)
When there are only a few writings
When many objects are created
When creation is expensive
Synchronization granularity should be high
When no:
Message-wrapping format
Contract-Last approach
Write (Java) code first (interfaces) , and let the
Web Service contract (WSDL) be generated from
that
Contract-First approach
Write contract (WSDL) first, and use the language
(Java) to implement that contract
Fragility
Performance
Reusability
Versioning
Unportable types
e.g. java.util.TreeMap, time and dates
Cyclic graphs
A refers to B that refers to A
http://static.springframework.org/spring-
ws/site/reference/html/tutorial.html
http://www.springframework.org
http://static.springframework.org/spring-ws/site/
http://www.w3.org/TR/ws-arch
http://ws.apache.org/axis
http://www.w3schools.com/xml/default.asp
http://www.w3schools.com/schema/default.asp
http://www.w3schools.com/soap/default.asp
http://www.w3schools.com/wsdl/default.asp
http://www.soapui.org/