이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 1. Deploying a Web Service into Red Hat JBoss Fuse


Abstract

Here we will take an in depth look at the CXF OSGi example, a JAX-WS web service packaged as an OSGi bundle.
You are going to build and deploy a simple service that is based on a WSDL document. The source for this example can be found in the InstallDir/examples/cxf-osgi folder of your Red Hat JBoss Fuse installation.
The example uses the JBoss Fuse Maven tooling to build a bundle that contains the service implementation and all of the metadata needed to deploy it into the JBoss Fuse container.
The sample code includes a web page, client.html, that will allow you to access the service once it is exposed.

1.1. Deploying the Example

Before you run the example, start Red Hat JBoss Fuse.

Installing a prebuilt version of the example

To install and run a prebuilt version of this example, enter the following command in the Red Hat JBoss Fuse console:
features:install examples-cxf-osgi

Building and deploying the example yourself

To build and deploy the example do the following:
  1. 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
  2. In a separate command window or terminal, change to the root folder of the example.
    cd InstallDir/examples/cxf-osgi
  3. Enter the following command:
    mvn install
    Copy to Clipboard Toggle word wrap
    This command will build a bundle called cxf-osgi-6.0.0.redhat-024.jar and place it into the target folder of the example.
  4. Copy the bundle to InstallDir/deploy to deploy it to the container.

Testing the example

To see if the example is running you can visit http://localhost:8181/cxf/HelloWorld?wsdl in your Web browser. You should see the WSDL shown in Example 1.1, “CXF OSGi Example WSDL”.

Example 1.1. CXF OSGi Example WSDL

<wsdl:definitions name="HelloWorldImplService"
                  targetNamespace="http://cxf.examples.servicemix.apache.org/">
  <wsdl:types>
    <xs:schema attributeFormDefault="unqualified"
               elementFormDefault="unqualified"
               targetNamespace="http://cxf.examples.servicemix.apache.org/">
      <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="sayHiResponse">
    <wsdl:part element="tns:sayHiResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="sayHi">
    <wsdl:part element="tns:sayHi" 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:8181/cxf/HelloWorld"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat