< Prev - Examples - Next >

Spring HTTP-Remoting Connector Builder

This example is based on the inherited objects example. The calling api is always identical in any PL/SQL Connector Builder.

Spring Server Configuration

Configure the datasource. The datasource name is identical to the name defined in the connector builder.
XML-File : src/main/webapp/WEB-INF/serviceDataSource-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
	<bean
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location">
			<value>classpath:service.properties</value>
		</property>
	</bean>

	<bean id="serviceDataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
		<property name="url" value="${jdbc.url}" />
		<property name="username" value="${jdbc.user}" />
		<property name="password" value="${jdbc.password}" />
	</bean>
</beans>
Configure the web.xml file to access the datasource and the services created by the connector builder.

This line adds the datasource and the service : <param-value>/WEB-INF/serviceDataSource-ds.xml /WEB-INF/service-servlet.xml</param-value>

XML-File : src/main/webapp/WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="WebApp_ID" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
  <display-name>service</display-name>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/serviceDataSource-ds.xml /WEB-INF/service-servlet.xml</param-value>
  </context-param>
  <servlet>
    <servlet-name>service</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>service</servlet-name>
    <url-pattern>/service/*</url-pattern>
  </servlet-mapping>
</web-app>

Client Configuration

The context parameter are defined in the resource file service-context.xml and service.properties . This is the configuration for the service factory.
XML-File : service-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

		<property name="locations">
			<list>
				<value>classpath:service.properties</value>
			</list>
		</property>
	</bean>
</beans>
XML-File : service.properties
service.server.address=localhost
service.server.port=9090
service.server.webapp=embeddedTomcat
service.server.context=service

Running The Example

  • Start the program StartEmbeddedTomcat in the server project.
  • Run the client program InheritedObjects to call the PL/SQL stored procedure remote from your client.

< Prev - Examples - Next >