You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2010/04/01 09:39:34 UTC
svn commit: r929870 - in /servicemix/smx4/features/trunk:
assembly/src/main/descriptors/ assembly/src/main/filtered-resources/
examples/ examples/cxf-ws-rm/ examples/cxf-ws-rm/src/
examples/cxf-ws-rm/src/main/ examples/cxf-ws-rm/src/main/java/ examples...
Author: ffang
Date: Thu Apr 1 07:39:33 2010
New Revision: 929870
URL: http://svn.apache.org/viewvc?rev=929870&view=rev
Log:
[SMX4-509]add cxf ws-rm example
Added:
servicemix/smx4/features/trunk/examples/cxf-ws-rm/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/README.txt
servicemix/smx4/features/trunk/examples/cxf-ws-rm/pom.xml (with props)
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java (with props)
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java (with props)
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/Client.java (with props)
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/MessageLossSimulator.java (with props)
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/HelloWorld.wsdl
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/META-INF/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/META-INF/spring/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/META-INF/spring/beans.xml (with props)
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/org/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/org/apache/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/org/apache/servicemix/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/org/apache/servicemix/samples/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/org/apache/servicemix/samples/cxf_ws_rm/
servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/org/apache/servicemix/samples/cxf_ws_rm/ws_rm.xml
Modified:
servicemix/smx4/features/trunk/assembly/src/main/descriptors/unix-bin.xml
servicemix/smx4/features/trunk/assembly/src/main/descriptors/windows-bin.xml
servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/features.xml
servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/pom.xml
servicemix/smx4/features/trunk/examples/pom.xml
Modified: servicemix/smx4/features/trunk/assembly/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/assembly/src/main/descriptors/unix-bin.xml?rev=929870&r1=929869&r2=929870&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/assembly/src/main/descriptors/unix-bin.xml (original)
+++ servicemix/smx4/features/trunk/assembly/src/main/descriptors/unix-bin.xml Thu Apr 1 07:39:33 2010
@@ -288,6 +288,13 @@
<fileMode>0644</fileMode>
<lineEnding>unix</lineEnding>
</file>
+ <file>
+ <source>${basedir}/../examples/cxf-ws-rm/README.txt</source>
+ <outputDirectory>/examples/cxf-ws-rm</outputDirectory>
+ <filtered>true</filtered>
+ <fileMode>0644</fileMode>
+ <lineEnding>unix</lineEnding>
+ </file>
<file>
<source>${basedir}/../examples/cxf-camel-nmr/README.txt</source>
Modified: servicemix/smx4/features/trunk/assembly/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/assembly/src/main/descriptors/windows-bin.xml?rev=929870&r1=929869&r2=929870&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/assembly/src/main/descriptors/windows-bin.xml (original)
+++ servicemix/smx4/features/trunk/assembly/src/main/descriptors/windows-bin.xml Thu Apr 1 07:39:33 2010
@@ -277,6 +277,13 @@
<fileMode>0644</fileMode>
<lineEnding>dos</lineEnding>
</file>
+ <file>
+ <source>${basedir}/../examples/cxf-ws-rm/README.txt</source>
+ <outputDirectory>/examples/cxf-ws-rm</outputDirectory>
+ <filtered>true</filtered>
+ <fileMode>0644</fileMode>
+ <lineEnding>dos</lineEnding>
+ </file>
<file>
<source>${basedir}/../examples/cxf-camel-nmr/README.txt</source>
Modified: servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/features.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/features.xml?rev=929870&r1=929869&r2=929870&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/features.xml (original)
+++ servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/features.xml Thu Apr 1 07:39:33 2010
@@ -192,6 +192,9 @@
<bundle>mvn:org.springframework/spring-beans/${spring.version}</bundle>
<bundle>mvn:org.apache.servicemix.examples/cxf-ws-security-osgi/${version}</bundle>
</feature>
+ <feature name="examples-cxf-ws-rm" version="${version}">
+ <bundle>mvn:org.apache.servicemix.examples/cxf-ws-rm/${version}</bundle>
+ </feature>
<!--
-
- JBI Components
Modified: servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/pom.xml?rev=929870&r1=929869&r2=929870&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/pom.xml (original)
+++ servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/pom.xml Thu Apr 1 07:39:33 2010
@@ -46,6 +46,7 @@
<module>cxf-jaxrs</module>
<module>cxf-wsdl-first-osgi-package</module>
<module>cxf-ws-security-osgi</module>
- </modules>
+ <module>cxf-ws-rm</module>
+ </modules>
</project>
Added: servicemix/smx4/features/trunk/examples/cxf-ws-rm/README.txt
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-rm/README.txt?rev=929870&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-rm/README.txt (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-rm/README.txt Thu Apr 1 07:39:33 2010
@@ -0,0 +1,214 @@
+/*
+ * 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.
+ */
+
+CXF OSGi HTTP WEB SERVICE
+=========================
+
+Purpose
+-------
+Create a web service with CXF and ws_rm feature enabled.
+
+
+Explanation
+-----------
+The client and server both apply the reliableMessaging feature to the bus.
+This ensures installation of the WS-RM interceptors,
+comprising logical interceptors (RMInInterceptor/RMOutInterceptor)
+responsible for managing the reliability properties of the current message, and a
+protocol interceptor (RMSoapInterceptor) responsible for encoding/decoding
+these properties as SOAP Headers.
+
+As WS-RM is dependent on WS-Addressing, the demo uses
+the same approach as the ws_addressing sample to enable this
+functionality. However, you may notice that the WS-Addressing
+namespace URI is different in this case (i.e.
+http://schemas.xmlsoap.org/ws/2004/08/addressing as opposed to
+http://www.w3.org/2005/08/addressing). This is because the WS-RM
+specification is still based on an older version of WS-Addressing.
+
+The logging feature is used to log the inbound and outbound
+SOAP messages and display these to the console. Notice the usage of
+out-of-band RM protocol messages (CreateSequence and CreateSequenceResponse)
+and the WS-RM headers in application-level messages (Sequence,
+SequenceAcknowledgement, AckRequested etc.)
+
+Finally, the MessageLossSimulator interceptor is installed
+on the client-side to simulate message loss by discarding every second
+application level message. This simulated unreliability allows the retransmission
+of unacknowledged messages to be observed.
+
+This demo also illustrates usage of the decoupled HTTP transport, whereby
+a separate server->client HTTP connection is used to deliver responses
+to (application or RM protocol) requests and server side originated
+standalone acknowledgments.
+The "partial response" referred to in the log output is the payload of
+the HTTP 202 Accepted response sent on the back-channel of the original
+client->server connection.
+
+
+The beans.xml file, located in the src/main/resources/META-INF/spring
+directory:
+
+1. Imports the configuration files needed to enable CXF and OSGi work
+ together.
+
+2. Configures the web service endpoint as follows:
+
+ <jaxws:endpoint id="helloWorld"
+ implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
+ wsdlLocation="classpath:HelloWorld.wsdl"
+ address="http://localhost:9191/HelloWorld"/>
+
+Prerequisites for Running the Example
+-------------------------------------
+1. You must have the following installed on your machine:
+
+ - JDK 1.5 or higher
+
+ - Maven 2.0.9 or higher
+
+ For more information, see the README in the top-level examples
+ directory.
+
+
+2. Start ServiceMix by running the following command:
+
+ <servicemix_home>/bin/servicemix (on UNIX)
+ <servicemix_home>\bin\servicemix (on Windows)
+
+
+Running the Example
+-------------------
+You can run the example in two ways:
+
+- A. Using a Prebuilt Deployment Bundle: Quick and Easy
+This option is useful if you want to see the example up and
+running as quickly as possible.
+
+- B. Building the Example Bundle Yourself
+This option is useful if you want to change the example in any
+way. It tells you how to build and deploy the example. This
+option might be slower than option A because, if you do not
+already have the required bundles in your local Maven
+repository, Maven will have to download the bundles it needs.
+
+A. Using a Prebuilt Deployment Bundle: Quick and Easy
+-----------------------------------------------------
+To install and run a prebuilt version of this example, enter
+the following command in the ServiceMix console:
+
+ features:install examples-cxf-ws-rm
+
+This command makes use of the ServiceMix features facility. For
+more information about the features facility, see the README.txt
+file in the examples parent directory.
+
+
+Running a Client
+----------------
+To run the java code client:
+
+1. Change to the <servicemix_home>/examples/cxf-ws-rm
+ directory.
+
+2. Run the following command:
+
+ mvn compile exec:java
+
+
+
+B. Building the Example Bundle Yourself
+---------------------------------------
+To install and run the example where you build the example bundle
+yourself, complete the following steps:
+
+1. If you have already run the example using the prebuilt version as
+ described above, you must first uninstall the examples-cxf-ws-rm
+ feature by entering the following command in the ServiceMix console:
+
+ features:uninstall examples-cxf-ws-rm
+
+
+2. Build the example by opening a command prompt, changing directory to
+ examples/cxf-ws-rm (this example) and entering the following Maven
+ command:
+
+ mvn install
+
+ If all of the required OSGi bundles are available in your local
+ Maven repository, the example will build very quickly. Otherwise
+ it may take some time for Maven to download everything it needs.
+
+ The mvn install command builds the example deployment bundle and
+ copies it to your local Maven repository and to the target directory
+ of this example.
+
+3. Install the example by entering the following command in
+ the ServiceMix console:
+
+ features:install examples-cxf-ws-rm
+
+ It makes use of the ServiceMix features facility. For more
+ information about the features facility, see the README.txt file
+ in the examples parent directory.
+
+
+You can try running a client against your service by following the
+instructions in the "Running a Client" section above.
+
+
+Stopping and Uninstalling the Example
+-------------------------------------
+To stop the example, you must first know the bundle ID that ServiceMix
+has assigned to it. To get the bundle ID, enter the following command
+at the ServiceMix console:
+
+ osgi:list
+
+At the end of the listing, you should see an entry similar to the
+following:
+
+ [170] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF WS-RM (4.2.0.0)
+
+In this case, the bundle ID is 170.
+
+To stop the example, enter the following command at the ServiceMix
+console:
+
+ osgi:stop <bundle_id>
+
+For example:
+
+ osgi:stop 170
+
+To uninstall the example, enter one of the following commands in
+the ServiceMix console:
+
+ features:uninstall examples-cxf-ws-rm
+
+or
+
+ osgi:uninstall <bundle_id>
+
+
+Viewing the Log Entries
+-----------------------
+You can view the entries in the log file in the data/log
+directory of your ServiceMix installation, or by typing
+the following command in the ServiceMix console:
+
+ log:display
Added: servicemix/smx4/features/trunk/examples/cxf-ws-rm/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-rm/pom.xml?rev=929870&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-rm/pom.xml (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-rm/pom.xml Thu Apr 1 07:39:33 2010
@@ -0,0 +1,127 @@
+<?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">
+
+ <!--
+
+ 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.examples</groupId>
+ <artifactId>examples</artifactId>
+ <version>4.1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix.examples</groupId>
+ <artifactId>cxf-ws-rm</artifactId>
+ <packaging>bundle</packaging>
+ <version>4.1.0-SNAPSHOT</version>
+ <name>Apache ServiceMix Example :: CXF WS-RM</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
+ <version>${geronimo.wsmetadata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix</groupId>
+ <artifactId>servicemix-utils</artifactId>
+ <version>${servicemix-utils.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http-jetty</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-rm</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-addr</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-policy</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-common-utilities</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Import-Package>
+ javax.jws,
+ javax.wsdl,
+ javax.xml.ws,
+ javax.xml.namespace,
+ META-INF.cxf,
+ META-INF.cxf.osgi,
+ org.apache.cxf,
+ org.apache.cxf.bus,
+ org.apache.cxf.bus.spring,
+ org.apache.cxf.bus.resource,
+ org.apache.cxf.configuration.spring,
+ org.apache.cxf.resource,
+ org.apache.cxf.interceptor, org.apache.cxf.io, org.apache.cxf.message, org.apache.cxf.phase, org.apache.cxf.ws.addressing, org.apache.cxf.ws.rm,
+ org.apache.cxf.transport.http_osgi,
+ org.apache.servicemix.util,
+ org.springframework.beans.factory.config
+ </Import-Package>
+ <Private-Package>org.apache.servicemix.examples.cxf</Private-Package>
+ <Require-Bundle>org.apache.cxf.bundle</Require-Bundle>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <configuration>
+ <mainClass>org.apache.servicemix.samples.cxf_ws_rm.Client</mainClass>
+ <includePluginDependencies>false</includePluginDependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: servicemix/smx4/features/trunk/examples/cxf-ws-rm/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java?rev=929870&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java Thu Apr 1 07:39:33 2010
@@ -0,0 +1,28 @@
+/**
+ * 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.
+ */
+// START SNIPPET: service
+package org.apache.servicemix.examples.cxf;
+
+import javax.jws.WebService;
+
+@WebService
+public interface HelloWorld {
+ String sayHi(String text);
+}
+// END SNIPPET: service
Propchange: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java
------------------------------------------------------------------------------
svn:executable = *
Added: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java?rev=929870&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java Thu Apr 1 07:39:33 2010
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+// START SNIPPET: service
+package org.apache.servicemix.examples.cxf;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface = "org.apache.servicemix.examples.cxf.HelloWorld")
+public class HelloWorldImpl implements HelloWorld {
+
+ public String sayHi(String text) {
+ return "Hello " + text;
+ }
+}
+// END SNIPPET: service
Propchange: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java
------------------------------------------------------------------------------
svn:executable = *
Added: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/Client.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/Client.java?rev=929870&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/Client.java (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/Client.java Thu Apr 1 07:39:33 2010
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.samples.cxf_ws_rm;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.net.URL;
+import java.io.File;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.servicemix.examples.cxf.HelloWorld;
+
+
+public final class Client {
+
+ private static final String USER_NAME = System.getProperty("user.name");
+
+ private static final QName SERVICE_NAME
+ = new QName("http://cxf.examples.servicemix.apache.org/", "HelloWorldImplService");
+ private static final QName PORT_NAME
+ = new QName("http://cxf.examples.servicemix.apache.org/", "HelloWorldImplPort");
+
+ private Client() {
+ }
+
+ public static void main(String args[]) throws Exception {
+ try {
+
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = Client.class.getResource("ws_rm.xml");
+ Bus bus = bf.createBus(busFile.toString());
+ bf.setDefaultBus(bus);
+ bus.getOutInterceptors().add(new MessageLossSimulator());
+ // Endpoint Address
+ Service service = Service.create(Client.class.getResource("/HelloWorld.wsdl"), SERVICE_NAME);
+
+ String endpointAddress = "http://localhost:9191/HelloWorld";
+
+ // Add a port to the Service
+ service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
+ HelloWorld hw = service.getPort(HelloWorld.class);
+
+ String[] names = new String[] {"Anne", "Bill", "Chris", "Daisy"};
+ // make a sequence of 4 invocations
+ for (int i = 0; i < 4; i++) {
+ System.out.println("Calling HelloWorld service");
+ System.out.println(hw.sayHi(names[i]));
+ }
+
+ // allow aynchronous resends to occur
+ Thread.sleep(60 * 1000);
+ bus.shutdown(true);
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ } finally {
+ System.exit(0);
+ }
+ }
+}
Propchange: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/Client.java
------------------------------------------------------------------------------
svn:executable = *
Added: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/MessageLossSimulator.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/MessageLossSimulator.java?rev=929870&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/MessageLossSimulator.java (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/MessageLossSimulator.java Thu Apr 1 07:39:33 2010
@@ -0,0 +1,131 @@
+/**
+ * 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.
+ */
+
+package org.apache.servicemix.samples.cxf_ws_rm;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigInteger;
+import java.util.ListIterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
+import org.apache.cxf.io.AbstractWrappedOutputStream;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseInterceptor;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.rm.RMContextUtils;
+
+/**
+ *
+ */
+public class MessageLossSimulator extends AbstractPhaseInterceptor<Message> {
+
+ private static final Logger LOG = Logger.getLogger(MessageLossSimulator.class.getName());
+ private int appMessageCount;
+
+ public MessageLossSimulator() {
+ super(Phase.PREPARE_SEND);
+ addBefore(MessageSenderInterceptor.class.getName());
+ }
+
+
+ public void handleMessage(Message message) throws Fault {
+ AddressingProperties maps =
+ RMContextUtils.retrieveMAPs(message, false, true);
+ RMContextUtils.ensureExposedVersion(maps);
+ String action = null;
+ if (maps != null && null != maps.getAction()) {
+ action = maps.getAction().getValue();
+ }
+ if (RMContextUtils.isRMProtocolMessage(action)) {
+ return;
+ }
+ appMessageCount++;
+ // do not discard odd-numbered messages
+ if (0 != (appMessageCount % 2)) {
+ return;
+ }
+
+ // discard even-numbered message
+ InterceptorChain chain = message.getInterceptorChain();
+ ListIterator it = chain.getIterator();
+ while (it.hasNext()) {
+ PhaseInterceptor pi = (PhaseInterceptor)it.next();
+ if (MessageSenderInterceptor.class.getName().equals(pi.getId())) {
+ chain.remove(pi);
+ LOG.fine("Removed MessageSenderInterceptor from interceptor chain.");
+ break;
+ }
+ }
+
+ message.setContent(OutputStream.class, new WrappedOutputStream(message));
+
+ message.getInterceptorChain().add(new AbstractPhaseInterceptor<Message>(Phase.PREPARE_SEND_ENDING) {
+
+ public void handleMessage(Message message) throws Fault {
+ try {
+ message.getContent(OutputStream.class).close();
+ } catch (IOException e) {
+ throw new Fault(e);
+ }
+ }
+
+ });
+ }
+
+ private class WrappedOutputStream extends AbstractWrappedOutputStream {
+
+ private Message outMessage;
+
+ public WrappedOutputStream(Message m) {
+ this.outMessage = m;
+ }
+
+ @Override
+ protected void onFirstWrite() throws IOException {
+ if (LOG.isLoggable(Level.FINE)) {
+ BigInteger nr = RMContextUtils.retrieveRMProperties(outMessage, true)
+ .getSequence().getMessageNumber();
+ LOG.fine("Losing message " + nr);
+ }
+ wrappedStream = new DummyOutputStream();
+ }
+ }
+
+
+
+ private class DummyOutputStream extends OutputStream {
+
+ @Override
+ public void write(int b) throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
+
+
+}
Propchange: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/MessageLossSimulator.java
------------------------------------------------------------------------------
svn:executable = *
Added: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/HelloWorld.wsdl
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/HelloWorld.wsdl?rev=929870&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/HelloWorld.wsdl (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/HelloWorld.wsdl Thu Apr 1 07:39:33 2010
@@ -0,0 +1,52 @@
+<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="HelloWorldImplService" targetNamespace="http://cxf.examples.servicemix.apache.org/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://cxf.examples.servicemix.apache.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://cxf.examples.servicemix.apache.org/" xmlns="http://cxf.examples.servicemix.apache.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:complexType name="sayHi">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="sayHiResponse">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="sayHi" nillable="true" type="sayHi"/>
+ <xs:element name="sayHiResponse" nillable="true" type="sayHiResponse"/>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="sayHi">
+ <wsdl:part element="tns:sayHi" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="sayHiResponse">
+ <wsdl:part element="tns:sayHiResponse" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="sayHi">
+ <wsdl:input message="tns:sayHi" name="sayHi">
+ </wsdl:input>
+ <wsdl:output message="tns:sayHiResponse" name="sayHiResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="tns:HelloWorld">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="sayHi">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="sayHi">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sayHiResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloWorldImplService">
+ <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
+ <soap:address location="http://localhost:9191/HelloWorld"/>
+ <wswa:UsingAddressing xmlns:wswa="http://www.w3.org/2005/02/addressing/wsdl"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/META-INF/spring/beans.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/META-INF/spring/beans.xml?rev=929870&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/META-INF/spring/beans.xml (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/META-INF/spring/beans.xml Thu Apr 1 07:39:33 2010
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:wsa="http://cxf.apache.org/ws/addressing"
+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+ xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"
+ xsi:schemaLocation="
+ http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://schemas.xmlsoap.org/ws/2005/02/rm/policy http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
+ http://cxf.apache.org/ws/rm/manager http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd
+ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-rm.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-addr.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+
+ <jaxws:endpoint id="helloWorld"
+ implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
+ wsdlLocation="classpath:HelloWorld.wsdl"
+ address="http://localhost:9191/HelloWorld"/>
+ <cxf:bus>
+ <cxf:features>
+ <cxf:logging/>
+ <wsa:addressing/>
+ <wsrm-mgr:reliableMessaging>
+ <wsrm-policy:RMAssertion>
+ <wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/>
+ <wsrm-policy:AcknowledgementInterval Milliseconds="2000"/>
+ </wsrm-policy:RMAssertion>
+ <wsrm-mgr:destinationPolicy>
+ <wsrm-mgr:acksPolicy intraMessageThreshold="0" />
+ </wsrm-mgr:destinationPolicy>
+ </wsrm-mgr:reliableMessaging>
+ </cxf:features>
+ </cxf:bus>
+ <http:conduit name="{http://cxf.examples.servicemix.apache.org/}HelloWorldImplPort.http-conduit">
+ <http:client DecoupledEndpoint="http://localhost:9990/decoupled_endpoint"/>
+ </http:conduit>
+</beans>
+<!-- END SNIPPET: beans -->
Propchange: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/META-INF/spring/beans.xml
------------------------------------------------------------------------------
svn:executable = *
Added: servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/org/apache/servicemix/samples/cxf_ws_rm/ws_rm.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/org/apache/servicemix/samples/cxf_ws_rm/ws_rm.xml?rev=929870&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/org/apache/servicemix/samples/cxf_ws_rm/ws_rm.xml (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-rm/src/main/resources/org/apache/servicemix/samples/cxf_ws_rm/ws_rm.xml Thu Apr 1 07:39:33 2010
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:wsa="http://cxf.apache.org/ws/addressing"
+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+ xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"
+ xsi:schemaLocation="
+ http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+ http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://schemas.xmlsoap.org/ws/2005/02/rm/policy http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
+ http://cxf.apache.org/ws/rm/manager http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <cxf:bus>
+ <cxf:features>
+ <cxf:logging/>
+ <wsa:addressing/>
+ <wsrm-mgr:reliableMessaging>
+ <wsrm-policy:RMAssertion>
+ <wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/>
+ <wsrm-policy:AcknowledgementInterval Milliseconds="2000"/>
+ </wsrm-policy:RMAssertion>
+ <wsrm-mgr:destinationPolicy>
+ <wsrm-mgr:acksPolicy intraMessageThreshold="0" />
+ </wsrm-mgr:destinationPolicy>
+ </wsrm-mgr:reliableMessaging>
+ </cxf:features>
+ </cxf:bus>
+
+ <http:conduit name="{http://cxf.examples.servicemix.apache.org/}HelloWorldImplPort.http-conduit">
+ <http:client DecoupledEndpoint="http://localhost:9990/decoupled_endpoint"/>
+ </http:conduit>
+</beans>
+
Modified: servicemix/smx4/features/trunk/examples/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/pom.xml?rev=929870&r1=929869&r2=929870&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/examples/pom.xml (original)
+++ servicemix/smx4/features/trunk/examples/pom.xml Thu Apr 1 07:39:33 2010
@@ -48,6 +48,7 @@
<module>cxf-ws-addressing</module>
<module>cxf-wsdl-first-osgi-package</module>
<module>cxf-ws-security-osgi</module>
+ <module>cxf-ws-rm</module>
<module>itests</module>
</modules>