Skip to content

Commit

Permalink
Initial CXF example project
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Korab committed Feb 14, 2012
0 parents commit d9e1eff
Show file tree
Hide file tree
Showing 13 changed files with 694 additions and 0 deletions.
9 changes: 9 additions & 0 deletions greeter-api/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source.. = src/main/java/,src/main/resources/,src/test/java,src/test/resources
output.. = target/classes/,target/test-classes
bin.includes = META-INF/,\
.,\
target/classes/
src.includes = src/main/java/,\
src/main/resources/,\
src/test/java/,\
src/test/resources/
66 changes: 66 additions & 0 deletions greeter-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>cxf-camel</artifactId>
<groupId>com.fusesource.examples</groupId>
<version>1.0-SNAPSHOT</version>
</parent>

<groupId>com.fusesource.examples</groupId>
<artifactId>greeter-api</artifactId>
<name>${application-name} :: ${project.artifactId}</name>
<version>1.0-SNAPSHOT</version>
<packaging>bundle</packaging>

<properties>
<osgi-export-package>wsdl,com.fusesource.examples.greeter,com.fusesource.examples.greeter.model</osgi-export-package>
</properties>

<build>
<defaultGoal>install</defaultGoal>

<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf-version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/greeter.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<!-- to generate the MANIFEST-FILE of the bundle -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>${osgi-export-package}</Export-Package>
</instructions>
</configuration>
</plugin>

</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">

<!-- definitions using elements of the osgi namespace can be included
in this file. There is no requirement to keep these definitions
in a separate file if you do not want to. The rationale for
keeping these definitions separate is to facilitate integration
testing of the bundle outside of an OSGi container -->
</beans>
10 changes: 10 additions & 0 deletions greeter-api/src/main/resources/META-INF/spring/bundle-context.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<!-- regular spring configuration file defining the beans for this
bundle. The configuration of OSGi definitions is kept in a separate
configuration file so that this file can easily be used
for integration testing outside of an OSGi environment -->
</beans>
8 changes: 8 additions & 0 deletions greeter-api/src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
log4j.rootCategory=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout.ConversionPattern=%t %p [%c] - %m%n
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.threshold=TRACE

#log4j.logger.org.springframework.osgi=DEBUG
#log4j.logger.org.springframework=DEBUG
175 changes: 175 additions & 0 deletions greeter-api/src/main/resources/wsdl/greeter.wsdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="HelloWorld"
targetNamespace="http://examples.fusesource.com/greeter"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://examples.fusesource.com/greeter"
xmlns:x1="http://examples.fusesource.com/greeter/model"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<!-- define a schema to be used by this service; can also be imported -->
<schema targetNamespace="http://examples.fusesource.com/greeter/model"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<element name="sayHi">
<complexType>
<sequence>
<element name="requestType" type="string"/>
</sequence>
</complexType>
</element>
<element name="sayHiResponse">
<complexType>
<sequence>
<element name="responseType" type="string"/>
</sequence>
</complexType>
</element>
<element name="greetMe">
<complexType>
<sequence>
<element name="requestType" type="string"/>
</sequence>
</complexType>
</element>
<element name="greetMeResponse">
<complexType>
<sequence>
<element name="responseType" type="string"/>
</sequence>
</complexType>
</element>
<element name="greetMeOneWay">
<complexType>
<sequence>
<element name="requestType" type="string"/>
</sequence>
</complexType>
</element>
<element name="pingMe">
<complexType/>
</element>
<element name="pingMeResponse">
<complexType/>
</element>
<element name="faultDetail">
<complexType>
<sequence>
<element name="minor" type="short"/>
<element name="major" type="short"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>

<!-- map message types to schema elements -->
<wsdl:message name="sayHiRequest">
<wsdl:part element="x1:sayHi" name="in"/>
</wsdl:message>
<wsdl:message name="sayHiResponse">
<wsdl:part element="x1:sayHiResponse" name="out"/>
</wsdl:message>
<wsdl:message name="greetMeRequest">
<wsdl:part element="x1:greetMe" name="in"/>
</wsdl:message>
<wsdl:message name="greetMeResponse">
<wsdl:part element="x1:greetMeResponse" name="out"/>
</wsdl:message>
<wsdl:message name="greetMeOneWayRequest">
<wsdl:part element="x1:greetMeOneWay" name="in"/>
</wsdl:message>
<wsdl:message name="pingMeRequest">
<wsdl:part name="in" element="x1:pingMe"/>
</wsdl:message>
<wsdl:message name="pingMeResponse">
<wsdl:part name="out" element="x1:pingMeResponse"/>
</wsdl:message>
<wsdl:message name="pingMeFault">
<wsdl:part name="faultDetail" element="x1:faultDetail"/>
</wsdl:message>

<!-- maps operations to message types -->
<wsdl:portType name="Greeter">
<wsdl:operation name="sayHi">
<wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
<wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
</wsdl:operation>

<wsdl:operation name="greetMe">
<wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
<wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
</wsdl:operation>

<wsdl:operation name="greetMeOneWay">
<wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
</wsdl:operation>

<wsdl:operation name="pingMe">
<wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/>
<wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/>
<wsdl:fault name="pingMeFault" message="tns:pingMeFault"/>
</wsdl:operation>
</wsdl:portType>

<!-- maps SOAP operations to the way that input, output and fault are used -->
<wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">

<!--
the style attribute indicates whether the operation is RPC-oriented
(messages containing parameters and return values) or document-oriented
(message containing document(s))
-->
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="sayHi">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="sayHiRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHiResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

<wsdl:operation name="greetMe">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="greetMeRequest">
<!-- literal means that the body references a concrete schema definition, above -->
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="greetMeResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

<wsdl:operation name="greetMeOneWay">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="greetMeOneWayRequest">
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>

<wsdl:operation name="pingMe">
<soap:operation style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="pingMeFault">
<soap:fault name="pingMeFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>

<!-- maps a service binding to a service URL -->
<wsdl:service name="SOAPService">
<wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
<soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
8 changes: 8 additions & 0 deletions greeter-api/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
log4j.rootCategory=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout.ConversionPattern=%t %p [%c] - %m%n
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.threshold=TRACE

#log4j.logger.org.springframework.osgi=DEBUG
#log4j.logger.org.springframework=DEBUG
4 changes: 4 additions & 0 deletions greeter-api/template.mf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Excluded-Exports:
*.internal*
Unversioned-Imports:
*
92 changes: 92 additions & 0 deletions greeter-routes/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fusesource.examples</groupId>
<artifactId>cxf-camel</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<groupId>com.fusesource.examples</groupId>
<artifactId>greeter-routes</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>bundle</packaging>

<name>${application-name} :: ${project.artifactId}</name>

<properties>
<osgi-import-package>META-INF.cxf,wsdl,*</osgi-import-package>
<osgi-dynamicimport-package>org.apache.cxf.*,org.springframework.beans.*</osgi-dynamicimport-package>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>greeter-api</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-soap</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jetty</artifactId>
<version>${camel-version}</version>
</dependency>

<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j-version}</version>
</dependency>
</dependencies>

<build>
<defaultGoal>install</defaultGoal>

<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Import-Package>${osgi-import-package}</Import-Package>
<DynamicImport-Package>${osgi-dynamicimport-package}
</DynamicImport-Package>
</instructions>
</configuration>
</plugin>

</plugins>
</build>
</project>
Loading

0 comments on commit d9e1eff

Please sign in to comment.