Skip to content

Latest commit

 

History

History

soap_contract_first

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Camel-CXF SOAP (Contract First) example

This project creates a simple Customer Order SOAP service with 2 operations and exposes them via CXF. It uses a contract-first approach that requires the WSDL be hand written ahead of time.

Requirements:

Building

To build the project run the following Maven command:

mvn clean install

This will build the bundle including all of the manifest information.

Deploying to Red Hat Fuse

To start up Fuse browse to your fuse install directory. Then run

/bin/fuse

This will bring up the Fuse console and from there you can install your bundle. To install the bundle, use one of the following commands:

karaf@root> osgi:install -s file:/home/yourUser/.m2/repository/com/redhat/consulting/fusequickstarts/karaf/soap-contract-first/7.6/soap-contract-first-7.6.jar
    OR
karaf@root> osgi:install -s mvn:com.redhat.consulting.fusequickstarts.karaf/soap-contract-first/7.6

The -s indicates that the bundle should be started after it is installed. If you leave it off you can start the bundle using the following command:

karaf@root> osgi:start <bundleId>

Testing

Once the bundle is deployed you can validate that Web Service was created and started by checking the CXF Service List at http://localhost:8181/cxf. Here you should see the Customer Order service listed under Available SOAP services. You may view the generated WSDL at:

You can test the services using the following SOAP Requests using a tool such as SoapUI.

For Place Order use

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.service.soap.karaf.fusequickstarts.consulting.redhat.com/">
<soapenv:Header/>
<soapenv:Body>
  <ws:placeOrder>
     <customerOrder>
        <item>Widget</item>
        <orderId>ORD78K</orderId>
        <quantity>3</quantity>
     </customerOrder>
  </ws:placeOrder>
</soapenv:Body>
</soapenv:Envelope>

or for Get Order use

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.service.soap.karaf.fusequickstarts.consulting.redhat.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <ws:getOrder>
         <orderId>ORD36X</orderId>
      </ws:getOrder>
   </soapenv:Body>
</soapenv:Envelope>

Additional Reading

More information about creating a Contract First SOAP Web Service can be found here:

Troubleshooting

If you run into any problems starting the Quick Start, check out some of the solutions below to get them working.

javax.jws Wiring Error

If you are seeing the following error

 Unable to start bundle mvn:com.redhat.consulting.fusequickstarts.karaf/soap: Unresolved constraint in bundle com.redhat.consulting.fusequickstarts.karaf.soap [275]: Unable to resolve 275.0: missing requirement [275.0] osgi.wiring.package; (&(osgi.wiring.package=javax.jws)(version>=2.0.0)(!(version>=3.0.0)))

then you need to install the JAX-WS 2.0 annotation classes into Fuse as a Dependency. You can do that with the following command

install wrap:mvn:org.apache.geronimo.specs/geronimo-ws-metadata_2.0_spec/1.1.3