Author: davsclaus
Date: Sun Sep  7 03:30:23 2008
New Revision: 692809

URL: http://svn.apache.org/viewvc?rev=692809&view=rev
Log:
CAMEL-601: Added camel-example-axis with a tutorial on how to use Camel with 
Axis and the web application deployment model.

Added:
    activemq/camel/trunk/examples/camel-example-axis/   (with props)
    activemq/camel/trunk/examples/camel-example-axis/README.txt   (with props)
    activemq/camel/trunk/examples/camel-example-axis/pom.xml   (with props)
    activemq/camel/trunk/examples/camel-example-axis/src/
    activemq/camel/trunk/examples/camel-example-axis/src/main/
    activemq/camel/trunk/examples/camel-example-axis/src/main/java/
    activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/
    activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/
    
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/
    
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/
    
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/
    
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/AxisReportIncidentService.java
   (with props)
    
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/ReportIncidentService.java
   (with props)
    activemq/camel/trunk/examples/camel-example-axis/src/main/resources/
    
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/axis-example-context.xml
   (with props)
    
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/log4j.properties
   (with props)
    activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/
    activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/   
(with props)
    
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/server-config.wsdd
   (with props)
    
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/web.xml
   (with props)
    
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/wsdl/
    
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/wsdl/report_incident.wsdl
   (with props)
    activemq/camel/trunk/examples/camel-example-axis/src/test/
    activemq/camel/trunk/examples/camel-example-axis/src/test/java/
    activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/
    activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/
    
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/
    
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/
    
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/
    
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/AxisReportIncidentServiceTest.java
   (with props)
    
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/ReportIncidentServiceTest.java
   (with props)
    activemq/camel/trunk/examples/camel-example-axis/src/test/resources/
    
activemq/camel/trunk/examples/camel-example-axis/src/test/resources/log4j.properties
   (with props)
Modified:
    activemq/camel/trunk/examples/pom.xml

Propchange: activemq/camel/trunk/examples/camel-example-axis/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Sep  7 03:30:23 2008
@@ -0,0 +1,8 @@
+.project
+.pmd
+.checkstyle
+.classpath
+target
+.settings
+eclipse-classes
+*.i??

Added: activemq/camel/trunk/examples/camel-example-axis/README.txt
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/README.txt?rev=692809&view=auto
==============================================================================
--- activemq/camel/trunk/examples/camel-example-axis/README.txt (added)
+++ activemq/camel/trunk/examples/camel-example-axis/README.txt Sun Sep  7 
03:30:23 2008
@@ -0,0 +1,38 @@
+Axis Example
+============
+
+This example shows how Camel integrates with older frameworks such as Apache 
Axis 1.4.
+It can be run using Maven.
+
+The example exposes a webservice using Apache Axis that uses Camel to send the 
input
+as a message to an endpoint. The endpoint is a file endpoint that stores a 
backup of the request.
+The purpose is more to demonstrate the integration between Axis, Spring and 
Camel than
+other concepts in Camel such as its powerful routing and mediation framework.
+
+To run the example type
+  mvn jetty:run
+
+You stop Jetty using ctrl + c
+
+Then you can hit the url: http://localhost:8080/camel-example-axis/services in 
a browser
+to see the exposed webservice by Apache Axis.
+
+The wsdl can be reached by clicking on the wsdl link. You can use a webservie 
tools to try
+it out online such as SoapUI.
+
+This project uses log4j as the logging and log4j.properties is located in 
src/main/resources 
+
+For the latest & greatest documentation on how to use this example please see
+  http://activemq.apache.org/camel/tutorial-axis-camel.html
+
+If you hit any problems please talk to us on the Camel Forums
+  http://activemq.apache.org/camel/discussion-forums.html
+
+Please help us make Apache Camel better - we appreciate any feedback you
+may have.  Enjoy!
+
+------------------------
+The Camel riders!
+
+
+

Propchange: activemq/camel/trunk/examples/camel-example-axis/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/examples/camel-example-axis/pom.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/pom.xml?rev=692809&view=auto
==============================================================================
--- activemq/camel/trunk/examples/camel-example-axis/pom.xml (added)
+++ activemq/camel/trunk/examples/camel-example-axis/pom.xml Sun Sep  7 
03:30:23 2008
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>examples</artifactId>
+        <version>1.5-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-example-axis</artifactId>
+    <name>Camel :: Example :: Axis</name>
+    <description>An example how to use Apache Axis 1.4 with Camel as a web 
application</description>
+    <packaging>war</packaging>
+       
+    <properties>
+        <jetty-version>6.1.1</jetty-version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-spring</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.axis</groupId>
+            <artifactId>axis</artifactId>
+            <version>1.4</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.axis</groupId>
+            <artifactId>axis-jaxrpc</artifactId>
+            <version>1.4</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.axis</groupId>
+            <artifactId>axis-saaj</artifactId>
+            <version>1.4</version>
+        </dependency>
+
+               <dependency>
+                   <groupId>axis</groupId>
+                   <artifactId>axis-wsdl4j</artifactId>
+                   <version>1.5.1</version>
+               </dependency>
+
+               <dependency>
+                   <groupId>commons-discovery</groupId>
+                   <artifactId>commons-discovery</artifactId>
+                   <version>0.4</version>
+               </dependency> 
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.14</version>
+        </dependency>
+
+        <!-- for unit testing -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mortbay.jetty</groupId>
+            <artifactId>jetty</artifactId>
+            <version>${jetty-version}</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+
+                 <plugin>
+                <groupId>org.mortbay.jetty</groupId>
+                <artifactId>maven-jetty-plugin</artifactId>
+                <version>${jetty-version}</version>
+            </plugin>
+
+            <plugin>
+               <groupId>org.codehaus.mojo</groupId>
+               <artifactId>axistools-maven-plugin</artifactId>
+               <configuration>
+                          
<sourceDirectory>src/main/webapp/WEB-INF/wsdl</sourceDirectory>
+                  
<packageSpace>org.apache.camel.example.reportincident</packageSpace>
+                  <testCases>false</testCases>
+                  <serverSide>true</serverSide>
+                  <subPackageByFileName>false</subPackageByFileName>
+               </configuration>
+               <executions>
+                 <execution>
+                   <goals>
+                     <goal>wsdl2java</goal>
+                   </goals>
+                 </execution>
+               </executions>
+            </plugin>
+
+             <plugin>
+               <groupId>org.apache.camel</groupId>
+               <artifactId>camel-maven-plugin</artifactId>
+                       <configuration>
+                               
<fileApplicationContextUri>src/main/resources/*.xml</fileApplicationContextUri>
+                       </configuration>
+             </plugin>
+
+         </plugins>
+
+       </build>
+
+</project>

Propchange: activemq/camel/trunk/examples/camel-example-axis/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/examples/camel-example-axis/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/AxisReportIncidentService.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/AxisReportIncidentService.java?rev=692809&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/AxisReportIncidentService.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/AxisReportIncidentService.java
 Sun Sep  7 03:30:23 2008
@@ -0,0 +1,29 @@
+package org.apache.camel.example.axis;
+
+import org.apache.camel.example.reportincident.InputReportIncident;
+import org.apache.camel.example.reportincident.OutputReportIncident;
+import org.apache.camel.example.reportincident.ReportIncidentService_PortType;
+import org.springframework.remoting.jaxrpc.ServletEndpointSupport;
+
+import javax.xml.rpc.ServiceException;
+import java.rmi.RemoteException;
+
+/**
+ * Axis webservice
+ */
+public class AxisReportIncidentService extends ServletEndpointSupport 
implements ReportIncidentService_PortType {
+
+    private ReportIncidentService service;
+
+    @Override
+    protected void onInit() throws ServiceException {
+        // get hold of the spring bean from the application context
+        service = (ReportIncidentService) 
getApplicationContext().getBean("incidentservice");
+    }
+
+    public OutputReportIncident reportIncident(InputReportIncident parameters) 
throws RemoteException {
+        // delegate to the real service
+        return service.reportIncident(parameters);
+    }
+
+}

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/AxisReportIncidentService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/ReportIncidentService.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/ReportIncidentService.java?rev=692809&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/ReportIncidentService.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/ReportIncidentService.java
 Sun Sep  7 03:30:23 2008
@@ -0,0 +1,35 @@
+package org.apache.camel.example.axis;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.example.reportincident.InputReportIncident;
+import org.apache.camel.example.reportincident.OutputReportIncident;
+
+/**
+ * Our real service that is not tied to Axis
+ */
+public class ReportIncidentService {
+
+    @EndpointInject(name = "backup")
+    private ProducerTemplate template;
+
+    public OutputReportIncident reportIncident(InputReportIncident parameters) 
{
+        System.out.println("Hello ReportIncidentService is called from " + 
parameters.getGivenName());
+
+        String data = parameters.getDetails();
+
+        // store the data as a file
+        String filename = parameters.getIncidentId() + ".txt";
+        // send the data to the endpoint and the header contains what filename 
it should be stored as
+        template.sendBodyAndHeader(data, "org.apache.camel.file.name", 
filename);
+
+        OutputReportIncident out = new OutputReportIncident();
+        out.setCode("OK");
+        return out;
+    }
+
+    public void setTemplate(ProducerTemplate template) {
+        this.template = template;
+    }
+
+}
\ No newline at end of file

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/java/org/apache/camel/example/axis/ReportIncidentService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/axis-example-context.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/src/main/resources/axis-example-context.xml?rev=692809&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/axis-example-context.xml
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/axis-example-context.xml
 Sun Sep  7 03:30:23 2008
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:camel="http://activemq.apache.org/camel/schema/spring";
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+         http://activemq.apache.org/camel/schema/spring 
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd";>
+
+    <bean id="incidentservice" 
class="org.apache.camel.example.axis.ReportIncidentService"/>
+
+    <camel:camelContext id="camelContext">
+        <!-- endpoint named backup that is configued as a file component -->
+        <camel:endpoint id="backup" uri="file://target?append=false"/>
+
+    </camel:camelContext>
+
+</beans>
+        
\ No newline at end of file

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/axis-example-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/axis-example-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/log4j.properties
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/src/main/resources/log4j.properties?rev=692809&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/log4j.properties
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/log4j.properties
 Sun Sep  7 03:30:23 2008
@@ -0,0 +1,36 @@
+## ------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for eclipse testing, We want to see INFO output 
on the console.
+#
+log4j.rootLogger=INFO, file
+
+# uncomment the next line to debug Camel
+#log4j.logger.org.apache.camel=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
+log4j.appender.file.file=target/camel-example-axis.log
+log4j.appender.file.append=true
\ No newline at end of file

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Sep  7 03:30:23 2008
@@ -0,0 +1 @@
+attachments

Added: 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/server-config.wsdd
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/server-config.wsdd?rev=692809&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/server-config.wsdd
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/server-config.wsdd
 Sun Sep  7 03:30:23 2008
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="http://xml.apache.org/axis/wsdd/"; 
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
+    <!-- global configuration -->
+       <globalConfiguration>
+               <parameter name="sendXsiTypes" value="true"/>
+               <parameter name="sendMultiRefs" value="true"/>
+               <parameter name="sendXMLDeclaration" value="true"/>
+               <parameter name="axis.sendMinimizedElements" value="true"/>
+       </globalConfiguration>
+
+    <handler name="URLMapper" 
type="java:org.apache.axis.handlers.http.URLMapper"/>
+
+  <!-- this service is from deploy.wsdd -->
+  <service name="ReportIncidentPort" provider="java:RPC" style="document" 
use="literal">
+      <wsdlFile>/WEB-INF/wsdl/report_incident.wsdl</wsdlFile>
+      <parameter name="wsdlTargetNamespace" 
value="http://reportincident.example.camel.apache.org"/>
+      <parameter name="wsdlServiceElement" value="ReportIncidentService"/>
+      <parameter name="schemaUnqualified" 
value="http://reportincident.example.camel.apache.org"/>
+      <parameter name="wsdlServicePort" value="ReportIncidentPort"/>
+      <parameter name="className" 
value="org.apache.camel.example.axis.AxisReportIncidentService"/>
+      <parameter name="wsdlPortType" value="ReportIncidentService"/>
+      <parameter name="typeMappingVersion" value="1.2"/>
+      <operation name="reportIncident" qname="ReportIncident" 
returnQName="retNS:outputReportIncident" 
xmlns:retNS="http://reportincident.example.camel.apache.org"; 
returnType="rtns:>outputReportIncident" 
xmlns:rtns="http://reportincident.example.camel.apache.org"; 
soapAction="http://reportincident.example.camel.apache.org/ReportIncident"; >
+        <parameter qname="pns:inputReportIncident" 
xmlns:pns="http://reportincident.example.camel.apache.org"; 
type="tns:>inputReportIncident" 
xmlns:tns="http://reportincident.example.camel.apache.org"/>
+      </operation>
+      <parameter name="allowedMethods" value="reportIncident"/>
+
+      <typeMapping
+        xmlns:ns="http://reportincident.example.camel.apache.org";
+        qname="ns:>outputReportIncident"
+        
type="java:org.apache.camel.example.reportincident.OutputReportIncident"
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+        encodingStyle=""
+      />
+      <typeMapping
+        xmlns:ns="http://reportincident.example.camel.apache.org";
+        qname="ns:>inputReportIncident"
+        type="java:org.apache.camel.example.reportincident.InputReportIncident"
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+        encodingStyle=""
+      />
+  </service>
+
+  <!-- part of Axis configuration -->
+       <transport name="http">
+               <requestFlow>
+                       <handler type="URLMapper"/>
+                       <handler 
type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
+               </requestFlow>
+       </transport>
+</deployment>

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/server-config.wsdd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/server-config.wsdd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/web.xml?rev=692809&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/web.xml
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/web.xml
 Sun Sep  7 03:30:23 2008
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
+
+    <display-name>Camel :: Example :: AXIS</display-name>
+
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
+            classpath:axis-example-context.xml
+        </param-value>
+    </context-param>
+
+    <listener>
+        
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+    
+       <servlet>
+               <servlet-name>axis</servlet-name>
+               
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
+       </servlet>
+
+       <servlet-mapping>
+               <servlet-name>axis</servlet-name>
+               <url-pattern>/services/*</url-pattern>
+       </servlet-mapping>
+
+</web-app>

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/wsdl/report_incident.wsdl
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/wsdl/report_incident.wsdl?rev=692809&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/wsdl/report_incident.wsdl
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/wsdl/report_incident.wsdl
 Sun Sep  7 03:30:23 2008
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+       xmlns:tns="http://reportincident.example.camel.apache.org";
+       xmlns:xs="http://www.w3.org/2001/XMLSchema";
+       xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";
+       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+       targetNamespace="http://reportincident.example.camel.apache.org";>
+
+       <!-- Type definitions for input- and output parameters for webservice 
-->
+       <wsdl:types>
+       <xs:schema 
targetNamespace="http://reportincident.example.camel.apache.org";>
+                       <xs:element name="inputReportIncident">
+                               <xs:complexType>
+                                       <xs:sequence>
+                                               <xs:element type="xs:string"  
name="incidentId"/>
+                                               <xs:element type="xs:string"  
name="incidentDate"/>
+                                               <xs:element type="xs:string"  
name="givenName"/>
+                                               <xs:element type="xs:string"  
name="familyName"/>
+                                               <xs:element type="xs:string"  
name="summary"/>
+                                               <xs:element type="xs:string"  
name="details"/>
+                                               <xs:element type="xs:string"  
name="email"/>
+                                               <xs:element type="xs:string"  
name="phone"/>
+                                       </xs:sequence>
+                               </xs:complexType>
+                       </xs:element>
+                       <xs:element name="outputReportIncident">
+                               <xs:complexType>
+                                       <xs:sequence>
+                                               <xs:element type="xs:string" 
name="code"/>
+                                       </xs:sequence>
+                               </xs:complexType>
+                       </xs:element>
+               </xs:schema>
+       </wsdl:types>
+
+       <!-- Message definitions for input and output -->
+       <wsdl:message name="inputReportIncident">
+               <wsdl:part name="parameters" element="tns:inputReportIncident"/>
+       </wsdl:message>
+       <wsdl:message name="outputReportIncident">
+               <wsdl:part name="parameters" 
element="tns:outputReportIncident"/>
+       </wsdl:message>
+
+       <!-- Port (interface) definitions -->
+       <wsdl:portType name="ReportIncidentService">
+               <wsdl:operation name="ReportIncident">
+                       <wsdl:input message="tns:inputReportIncident"/>
+                       <wsdl:output message="tns:outputReportIncident"/>
+               </wsdl:operation>
+       </wsdl:portType>
+
+       <!-- Port bindings to transports and encoding - HTTP, document literal 
encoding is used -->
+       <wsdl:binding name="ReportIncidentBinding" 
type="tns:ReportIncidentService">
+               <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
+               <wsdl:operation name="ReportIncident">
+                       <soap:operation
+                               
soapAction="http://reportincident.example.camel.apache.org/ReportIncident";
+                               style="document"/>
+                       <wsdl:input>
+                               <soap:body parts="parameters" use="literal"/>
+                       </wsdl:input>
+                       <wsdl:output>
+                               <soap:body parts="parameters" use="literal"/>
+                       </wsdl:output>
+               </wsdl:operation>
+       </wsdl:binding>
+
+       <!-- Service definition -->
+       <wsdl:service name="ReportIncidentService">
+               <wsdl:port name="ReportIncidentPort" 
binding="tns:ReportIncidentBinding">
+                       <soap:address 
location="http://reportincident.example.camel.apache.org"/>
+               </wsdl:port>
+       </wsdl:service>
+
+</wsdl:definitions>

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/wsdl/report_incident.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/main/webapp/WEB-INF/wsdl/report_incident.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/AxisReportIncidentServiceTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/AxisReportIncidentServiceTest.java?rev=692809&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/AxisReportIncidentServiceTest.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/AxisReportIncidentServiceTest.java
 Sun Sep  7 03:30:23 2008
@@ -0,0 +1,90 @@
+package org.apache.camel.example.axis;
+
+import junit.framework.TestCase;
+import org.apache.camel.example.reportincident.InputReportIncident;
+import org.apache.camel.example.reportincident.OutputReportIncident;
+import org.apache.camel.example.reportincident.ReportIncidentService_PortType;
+import 
org.apache.camel.example.reportincident.ReportIncidentService_ServiceLocator;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * Unit test with embedded Jetty to execute a webservice request using Axis
+ */
+public class AxisReportIncidentServiceTest extends TestCase {
+
+    private Server server;
+
+    private void startJetty() throws Exception {
+        // create an embedded Jetty server
+        server = new Server();
+
+        // add a listener on port 8080 on localhost (127.0.0.1)
+        Connector connector = new SelectChannelConnector();
+        connector.setPort(8080);
+        connector.setHost("127.0.0.1");
+        server.addConnector(connector);
+
+        // add our web context path
+        WebAppContext wac = new WebAppContext();
+        wac.setContextPath("/unittest");
+        // set the location of the exploded webapp where WEB-INF is located
+        // this is a nice feature of Jetty where we can point to 
src/main/webapp
+        wac.setWar("./src/main/webapp");
+        server.setHandler(wac);
+
+        // then start Jetty
+        server.setStopAtShutdown(true);
+        server.start();
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        startJetty();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        server.stop();
+    }
+
+    public void testReportIncidentWithAxis() throws Exception {
+        // the url to the axis webservice exposed by jetty
+        URL url = new 
URL("http://localhost:8080/unittest/services/ReportIncidentPort";);
+
+        // Axis stuff to get the port where we can send the webservice request
+        ReportIncidentService_ServiceLocator locator = new 
ReportIncidentService_ServiceLocator();
+        ReportIncidentService_PortType port = 
locator.getReportIncidentPort(url);
+
+        // create input to send
+        InputReportIncident input = createDummyIncident();
+        // send the webservice and get the response
+        OutputReportIncident output = port.reportIncident(input);
+        assertEquals("OK", output.getCode());
+
+        // should generate a file also
+        File file = new File("target/" + input.getIncidentId() + ".txt");
+        assertTrue("File should exists", file.exists());
+    }
+
+    protected InputReportIncident createDummyIncident() {
+        InputReportIncident input = new InputReportIncident();
+        input.setEmail("[EMAIL PROTECTED]");
+        input.setIncidentId("12345678");
+        input.setIncidentDate("2008-07-13");
+        input.setPhone("+45 2962 7576");
+        input.setSummary("Failed operation");
+        input.setDetails("The wrong foot was operated.");
+        input.setFamilyName("Ibsen");
+        input.setGivenName("Claus");
+        return input;
+    }
+
+}

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/AxisReportIncidentServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/ReportIncidentServiceTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/ReportIncidentServiceTest.java?rev=692809&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/ReportIncidentServiceTest.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/ReportIncidentServiceTest.java
 Sun Sep  7 03:30:23 2008
@@ -0,0 +1,41 @@
+package org.apache.camel.example.axis;
+
+import org.apache.camel.example.reportincident.InputReportIncident;
+import org.apache.camel.example.reportincident.OutputReportIncident;
+import org.springframework.test.context.ContextConfiguration;
+import 
org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
+
+import java.io.File;
+
+/**
+ * Unit test of service
+ */
[EMAIL PROTECTED](locations = "classpath:axis-example-context.xml")
+public class ReportIncidentServiceTest extends 
AbstractJUnit38SpringContextTests {
+
+    public void testIncident() {
+        ReportIncidentService service = (ReportIncidentService) 
applicationContext.getBean("incidentservice");
+
+        InputReportIncident input = createDummyIncident();
+        OutputReportIncident output = service.reportIncident(input);
+        assertEquals("OK", output.getCode());
+
+        // should generate a file also
+        File file = new File("target/" + input.getIncidentId() + ".txt");
+        assertTrue("File should exists", file.exists());
+    }
+
+   protected InputReportIncident createDummyIncident() {
+        InputReportIncident input = new InputReportIncident();
+        input.setEmail("[EMAIL PROTECTED]");
+        input.setIncidentId("12345678");
+        input.setIncidentDate("2008-07-13");
+        input.setPhone("+45 2962 7576");
+        input.setSummary("Failed operation");
+        input.setDetails("The wrong foot was operated.");
+        input.setFamilyName("Ibsen");
+        input.setGivenName("Claus");
+        return input;
+    }
+
+}

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/test/java/org/apache/camel/example/axis/ReportIncidentServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
activemq/camel/trunk/examples/camel-example-axis/src/test/resources/log4j.properties
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-axis/src/test/resources/log4j.properties?rev=692809&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-axis/src/test/resources/log4j.properties
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-axis/src/test/resources/log4j.properties
 Sun Sep  7 03:30:23 2008
@@ -0,0 +1,36 @@
+## ------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for eclipse testing, We want to see INFO output 
on the console.
+#
+log4j.rootLogger=INFO, file
+
+# uncomment the next line to debug Camel
+log4j.logger.org.apache.camel=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
+log4j.appender.file.file=target/camel-example-axis.log
+log4j.appender.file.append=true
\ No newline at end of file

Propchange: 
activemq/camel/trunk/examples/camel-example-axis/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/examples/pom.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/pom.xml?rev=692809&r1=692808&r2=692809&view=diff
==============================================================================
--- activemq/camel/trunk/examples/pom.xml (original)
+++ activemq/camel/trunk/examples/pom.xml Sun Sep  7 03:30:23 2008
@@ -48,6 +48,7 @@
   </pluginRepositories>
 
   <modules>
+    <module>camel-example-axis</module>
     <module>camel-example-bam</module>
     <module>camel-example-cxf</module>
     <module>camel-example-docs</module>


Reply via email to