Skip to content

Commit

Permalink
Adding camel based web service
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Korab committed Feb 14, 2012
1 parent e11d420 commit 90c0124
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 42 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@

<modules>
<module>greeter-api</module>
<module>ws-camel-client</module>
<module>ws-cxf-service</module>
<module>ws-camel-service</module>
<module>ws-camel-client</module>
</modules>

<properties>
Expand Down
34 changes: 34 additions & 0 deletions ws-camel-service/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2012 FuseSource
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<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>ws-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../ws-parent</relativePath>
</parent>

<groupId>com.fusesource.examples</groupId>
<artifactId>ws-camel-service</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>bundle</packaging>

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

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:cxf="http://camel.apache.org/schema/cxf"
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
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf-2.8.3.xsd">

<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
Expand All @@ -42,18 +40,6 @@
</cxf:outInterceptors>
</cxf:cxfEndpoint>

<!-- this plain cxf endpoint works off the metadata from our implementation class; note the namespace -->
<jaxws:endpoint id="greeterImpl"
address="http://localhost:9090/greeterImpl"
implementor="com.fusesource.examples.greeter.impl.GreeterService">
<jaxws:inInterceptors>
<ref bean="loggingInInterceptor"/>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<ref bean="loggingOutInterceptor"/>
</jaxws:outInterceptors>
</jaxws:endpoint>

<camelContext id="context.greeter-routes" xmlns="http://camel.apache.org/schema/spring">

<route id="cxfInterfaceToLog">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.fusesource.examples.greeter.PingMeFault;
import com.fusesource.examples.greeter.model.FaultDetail;

public class GreeterService implements Greeter {
public class ConcreteGreeter implements Greeter {
private Logger log = LoggerFactory.getLogger(this.getClass());

public void greetMeOneWay(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,19 @@
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:cxf="http://camel.apache.org/schema/cxf"
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
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf-2.8.3.xsd">
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
<bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>

<!-- this is an camel cxf endpoint that takes its configuration from the interface generated by wsdl2java -->
<cxf:cxfEndpoint id="greeter"
address="http://localhost:9090/greeter"
serviceClass="com.fusesource.examples.greeter.Greeter">
<cxf:inInterceptors>
<ref bean="loggingInInterceptor"/>
</cxf:inInterceptors>
<cxf:outInterceptors>
<ref bean="loggingOutInterceptor"/>
</cxf:outInterceptors>
</cxf:cxfEndpoint>

<!-- this plain cxf endpoint works off the metadata from our implementation class; note the namespace -->
<jaxws:endpoint id="greeterImpl"
address="http://localhost:9090/greeterImpl"
implementor="com.fusesource.examples.greeter.impl.GreeterService">
implementor="com.fusesource.examples.greeter.impl.ConcreteGreeter">
<jaxws:inInterceptors>
<ref bean="loggingInInterceptor"/>
</jaxws:inInterceptors>
Expand All @@ -54,14 +40,4 @@
</jaxws:outInterceptors>
</jaxws:endpoint>

<camelContext id="context.greeter-routes" xmlns="http://camel.apache.org/schema/spring">

<route id="cxfInterfaceToLog">
<from uri="cxf:bean:greeter?dataFormat=MESSAGE"/>
<convertBodyTo type="String"/>
<log message="SOAP message received : ${body} and operation type : ${in.header.SOAPAction}"/>
</route>

</camelContext>

</beans>

0 comments on commit 90c0124

Please sign in to comment.