...
Configuring the cxf-
...
se-su service unit
...
On this page, we are going to INLINE
configure the my- cxf-se-su service unit to provide our service webservice Excerpt
...
Configuring the pom.xml
First of all we need to move into the created folder my-cxf-se-su.
Changing the project name
In order to make the build output a little bit more comprehensible , we first change the project name in the generated pom.xml file.
...
...
Adding parent's element to generated pom.xml
...
No Format |
---|
<parent>
<artifactId>parent</artifactId>
<groupId>org.apache.servicemix.tutorial</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
|
Adding version of cxf to pom.xml
We must specify the version of CXF .
...
to use:
...
Adding the org.apache.cxf plugin
We add this plugin to the generated pom.xml file to element plugins.
...
This plugin is used for generating java classes from the WSDL file. We use the wsdl2java tool from JAX-WS (CXF framework).
The next step is to copy the WSDL file we already made in the my-cxf-bc-su to the my-cxf-se-su because we need it to generate
the java classes from it. So copy it now:
- from folder: my-cxf-bc-su/src/main/resources
- to folder: my-cxf-se-su/src/main/resources
Implementing generated ExampleService.java
We must implement our service in java. In our example, it's HelloImpl.java
...
directory src/main/java/org/apache/servicemix/examples is generated java file ExampleService.java.
So, we must rename this file to HelloImpl.java and change its content on this:
...
Adding org.apache.cxf plugin
We add this plugin to the generated pom.xml file to element plugins.
No Format |
---|
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf-version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/target/jaxws</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/service.wsdl</wsdl>
<extraargs>
<extraarg>-verbose</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
|
Configuring xbean.xml
Next we have to configure our new SU to really provide some webservice. We do this by modifying the file
named xbean.xml in the src/main/resources directory of our my-cxf-se-su module:
...
Where service.wsdl is WSDL file, which we made in my-cxf-bc-su. We must copy this WSDL file from my-cxf-bc-su/src/main/resources to
my-cxf-se-su/src/main/resources.Next, we are going to create our second SUservice assembly.
Things to remember
- You specify the plugin for a SU in Maven's pom.xml file
- In ServiceMix, most service units will be configured by a file named xbean.xml
...
Proceed to the next step
...