Author: ningjiang Date: Mon Nov 28 03:45:38 2011 New Revision: 1206967 URL: http://svn.apache.org/viewvc?rev=1206967&view=rev Log: CAMEL-4714 Improvements to camel-example-cxf-tomcat sample
Modified: camel/trunk/apache-camel/src/main/descriptors/unix-bin.xml camel/trunk/apache-camel/src/main/descriptors/windows-bin.xml camel/trunk/examples/camel-example-cxf-tomcat/README.txt camel/trunk/examples/camel-example-cxf-tomcat/pom.xml camel/trunk/examples/camel-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/CamelRouteClient.java Modified: camel/trunk/apache-camel/src/main/descriptors/unix-bin.xml URL: http://svn.apache.org/viewvc/camel/trunk/apache-camel/src/main/descriptors/unix-bin.xml?rev=1206967&r1=1206966&r2=1206967&view=diff ============================================================================== --- camel/trunk/apache-camel/src/main/descriptors/unix-bin.xml (original) +++ camel/trunk/apache-camel/src/main/descriptors/unix-bin.xml Mon Nov 28 03:45:38 2011 @@ -51,7 +51,6 @@ <exclude>**/camel-example-osgi/README.txt</exclude> <exclude>**/camel-example-cxf-osgi/README.txt</exclude> <exclude>**/camel-example-cxf-blueprint/README.txt</exclude> - <exclude>**/camel-example-cxf-tomcat/README.txt</exclude> </excludes> <lineEnding>unix</lineEnding> </fileSet> @@ -106,13 +105,6 @@ <fileMode>0644</fileMode> <lineEnding>unix</lineEnding> </file> - <file> - <source>../examples/camel-example-cxf-tomcat/README.txt</source> - <outputDirectory>/examples/camel-example-cxf-tomcat</outputDirectory> - <filtered>true</filtered> - <fileMode>0644</fileMode> - <lineEnding>unix</lineEnding> - </file> </files> Modified: camel/trunk/apache-camel/src/main/descriptors/windows-bin.xml URL: http://svn.apache.org/viewvc/camel/trunk/apache-camel/src/main/descriptors/windows-bin.xml?rev=1206967&r1=1206966&r2=1206967&view=diff ============================================================================== --- camel/trunk/apache-camel/src/main/descriptors/windows-bin.xml (original) +++ camel/trunk/apache-camel/src/main/descriptors/windows-bin.xml Mon Nov 28 03:45:38 2011 @@ -51,7 +51,6 @@ <exclude>**/camel-example-osgi/README.txt</exclude> <exclude>**/camel-example-cxf-osgi/README.txt</exclude> <exclude>**/camel-example-cxf-blueprint/README.txt</exclude> - <exclude>**/camel-example-cxf-tomcat/README.txt</exclude> </excludes> <lineEnding>dos</lineEnding> </fileSet> @@ -106,13 +105,6 @@ <fileMode>0644</fileMode> <lineEnding>dos</lineEnding> </file> - <file> - <source>../examples/camel-example-cxf-tomcat/README.txt</source> - <outputDirectory>/examples/camel-example-cxf-tomcat</outputDirectory> - <filtered>true</filtered> - <fileMode>0644</fileMode> - <lineEnding>dos</lineEnding> - </file> </files> <componentDescriptors> Modified: camel/trunk/examples/camel-example-cxf-tomcat/README.txt URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cxf-tomcat/README.txt?rev=1206967&r1=1206966&r2=1206967&view=diff ============================================================================== --- camel/trunk/examples/camel-example-cxf-tomcat/README.txt (original) +++ camel/trunk/examples/camel-example-cxf-tomcat/README.txt Mon Nov 28 03:45:38 2011 @@ -1,20 +1,53 @@ Camel CXF (code first) and Apache Tomcat example ================================================ - -An example which uses code-first to expose a webservice in Camel running on Apache Tomcat. +An example which uses code-first to expose a web service in Camel running on Apache Tomcat. It can be run using Maven. -You will need to package this example first: - mvn package +You will need to first need to build the example: + mvn clean install -To run the example deploy it in Apache Tomcat by copying the .war to the -deploy folder of Apache Tomcat. +To run the example deploy it in Apache Tomcat by copying the .war located +in the target directory to the deploy folder of Apache Tomcat. Alternatively, +if your Tomcat installation is set up to use the Tomcat Maven plugin +(http://mojo.codehaus.org/tomcat-maven-plugin/usage.html), you can simply +run "mvn tomcat:deploy" (also "tomcat:undeploy", "tomcat:redeploy", etc.) +to install the WAR file. The webservice is located at - http://localhost:8080/camel-example-cxf-tomcat-${version}/webservices/incident?wsdl + http://localhost:8080/camel-example-cxf-tomcat/webservices/incident?wsdl + +You can run a sample client using the "mvn exec:java" command, or, within +soapUI, making sample SOAP requests such as the following: + +<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> + <soap:Body> + <ns1:reportIncident xmlns:ns1="http://incident.cxf.example.camel.apache.org/"> + <arg0> + <details>blah blah</details> + <email>davscl...@apache.org</email> + <familyName>Smith</familyName> + <givenName>Bob</givenName> + <incidentDate>2011-11-25</incidentDate> + <incidentId>123</incidentId> + <phone>123-456-7890</phone> + <summary>blah blah summary</summary> + </arg0> + </ns1:reportIncident> + </soap:Body> +</soap:Envelope> + +<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> + <soap:Body> + <ns1:statusIncident xmlns:ns1="http://incident.cxf.example.camel.apache.org/"> + <arg0> + <incidentId>456</incidentId> + </arg0> + </ns1:statusIncident> + </soap:Body> +</soap:Envelope> -This example is documented at +This example is further documented at http://camel.apache.org/cxf-tomcat-example.html If you hit any problems please let us know on the Camel Forums @@ -24,7 +57,4 @@ Please help us make Apache Camel better have. Enjoy! ------------------------ -The Camel riders! - - - +The Camel Riders! Modified: camel/trunk/examples/camel-example-cxf-tomcat/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cxf-tomcat/pom.xml?rev=1206967&r1=1206966&r2=1206967&view=diff ============================================================================== --- camel/trunk/examples/camel-example-cxf-tomcat/pom.xml (original) +++ camel/trunk/examples/camel-example-cxf-tomcat/pom.xml Mon Nov 28 03:45:38 2011 @@ -31,6 +31,37 @@ <description>An example using Camel CXF (code first) with Apache Tomcat</description> <packaging>war</packaging> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>tomcat-maven-plugin</artifactId> + <version>1.1</version> + <configuration> + <server>myTomcat</server> + <url>${tomcat.url}</url> + <path>/${project.build.finalName}</path> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <configuration> + <mainClass>org.apache.camel.example.cxf.CamelRouteClient</mainClass> + <includePluginDependencies>false</includePluginDependencies> + <systemProperties> + <property> + <key>java.util.logging.config.file</key> + <value>logging.properties</value> + </property> + </systemProperties> + </configuration> + </plugin> + </plugins> + <!-- Name of the generated WAR file --> + <finalName>camel-example-cxf-tomcat</finalName> + </build> + <dependencies> <!-- camel --> @@ -72,7 +103,24 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </dependency> - </dependencies> + <profiles> + <profile> + <id>Tomcat7</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <tomcat.url>http://localhost:8080/manager/text</tomcat.url> + </properties> + </profile> + <profile> + <id>Tomcat6</id> + <properties> + <tomcat.url>http://localhost:8080/manager</tomcat.url> + </properties> + </profile> + </profiles> + </project> Modified: camel/trunk/examples/camel-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/CamelRouteClient.java URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/CamelRouteClient.java?rev=1206967&r1=1206966&r2=1206967&view=diff ============================================================================== --- camel/trunk/examples/camel-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/CamelRouteClient.java (original) +++ camel/trunk/examples/camel-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/CamelRouteClient.java Mon Nov 28 03:45:38 2011 @@ -25,8 +25,8 @@ import org.apache.cxf.frontend.ClientPro public class CamelRouteClient { - // You may need to change the URL according to the Camel version - private static final String URL = "http://localhost:8080/camel-example-cxf-tomcat-2.7-SNAPSHOT/webservices/incident"; + + private static final String URL = "http://localhost:8080/camel-example-cxf-tomcat/webservices/incident"; protected static IncidentService createCXFClient() { // we use CXF to create a client for us as its easier than JAXWS and works