Skip to main content Skip to complementary content

Service interface

About this task

Within Eclipse:

Procedure

  1. Create a Maven project, following the same steps as in this section, and call it locator_common for the purposes of this example.
  2. Remove all default sources, as well as test source folder.
  3. Create a package named demo.common, and create an interface Greeter.java:
    package demo.common;
    
    import javax.jws.WebService;
    
    @WebService(targetNamespace = "http://talend.org/esb/examples/", 
            name = "Greeter")
    public interface Greeter {
        String greetMe(String requestType);
    }
    Greeter.java will be the service interface. The project structure will look like this:

    Example

  4. The common application will be deployed as an OSGi bundle. You will need to edit the pom.xml file.
    <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/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.talend.liugang.cxf</groupId>
        <artifactId>locator_common</artifactId>
        <version>1.0.0</version>
        <packaging>bundle</packaging>
        <name>locator_common</name>
        <url>http://maven.apache.org</url>
    
        <dependencies>
            <dependency>
                <groupId>org.apache.felix</groupId>
                <artifactId>org.osgi.core</artifactId>
                <version>1.4.0</version>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <extensions>true</extensions>
                    <version>2.3.7</version>
                    <configuration>
                        <instructions>
                            <Bundle-SymbolicName>
                                ${project.artifactId}
                            </Bundle-SymbolicName>
                            <Export-Package>
                                demo.common
                            </Export-Package>
                        </instructions>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>
    
  5. Now that you have finished the definition of the service, select Run As > Maven Install from the M2Eclipse Popup menu on the pom.xml to install the application into your Maven repository.
    The next step is to implement this service.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!