Tutorials
Example integration applications
Copyright © 2013 Red Hat, Inc. and/or its affiliates.
Abstract
Chapter 1. Deploying a Web Service into Red Hat JBoss Fuse Copy linkLink copied to clipboard!
Abstract
InstallDir/examples/cxf-osgi folder of your Red Hat JBoss Fuse installation.
client.html, that will allow you to access the service once it is exposed.
1.1. Deploying the Example Copy linkLink copied to clipboard!
Installing a prebuilt version of the example Copy linkLink copied to clipboard!
features:install examples-cxf-osgi
Building and deploying the example yourself Copy linkLink copied to clipboard!
- If you installed the examples-cxf-osgi feature, first uninstall it by running the following from the Red Hat JBoss Fuse console:
features:uninstall examples-cxf-osgi - In a separate command window or terminal, change to the root folder of the example.
cd InstallDir/examples/cxf-osgi - Enter the following command:
mvn install
mvn installCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command will build a bundle calledcxf-osgi-6.0.0.redhat-024.jarand place it into thetargetfolder of the example. - Copy the bundle to
InstallDir/deployto deploy it to the container.
Testing the example Copy linkLink copied to clipboard!
Example 1.1. CXF OSGi Example WSDL
1.2. Running a client Copy linkLink copied to clipboard!
Running the web client Copy linkLink copied to clipboard!
- Open the
client.html, which is located at the root of thecxf-osgiexample folder. - Click the button to send a request.
Figure 1.1. Example Client HTML Screen
Once the request has been successfully sent, a response message appears in the right-hand panel of the web page
Running the Java client Copy linkLink copied to clipboard!
- In a command prompt or terminal, change to the
InstallDir/examples/cxf-osgi directory. - Run the following command:
mvn compile exec:javaIf the client request is successful, a response similar to the following is returned to the command window:the response is =====> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body> <ns2:sayHiResponse xmlns:ns2="http://cxf.examples.servicemix.apache.org/"> <return>Hello John Doe</return></ns2:sayHiResponse></soap:Body></soap:Envelope>
the response is =====> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body> <ns2:sayHiResponse xmlns:ns2="http://cxf.examples.servicemix.apache.org/"> <return>Hello John Doe</return></ns2:sayHiResponse></soap:Body></soap:Envelope>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.3. Understanding the Example Copy linkLink copied to clipboard!
Overview Copy linkLink copied to clipboard!
sayHi(). Once deployed, the service is exposed as a SOAP/HTTP endpoint. The most interesting parts of the example are the Spring configuration used to configure the endpoint and the Maven POM used to build the bundle.
Using the Maven tools Copy linkLink copied to clipboard!
Example 1.2. POM Elements for Using Red Hat JBoss Fuse OSGi Tooling
The Spring configuration Copy linkLink copied to clipboard!
\src\main\resources\META-INF\spring\beans.xml file.
Example 1.3. OSGi Example Spring Configuration
- 1
- Imports the required configuration to load the required parts of the Apache CXF runtime.
- 2
- Configures the endpoint that exposes the service using the
jaxws:endpointelement and its attributes.idis an identifier used by the configuration mechanism.implementorspecifies the class that implements the service. It must be on the classpath.addressspecifies the address at which the service will be exposed. This address is relative to the containers HTTP address withcxfappended to it.
The POM Copy linkLink copied to clipboard!
Example 1.4. OSGi POM
Index Copy linkLink copied to clipboard!
M
- Maven tooling, Using the Maven tools
Legal Notice Copy linkLink copied to clipboard!
Trademark Disclaimer
Legal Notice Copy linkLink copied to clipboard!
Third Party Acknowledgements
- JLine (http://jline.sourceforge.net) jline:jline:jar:1.0License: BSD (LICENSE.txt) - Copyright (c) 2002-2006, Marc Prud'hommeaux
mwp1@cornell.eduAll rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of JLine nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - Stax2 API (http://woodstox.codehaus.org/StAX2) org.codehaus.woodstox:stax2-api:jar:3.1.1License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)Copyright (c) <YEAR>, <OWNER> All rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - jibx-run - JiBX runtime (http://www.jibx.org/main-reactor/jibx-run) org.jibx:jibx-run:bundle:1.2.3License: BSD (http://jibx.sourceforge.net/jibx-license.html) Copyright (c) 2003-2010, Dennis M. Sosnoski.All rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of JiBX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - JavaAssist (http://www.jboss.org/javassist) org.jboss.javassist:com.springsource.javassist:jar:3.9.0.GA:compileLicense: MPL (http://www.mozilla.org/MPL/MPL-1.1.html)
- HAPI-OSGI-Base Module (http://hl7api.sourceforge.net/hapi-osgi-base/) ca.uhn.hapi:hapi-osgi-base:bundle:1.2License: Mozilla Public License 1.1 (http://www.mozilla.org/MPL/MPL-1.1.txt)