You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2006/11/10 06:06:20 UTC

svn commit: r473190 - in /webservices/axis2/branches/java/1_1/modules/samples: axis2pojo/ axis2pojo/src/ axis2pojo/src/META-INF/ axis2pojo/src/sample/ axis2pojo/src/sample/pojo/ axis2pojo/src/sample/pojo/data/ axis2pojo/src/sample/pojo/rpcclient/ axis2...

Author: chatra
Date: Thu Nov  9 21:06:16 2006
New Revision: 473190

URL: http://svn.apache.org/viewvc?view=rev&rev=473190
Log:
added source for the pojo.html (POJO Web Services using Apache Axis2) in xdocs

Added:
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/build.xml
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/META-INF/
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/META-INF/services.xml
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/data/
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/data/Weather.java
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/rpcclient/
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/rpcclient/WeatherRPCClient.java
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/service/
    webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/service/WeatherService.java
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/build.xml
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/META-INF/
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/META-INF/services.xml
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/applicationContext.xml
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/client/
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/client/WeatherSpringRPCClient.java
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/lib/
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/bean/
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/bean/Weather.java
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/SpringInit.java
    webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/WeatherSpringService.java

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/build.xml?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/build.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/build.xml Thu Nov  9 21:06:16 2006
@@ -0,0 +1,73 @@
+
+<project basedir="." default="generate.service">
+
+	<property name="dest.dir" value="build" />
+	<property name="dest.dir.classes" value="${dest.dir}/WeatherService" />
+	<property name="dest.dir.lib" value="${dest.dir}/lib" />
+	<property name="axis2.home" value="c:\apps\axis2" />
+
+	<path id="build.class.path">
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+	</path>
+
+	<path id="client.class.path">
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+		<fileset dir="${dest.dir.lib}">
+			<include name="*.jar" />
+		</fileset>
+
+	</path>
+	<target name="clean">
+		<delete dir="${dest.dir}" />
+		<delete dir="src" includes="sample/pojo/stub/**"/>
+	</target>
+
+	<target name="prepare">
+		<mkdir dir="${dest.dir}" />
+		<mkdir dir="${dest.dir}/lib" />
+		<mkdir dir="${dest.dir.classes}" />
+		<mkdir dir="${dest.dir.classes}/META-INF" />
+	</target>
+
+	<target name="generate.service" depends="clean,prepare">
+
+		<copy file="src/META-INF/services.xml" tofile="${dest.dir.classes}/META-INF/services.xml" overwrite="true" />
+
+		<javac srcdir="src" destdir="${dest.dir.classes}" includes="sample/pojo/service/**,sample/pojo/data/**">
+			<classpath refid="build.class.path" />
+		</javac>
+	</target>
+
+	<target name="rpc.client" depends="clean,prepare">
+
+		<antcall target="rpc.client.compile" />
+
+		<antcall target="rpc.client.jar" />
+
+		<antcall target="rpc.client.run">
+			<param name="uri" value="${uri}"/>
+		</antcall>
+
+	</target>
+
+	<target name="rpc.client.compile">
+		<javac srcdir="src" destdir="${dest.dir.classes}" includes="sample/pojo/rpcclient/**,sample/pojo/data/**">
+			<classpath refid="build.class.path" />
+		</javac>
+	</target>
+
+	<target name="rpc.client.jar">
+		<jar basedir="${dest.dir.classes}" destfile="${dest.dir.lib}/rpc-client.jar" includes="sample/pojo/rpcclient/**,sample/pojo/data/**" />
+	</target>
+
+	<target name="rpc.client.run">
+		<java classname="sample.pojo.rpcclient.WeatherRPCClient">
+			<classpath refid="client.class.path" />
+			<arg value="${uri}" />
+		</java>
+	</target>
+</project>

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/META-INF/services.xml?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/META-INF/services.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/META-INF/services.xml Thu Nov  9 21:06:16 2006
@@ -0,0 +1,13 @@
+<service name="WeatherService" scope="application">
+    <description>
+        Weather POJO Service
+    </description>
+    <messageReceivers>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+                         class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+                         class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
+    </messageReceivers>
+    <parameter name="ServiceClass" locked="false">sample.pojo.service.WeatherService</parameter>
+
+</service>

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/data/Weather.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/data/Weather.java?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/data/Weather.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/data/Weather.java Thu Nov  9 21:06:16 2006
@@ -0,0 +1,40 @@
+package sample.pojo.data;
+
+public class Weather{
+    float temperature;
+    String forecast;
+    boolean rain;
+    float howMuchRain;
+    
+    public void setTemperature(float temp){
+        temperature = temp;
+    }
+
+    public float getTemperature(){
+        return temperature;
+    }
+    
+    public void setForecast(String fore){
+        forecast = fore;
+    }
+
+    public String getForecast(){
+        return forecast;
+    }
+    
+    public void setRain(boolean r){
+        rain = r;
+    }
+
+    public boolean getRain(){
+        return rain;
+    }
+    
+    public void setHowMuchRain(float howMuch){
+        howMuchRain = howMuch;
+    }
+
+    public float getHowMuchRain(){
+        return howMuchRain;
+    }
+}
\ No newline at end of file

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/rpcclient/WeatherRPCClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/rpcclient/WeatherRPCClient.java?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/rpcclient/WeatherRPCClient.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/rpcclient/WeatherRPCClient.java Thu Nov  9 21:06:16 2006
@@ -0,0 +1,68 @@
+package sample.pojo.rpcclient;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.rpc.client.RPCServiceClient;
+
+import sample.pojo.data.Weather;
+
+
+public class WeatherRPCClient {
+
+    public static void main(String[] args1) throws AxisFault {
+
+        RPCServiceClient serviceClient = new RPCServiceClient();
+
+        Options options = serviceClient.getOptions();
+
+        EndpointReference targetEPR = new EndpointReference(
+                "http://localhost:8080/axis2/services/WeatherService");
+        options.setTo(targetEPR);
+
+        // Setting the weather
+        QName opSetWeather = new QName("http://service.pojo.sample/xsd", "setWeather");
+
+        Weather w = new Weather();
+
+        w.setTemperature((float)39.3);
+        w.setForecast("Cloudy with showers");
+        w.setRain(true);
+        w.setHowMuchRain((float)4.5);
+
+        Object[] opSetWeatherArgs = new Object[] { w };
+
+        serviceClient.invokeRobust(opSetWeather, opSetWeatherArgs);
+
+
+        // Getting the weather
+        QName opGetWeather = new QName("http://service.pojo.sample/xsd", "getWeather");
+
+        Object[] opGetWeatherArgs = new Object[] { };
+        Class[] returnTypes = new Class[] { Weather.class };
+        
+        
+        Object[] response = serviceClient.invokeBlocking(opGetWeather,
+                opGetWeatherArgs, returnTypes);
+        
+        Weather result = (Weather) response[0];
+        
+        if (result == null) {
+            System.out.println("Weather didn't initialize!");
+            return;
+        }
+        
+        // Displaying the result
+        System.out.println("Temperature               : " +
+                           result.getTemperature());
+        System.out.println("Forecast                  : " +
+                           result.getForecast());
+        System.out.println("Rain                      : " +
+                           result.getRain());
+        System.out.println("How much rain (in inches) : " +
+                           result.getHowMuchRain());
+        
+    }
+}

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/service/WeatherService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/service/WeatherService.java?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/service/WeatherService.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2pojo/src/sample/pojo/service/WeatherService.java Thu Nov  9 21:06:16 2006
@@ -0,0 +1,15 @@
+package sample.pojo.service;
+
+import sample.pojo.data.Weather;
+
+public class WeatherService{
+    Weather weather;
+    
+    public void setWeather(Weather weather){
+        this.weather = weather;
+    }
+
+    public Weather getWeather(){
+        return this.weather;
+    }
+}
\ No newline at end of file

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/build.xml?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/build.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/build.xml Thu Nov  9 21:06:16 2006
@@ -0,0 +1,111 @@
+<project basedir="." default="build" name="WeatherSpringService">
+
+    <property environment="env"/>
+    <property name="service-name" value="WeatherSpringService.aar"/>
+    <property name="dest.dir" value="target"/>
+    <property name="axis2.home" value="c:\apps\axis2" />
+
+	<property name="repository.path" value="${axis2.home}/repository/services" />
+
+    <property name="dest.dir.classes" value="${dest.dir}/classes"/>
+
+    <property name="dest.dir.lib" value="${dest.dir}/lib"/>
+    <property name="catalina-modules"
+              value="${env.CATALINA_HOME}/webapps/axis2/WEB-INF/services"/>
+
+    <path id="build.class.path">
+        <fileset dir="${axis2.home}/lib">
+            <include name="*.jar"/>
+        </fileset>
+        <fileset dir="src/lib">
+            <include name="*.jar"/>
+        </fileset>
+    </path>
+
+    <target name="clean">
+        <delete dir="${dest.dir}"/>
+    </target>
+
+    <target name="prepare" depends="clean">
+
+        <mkdir dir="${dest.dir}"/>
+
+        <mkdir dir="${dest.dir.classes}"/>
+
+        <mkdir dir="${dest.dir.classes}/META-INF"/>
+
+    </target>
+
+    <target name="build" depends="prepare">
+
+        <mkdir dir="${dest.dir}"/>
+
+        <mkdir dir="${dest.dir.classes}"/>
+        <mkdir dir="${dest.dir.classes}/lib"/>
+        <mkdir dir="${dest.dir.classes}/META-INF"/>
+
+        <copy file="src/applicationContext.xml"
+              todir="${dest.dir.classes}"
+              overwrite="true"/>
+
+        <copy file="src/META-INF/services.xml"
+              tofile="${dest.dir.classes}/META-INF/services.xml"
+              overwrite="true"/>
+
+        <copy todir="target/classes/lib">
+          <fileset dir="src/lib"/>
+        </copy>
+
+        <javac debug="on" srcdir="src" destdir="${dest.dir.classes}" includes="sample/**">
+            <classpath refid="build.class.path"/>
+        </javac>
+
+        <jar basedir="${dest.dir.classes}"
+             destfile="${dest.dir}/${service-name}"/>
+
+    </target>
+
+     <target name="generate.service" depends="prepare">
+
+        <mkdir dir="${dest.dir}"/>
+
+        <mkdir dir="${dest.dir.classes}"/>
+        <mkdir dir="${dest.dir.classes}/META-INF"/>
+
+        <copy file="src/META-INF/services.xml"
+              tofile="${dest.dir.classes}/META-INF/services.xml"
+              overwrite="true"/>
+
+        <javac debug="on" srcdir="src" destdir="${dest.dir.classes}" includes="sample/**">
+            <classpath refid="build.class.path"/>
+        </javac>
+
+        <jar basedir="${dest.dir.classes}"
+             destfile="${repository.path}/${service-name}"/>
+
+    </target>
+
+
+
+    <target name="run.client" depends="prepare">
+        <mkdir dir="${dest.dir}"/>
+        <mkdir dir="${dest.dir.classes}"/>
+
+        <javac debug="on" srcdir="src" destdir="${dest.dir.classes}" includes="client/**">
+            <classpath refid="build.class.path"/>
+        </javac>
+
+        <java classname="client.WeatherSpringRPCClient">
+            <classpath>
+                <pathelement location="${dest.dir.classes}"/>
+                <fileset dir="${axis2.home}/lib">
+                    <include name="*.jar"/>
+                </fileset>
+            </classpath>
+        </java>
+	</target>
+    <target name="copy.to.tomcat" depends="build">
+        <copy file="${dest.dir}/${service-name}" todir="${catalina-modules}"/>
+    </target>
+
+</project>

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/META-INF/services.xml?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/META-INF/services.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/META-INF/services.xml Thu Nov  9 21:06:16 2006
@@ -0,0 +1,27 @@
+<serviceGroup>
+  <service name="SpringInit" class="sample.spring.service.SpringInit">
+    <description>
+      This web service initializes Spring.
+    </description>
+    <parameter name="ServiceClass" locked="false">sample.spring.service.SpringInit</parameter>
+    <parameter name="ServiceTCCL" locked="false">composite</parameter>
+    <parameter name="load-on-startup" locked="false">true</parameter>
+    <operation name="springInit">
+      <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+    </operation>
+  </service>
+  <service name="WeatherSpringService">
+    <description>
+      Weather Spring POJO Axis2 AAR deployment
+    </description>
+    <parameter name="ServiceClass" locked="false">sample.spring.service.WeatherSpringService</parameter>
+    <parameter name="ServiceObjectSupplier" locked="false">org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier</parameter>
+    <parameter name="SpringBeanName" locked="false">weatherSpringService</parameter>
+    <messageReceivers>
+      <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+                       class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
+      <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+                       class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
+    </messageReceivers>
+  </service>
+</serviceGroup>

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/applicationContext.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/applicationContext.xml?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/applicationContext.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/applicationContext.xml Thu Nov  9 21:06:16 2006
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+  <bean id="applicationContext" 
+    class="org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder" />
+
+  <bean id="weatherSpringService" class="sample.spring.service.WeatherSpringService">
+    <property name="weather" ref="weatherBean"/>
+  </bean>
+
+  <bean id="weatherBean" class="sample.spring.bean.Weather">
+    <property name="temperature" value="89.9"/>
+    <property name="forecast" value="Sunny"/>
+    <property name="rain" value="false"/>
+    <property name="howMuchRain" value="0.2"/>
+  </bean>
+</beans>

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/client/WeatherSpringRPCClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/client/WeatherSpringRPCClient.java?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/client/WeatherSpringRPCClient.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/client/WeatherSpringRPCClient.java Thu Nov  9 21:06:16 2006
@@ -0,0 +1,50 @@
+package client;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.rpc.client.RPCServiceClient;
+
+import sample.spring.bean.Weather;
+
+public class WeatherSpringRPCClient {
+
+    public static void main(String[] args1) throws AxisFault {
+
+        RPCServiceClient serviceClient = new RPCServiceClient();
+
+        Options options = serviceClient.getOptions();
+
+        EndpointReference targetEPR = new EndpointReference(
+                "http://localhost:8080/axis2/services/WeatherSpringService");
+        options.setTo(targetEPR);
+
+        // Get the weather (no setting, the Spring Framework has already initialized it for us)
+        QName opGetWeather = new QName("http://service.spring.sample/xsd", "getWeather");
+
+        Object[] opGetWeatherArgs = new Object[] { };
+        Class[] returnTypes = new Class[] { Weather.class };
+        
+        
+        Object[] response = serviceClient.invokeBlocking(opGetWeather,
+                opGetWeatherArgs, returnTypes);
+        
+        Weather result = (Weather) response[0];
+        
+        // display results
+        if (result == null) {
+            System.out.println("Weather didn't initialize!");
+        }else{
+            System.out.println("Temperature               : " +
+                               result.getTemperature());
+            System.out.println("Forecast                  : " +
+                               result.getForecast());
+            System.out.println("Rain                      : " +
+                               result.getRain());
+            System.out.println("How much rain (in inches) : " +
+                               result.getHowMuchRain());
+        }
+    }
+}

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/bean/Weather.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/bean/Weather.java?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/bean/Weather.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/bean/Weather.java Thu Nov  9 21:06:16 2006
@@ -0,0 +1,40 @@
+package sample.spring.bean;
+
+public class Weather{
+    float temperature;
+    String forecast;
+    boolean rain;
+    float howMuchRain;
+    
+    public void setTemperature(float temp){
+        temperature = temp;
+    }
+
+    public float getTemperature(){
+        return temperature;
+    }
+    
+    public void setForecast(String fore){
+        forecast = fore;
+    }
+
+    public String getForecast(){
+        return forecast;
+    }
+    
+    public void setRain(boolean r){
+        rain = r;
+    }
+
+    public boolean getRain(){
+        return rain;
+    }
+    
+    public void setHowMuchRain(float howMuch){
+        howMuchRain = howMuch;
+    }
+
+    public float getHowMuchRain(){
+        return howMuchRain;
+    }
+}

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/SpringInit.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/SpringInit.java?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/SpringInit.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/SpringInit.java Thu Nov  9 21:06:16 2006
@@ -0,0 +1,58 @@
+package sample.spring.service;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.engine.ServiceLifeCycle;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.AxisService;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class SpringInit implements ServiceLifeCycle {
+        
+    private static Log logger = LogFactory
+        .getLog(SpringInit .class);
+
+    // The web service
+    public OMElement springInit(OMElement ignore) {
+
+        return null;
+    }
+
+    public void init(ServiceContext serviceContext) {
+        
+    }
+
+    public void setOperationContext(OperationContext arg0) {
+
+    }
+
+    public void destroy(ServiceContext arg0) {
+
+    }
+
+     /**
+     * this will be called during the deployement time of the service. irrespective
+     * of the service scope this method will be called
+     */
+    public void startUp(ConfigurationContext ignore, AxisService service) {
+        ClassLoader classLoader = service.getClassLoader();
+        ClassPathXmlApplicationContext appCtx = new
+            ClassPathXmlApplicationContext(new String[] {"applicationContext.xml"}, false);
+        appCtx.setClassLoader(classLoader);
+        appCtx.refresh();
+        if (logger.isDebugEnabled()) {
+            logger.debug("\n\nstartUp() set spring classloader via axisService.getClassLoader() ... ");
+        }
+    }
+    /**
+     * this will be called during the deployement time of the service. irrespective
+     * of the service scope this method will be called
+     */
+    public void shutDown(ConfigurationContext ignore, AxisService service) {
+        
+    }
+}
\ No newline at end of file

Added: webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/WeatherSpringService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/WeatherSpringService.java?view=auto&rev=473190
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/WeatherSpringService.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/axis2springpojo/src/sample/spring/service/WeatherSpringService.java Thu Nov  9 21:06:16 2006
@@ -0,0 +1,15 @@
+package sample.spring.service;
+
+import sample.spring.bean.Weather;
+
+public class WeatherSpringService{
+    Weather weather;
+    
+    public void setWeather(Weather w){
+        weather = w;
+    }
+
+    public Weather getWeather(){
+        return weather;
+    }
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org