You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/08/07 03:08:52 UTC
svn commit: r683457 - in /servicemix/smx4/features/trunk/examples: ./
cxf-handler-cfg/ cxf-handler-cfg/src/ cxf-handler-cfg/src/main/
cxf-handler-cfg/src/main/java/ cxf-handler-cfg/src/main/java/org/
cxf-handler-cfg/src/main/java/org/apache/ cxf-handle...
Author: ffang
Date: Wed Aug 6 18:08:51 2008
New Revision: 683457
URL: http://svn.apache.org/viewvc?rev=683457&view=rev
Log:
[SMX4-82]Add soap handler osgi test to servicemix 4 trunk/examples
Added:
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/pom.xml (with props)
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/AddNumbersImpl.java (with props)
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/ModifyNumberHandler.java (with props)
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/META-INF/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/META-INF/spring/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/META-INF/spring/beans.xml (with props)
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/wsdl/
servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/wsdl/addNumbers.wsdl (with props)
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/pom.xml (with props)
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/AddNumbersImpl.java (with props)
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/LoggingHandler.java (with props)
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/SmallNumberHandler.java (with props)
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/META-INF/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/META-INF/spring/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/META-INF/spring/beans.xml (with props)
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/config/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/config/demo_handlers.xml (with props)
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/wsdl/
servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/wsdl/addNumbers.wsdl (with props)
Modified:
servicemix/smx4/features/trunk/examples/itests/pom.xml
servicemix/smx4/features/trunk/examples/itests/src/test/java/org/apache/servicemix/examples/IntegrationTest.java
servicemix/smx4/features/trunk/examples/pom.xml
Added: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-handler-cfg/pom.xml?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-handler-cfg/pom.xml (added)
+++ servicemix/smx4/features/trunk/examples/cxf-handler-cfg/pom.xml Wed Aug 6 18:08:51 2008
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.examples</groupId>
+ <artifactId>examples</artifactId>
+ <version>4.0-m2-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix.examples</groupId>
+ <artifactId>cxf-handler-cfg</artifactId>
+ <packaging>bundle</packaging>
+ <version>4.0-m2-SNAPSHOT</version>
+ <name>Apache ServiceMix Example :: CXF SOAP HANDLER OSGi</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>${cxf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
+ <version>${geronimo.wsmetadata.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-codegen-plugin</artifactId>
+ <version>${cxf.version}</version>
+ <executions>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
+ <wsdlOptions>
+ <wsdlOption>
+ <wsdl>${basedir}/src/main/resources/wsdl/addNumbers.wsdl</wsdl>
+ </wsdlOption>
+ </wsdlOptions>
+ </configuration>
+ <goals>
+ <goal>wsdl2java</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Import-Package>
+ javax.jws,
+ javax.wsdl,
+ javax.xml.bind,
+ javax.xml.bind.annotation,
+ javax.xml.namespace,
+ javax.xml.soap,
+ javax.xml.transform,
+ javax.xml.ws,
+ javax.xml.ws.handler,
+ javax.xml.ws.handler.soap,
+ META-INF.cxf,
+ META-INF.cxf.osgi,
+ org.apache.cxf.bus,
+ org.apache.cxf.bus.spring,
+ org.apache.cxf.bus.resource,
+ org.apache.cxf.configuration.spring,
+ org.apache.cxf.resource,
+ org.apache.servicemix.cxf.transport.http_osgi,
+ org.springframework.beans.factory.config
+ </Import-Package>
+ <Require-Bundle>org.apache.cxf.cxf-bundle</Require-Bundle>
+ <Export-Package>org.apache.springcfg.handlers.types,org.apache.springcfg.handlers,org.apache.servicemix.examples.cxf.springcfghandler</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/AddNumbersImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/AddNumbersImpl.java?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/AddNumbersImpl.java (added)
+++ servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/AddNumbersImpl.java Wed Aug 6 18:08:51 2008
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.servicemix.examples.cxf.springcfghandler;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+import org.apache.springcfg.handlers.AddNumbers;
+import org.apache.springcfg.handlers.AddNumbersFault;
+import org.apache.springcfg.handlers.types.FaultDetail;
+
+
+@WebService(name = "AddNumbers",
+ targetNamespace = "http://apache.org/handlers",
+ portName = "AddNumbersPort",
+ endpointInterface = "org.apache.springcfg.handlers.AddNumbers",
+ serviceName = "AddNumbersService")
+
+public class AddNumbersImpl implements AddNumbers {
+
+
+ /**
+ * @param number1
+ * @param number2
+ * @return The sum
+ * @throws AddNumbersException
+ * if any of the numbers to be added is negative.
+ */
+ public int addNumbers(int number1, int number2) throws AddNumbersFault {
+ System.out.println("addNumbers called....." + number1 + ":" + number2);
+ if (number1 < 0 || number2 < 0) {
+ String message = "Negative number cant be added!";
+ String detail = "Numbers: " + number1 + ", " + number2;
+ FaultDetail fault = new FaultDetail();
+ fault.setMessage(message);
+ fault.setFaultInfo(detail);
+ throw new AddNumbersFault(message, fault);
+ }
+ return number1 + number2;
+ }
+
+}
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/AddNumbersImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/AddNumbersImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/ModifyNumberHandler.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/ModifyNumberHandler.java?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/ModifyNumberHandler.java (added)
+++ servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/ModifyNumberHandler.java Wed Aug 6 18:08:51 2008
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.servicemix.examples.cxf.springcfghandler;
+
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.springcfg.handlers.types.AddNumbers;
+import org.apache.springcfg.handlers.types.ObjectFactory;
+
+
+/**
+ * handles addition of small numbers.
+ */
+public class ModifyNumberHandler implements LogicalHandler<LogicalMessageContext> {
+
+ public final boolean handleMessage(LogicalMessageContext messageContext) {
+ //System.out.println("LogicalMessageHandler handleMessage called");
+
+ try {
+ // get the LogicalMessage from our context
+ LogicalMessage msg = messageContext.getMessage();
+
+ // check the payload, if its an AddNumbers request, we'll intervene
+ JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
+ Object payload = msg.getPayload(jaxbContext);
+ Object value = payload;
+ if (payload instanceof JAXBElement) {
+ value = ((JAXBElement)payload).getValue();
+ }
+
+ if (value instanceof AddNumbers) {
+ AddNumbers req = (AddNumbers)value;
+
+ int a = req.getArg0();
+ req.setArg0(a * 10);
+ msg.setPayload(payload, jaxbContext);
+ }
+ return true;
+ } catch (JAXBException ex) {
+ throw new ProtocolException(ex);
+ }
+
+ }
+
+ public final boolean handleFault(LogicalMessageContext messageContext) {
+ return true;
+ }
+
+ public void close(MessageContext ctx) {
+ }
+
+}
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/ModifyNumberHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/java/org/apache/servicemix/examples/cxf/springcfghandler/ModifyNumberHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/META-INF/spring/beans.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/META-INF/spring/beans.xml?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/META-INF/spring/beans.xml (added)
+++ servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/META-INF/spring/beans.xml Wed Aug 6 18:08:51 2008
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:cxf="http://cxf.apache.org/core"
+ 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://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+ http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+ <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
+
+ <jaxws:endpoint id="SoapHandlerEndpoint"
+ implementor="org.apache.servicemix.examples.cxf.springcfghandler.AddNumbersImpl"
+ address="/SpringConfigHandler"
+ wsdlLocation="wsdl/addNumbers.wsdl"
+ endpointName="e:AddNumbersPort"
+ serviceName="s:AddNumbersService"
+ xmlns:e="http://apache.org/springcfg/handlers"
+ xmlns:s="http://apache.org/springcfg/handlers">
+ <jaxws:handlers>
+ <bean class="org.apache.servicemix.examples.cxf.springcfghandler.ModifyNumberHandler"/>
+ </jaxws:handlers>
+ </jaxws:endpoint>
+
+
+ <jaxws:client id="client"
+ serviceClass="org.apache.springcfg.handlers.AddNumbers"
+ endpointName="e:AddNumbersPort"
+ serviceName="s:AddNumbersService"
+ xmlns:e="http://apache.org/springcfg/handlers"
+ xmlns:s="http://apache.org/springcfg/handlers"
+ wsdlLocation="wsdl/addNumbers.wsdl"
+ address="http://localhost:8080/cxf/SpringConfigHandler">
+ <jaxws:handlers>
+ <bean class="org.apache.servicemix.examples.cxf.springcfghandler.ModifyNumberHandler"/>
+ </jaxws:handlers>
+ </jaxws:client>
+
+ <osgi:service id="testSpringCfgHandler" ref="client"
+ interface="org.apache.springcfg.handlers.AddNumbers"/>
+
+
+</beans>
+<!-- END SNIPPET: beans -->
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/META-INF/spring/beans.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/META-INF/spring/beans.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/META-INF/spring/beans.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/wsdl/addNumbers.wsdl
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/wsdl/addNumbers.wsdl?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/wsdl/addNumbers.wsdl (added)
+++ servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/wsdl/addNumbers.wsdl Wed Aug 6 18:08:51 2008
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<definitions
+ name="AddNumbers"
+ targetNamespace="http://apache.org/springcfg/handlers"
+ xmlns:tns="http://apache.org/springcfg/handlers"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:x1="http://apache.org/springcfg/handlers/types">
+ <types>
+ <xsd:schema
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/springcfg/handlers/types"
+ elementFormDefault="qualified">
+
+ <complexType name="addNumbersResponse">
+ <sequence>
+ <element name="return" type="xsd:int" />
+ </sequence>
+ </complexType>
+ <element name="addNumbersResponse" type="x1:addNumbersResponse"/>
+
+ <complexType name="addNumbers">
+ <sequence>
+ <element name="arg0" type="xsd:int" />
+ <element name="arg1" type="xsd:int" />
+ </sequence>
+ </complexType>
+ <element name="addNumbers" type="x1:addNumbers"/>
+
+ <element name="FaultDetail" type="x1:FaultDetail" />
+ <complexType name="FaultDetail">
+ <sequence>
+ <element name="faultInfo" type="xsd:string" />
+ <element name="message" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </xsd:schema>
+ </types>
+ <message name="addNumbers">
+ <part name="parameters" element="x1:addNumbers" />
+ </message>
+ <message name="addNumbersResponse">
+ <part name="result" element="x1:addNumbersResponse" />
+ </message>
+ <message name="addNumbersFault">
+ <part name="AddNumbersFault" element="x1:FaultDetail" />
+ </message>
+ <portType name="AddNumbers">
+ <operation name="addNumbers">
+ <input message="tns:addNumbers" />
+ <output message="tns:addNumbersResponse" />
+ <fault name="addNumbersFault" message="tns:addNumbersFault"/>
+ </operation>
+ </portType>
+ <binding name="AddNumbersBinding" type="tns:AddNumbers">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ <operation name="addNumbers">
+ <soap:operation soapAction="" />
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ <fault name="addNumbersFault">
+ <soap:fault name="addNumbersFault" use="literal" />
+ </fault>
+ </operation>
+ </binding>
+ <service name="AddNumbersService">
+ <port name="AddNumbersPort" binding="tns:AddNumbersBinding">
+ <soap:address location="http://localhost:8080/cxf/SpringConfigHandler" />
+ </port>
+ </service>
+</definitions>
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/wsdl/addNumbers.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/wsdl/addNumbers.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/smx4/features/trunk/examples/cxf-handler-cfg/src/main/resources/wsdl/addNumbers.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/pom.xml?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/pom.xml (added)
+++ servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/pom.xml Wed Aug 6 18:08:51 2008
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.examples</groupId>
+ <artifactId>examples</artifactId>
+ <version>4.0-m2-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix.examples</groupId>
+ <artifactId>cxf-soap-handler-osgi</artifactId>
+ <packaging>bundle</packaging>
+ <version>4.0-m2-SNAPSHOT</version>
+ <name>Apache ServiceMix Example :: CXF SOAP HANDLER OSGi</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>${cxf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
+ <version>${geronimo.wsmetadata.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-codegen-plugin</artifactId>
+ <version>${cxf.version}</version>
+ <executions>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
+ <wsdlOptions>
+ <wsdlOption>
+ <wsdl>${basedir}/src/main/resources/wsdl/addNumbers.wsdl</wsdl>
+ </wsdlOption>
+ </wsdlOptions>
+ </configuration>
+ <goals>
+ <goal>wsdl2java</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Import-Package>
+ javax.jws,
+ javax.wsdl,
+ javax.xml.bind,
+ javax.xml.bind.annotation,
+ javax.xml.namespace,
+ javax.xml.soap,
+ javax.xml.transform,
+ javax.xml.ws,
+ javax.xml.ws.handler,
+ javax.xml.ws.handler.soap,
+ META-INF.cxf,
+ META-INF.cxf.osgi,
+ org.apache.cxf.bus,
+ org.apache.cxf.bus.spring,
+ org.apache.cxf.bus.resource,
+ org.apache.cxf.configuration.spring,
+ org.apache.cxf.resource,
+ org.apache.servicemix.cxf.transport.http_osgi,
+ org.springframework.beans.factory.config
+ </Import-Package>
+ <Require-Bundle>org.apache.cxf.cxf-bundle</Require-Bundle>
+ <Export-Package>org.apache.handlers.types, org.apache.handlers,org.apache.servicemix.examples.cxf.soaphandler</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/AddNumbersImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/AddNumbersImpl.java?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/AddNumbersImpl.java (added)
+++ servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/AddNumbersImpl.java Wed Aug 6 18:08:51 2008
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.servicemix.examples.cxf.soaphandler;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+import org.apache.handlers.AddNumbers;
+import org.apache.handlers.AddNumbersFault;
+import org.apache.handlers.types.FaultDetail;
+
+
+@WebService(name = "AddNumbers",
+ targetNamespace = "http://apache.org/handlers",
+ portName = "AddNumbersPort",
+ endpointInterface = "org.apache.handlers.AddNumbers",
+ serviceName = "AddNumbersService")
+@HandlerChain(file = "//config/demo_handlers.xml")
+public class AddNumbersImpl implements AddNumbers {
+
+
+ /**
+ * @param number1
+ * @param number2
+ * @return The sum
+ * @throws AddNumbersException
+ * if any of the numbers to be added is negative.
+ */
+ public int addNumbers(int number1, int number2) throws AddNumbersFault {
+ System.out.println("addNumbers called....." + number1 + ":" + number2);
+ if (number1 < 0 || number2 < 0) {
+ String message = "Negative number cant be added!";
+ String detail = "Numbers: " + number1 + ", " + number2;
+ FaultDetail fault = new FaultDetail();
+ fault.setMessage(message);
+ fault.setFaultInfo(detail);
+ throw new AddNumbersFault(message, fault);
+ }
+ return number1 + number2;
+ }
+
+}
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/AddNumbersImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/AddNumbersImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/LoggingHandler.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/LoggingHandler.java?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/LoggingHandler.java (added)
+++ servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/LoggingHandler.java Wed Aug 6 18:08:51 2008
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.servicemix.examples.cxf.soaphandler;
+
+
+import java.io.PrintStream;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+/*
+ * This simple SOAPHandler will output the contents of incoming
+ * and outgoing messages.
+ */
+public class LoggingHandler implements SOAPHandler<SOAPMessageContext> {
+
+ private PrintStream out;
+
+ public LoggingHandler() {
+ setLogStream(System.out);
+ }
+
+ protected final void setLogStream(PrintStream ps) {
+ out = ps;
+ }
+
+ public void init(Map c) {
+ System.out.println("LoggingHandler : init() Called....");
+ }
+
+ public Set<QName> getHeaders() {
+ return null;
+ }
+
+ public boolean handleMessage(SOAPMessageContext smc) {
+ System.out.println("LoggingHandler : handleMessage Called....");
+ logToSystemOut(smc);
+ return true;
+ }
+
+ public boolean handleFault(SOAPMessageContext smc) {
+ System.out.println("LoggingHandler : handleFault Called....");
+ logToSystemOut(smc);
+ return true;
+ }
+
+ // nothing to clean up
+ public void close(MessageContext messageContext) {
+ System.out.println("LoggingHandler : close() Called....");
+ }
+
+ // nothing to clean up
+ public void destroy() {
+ System.out.println("LoggingHandler : destroy() Called....");
+ }
+
+ /*
+ * Check the MESSAGE_OUTBOUND_PROPERTY in the context
+ * to see if this is an outgoing or incoming message.
+ * Write a brief message to the print stream and
+ * output the message. The writeTo() method can throw
+ * SOAPException or IOException
+ */
+ protected void logToSystemOut(SOAPMessageContext smc) {
+ Boolean outboundProperty = (Boolean)
+ smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+
+ if (outboundProperty.booleanValue()) {
+ out.println("\nOutbound message:");
+ } else {
+ out.println("\nInbound message:");
+ }
+
+ SOAPMessage message = smc.getMessage();
+ try {
+ message.writeTo(out);
+ out.println();
+ } catch (Exception e) {
+ out.println("Exception in handler: " + e);
+ }
+ }
+}
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/LoggingHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/LoggingHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/SmallNumberHandler.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/SmallNumberHandler.java?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/SmallNumberHandler.java (added)
+++ servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/SmallNumberHandler.java Wed Aug 6 18:08:51 2008
@@ -0,0 +1,135 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.servicemix.examples.cxf.soaphandler;
+
+import java.util.Map;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.transform.Source;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+import org.apache.handlers.types.AddNumbers;
+import org.apache.handlers.types.AddNumbersResponse;
+import org.apache.handlers.types.ObjectFactory;
+
+
+
+/**
+ * handles addition of small numbers.
+ */
+public class SmallNumberHandler implements LogicalHandler<LogicalMessageContext> {
+
+
+ // Implementation of javax.xml.ws.handler.Handler
+
+ public final boolean handleMessage(LogicalMessageContext messageContext) {
+ System.out.println("LogicalMessageHandler handleMessage called");
+
+ try {
+ boolean outbound = (Boolean)messageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+
+ if (outbound) {
+ // get the LogicalMessage from our context
+ //
+ LogicalMessage msg = messageContext.getMessage();
+
+ // check the payload, if its an AddNumbers request, we'll intervene
+ //
+ JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
+ Object payload = msg.getPayload(jaxbContext);
+ if (payload instanceof JAXBElement) {
+ payload = ((JAXBElement)payload).getValue();
+ }
+
+ if (payload instanceof AddNumbers) {
+ AddNumbers req = (AddNumbers)payload;
+
+ // now, if the arguments are small, let's do the calculation here
+ //
+ int a = req.getArg0();
+ int b = req.getArg1();
+
+ if (isSmall(a) && isSmall(b)) {
+ int answer = a + b;
+
+ //System.out.printf("SmallNumberHandler addNumbers(%d, %d) == %d\n", a, b, answer);
+ // ok, we've done the calculation, so build the
+ // response and set it as the payload of the message
+
+ AddNumbersResponse resp = new AddNumbersResponse();
+ resp.setReturn(answer);
+ msg.setPayload(new ObjectFactory().createAddNumbersResponse(resp),
+ jaxbContext);
+
+ Source src = msg.getPayload();
+ msg.setPayload(src);
+
+ payload = msg.getPayload(jaxbContext);
+ if (payload instanceof JAXBElement) {
+ payload = ((JAXBElement)payload).getValue();
+ }
+
+ AddNumbersResponse resp2 = (AddNumbersResponse)payload;
+ if (resp2 == resp) {
+ throw new WebServiceException("Shouldn't be the same object");
+ }
+
+ // finally, return false, indicating that request
+ // processing stops here and our answer will be
+ // returned to the client
+ return false;
+ }
+ }
+ }
+ return true;
+ } catch (JAXBException ex) {
+ throw new ProtocolException(ex);
+ }
+
+ }
+
+ public final boolean handleFault(LogicalMessageContext messageContext) {
+ System.out.println("LogicalMessageHandler handleFault called");
+ System.out.println(messageContext);
+
+ return true;
+ }
+
+ public void close(MessageContext ctx) {
+ System.out.println("LogicalHandler close called");
+ }
+
+ public void init(Map config) {
+ System.out.println("LogicalHandler init called");
+ }
+
+ public void destroy() {
+ System.out.println("LogicalHandler close called");
+ }
+
+ private boolean isSmall(int i) {
+ return i > 0 && i <= 10;
+ }
+}
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/SmallNumberHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/java/org/apache/servicemix/examples/cxf/soaphandler/SmallNumberHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/META-INF/spring/beans.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/META-INF/spring/beans.xml?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/META-INF/spring/beans.xml (added)
+++ servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/META-INF/spring/beans.xml Wed Aug 6 18:08:51 2008
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ 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://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+ http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+ <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
+
+ <jaxws:endpoint id="SoapHandlerEndpoint"
+ implementor="org.apache.servicemix.examples.cxf.soaphandler.AddNumbersImpl"
+ address="/SoapHandler"
+ wsdlLocation="wsdl/addNumbers.wsdl"
+ endpointName="e:AddNumbersPort"
+ serviceName="s:AddNumbersService"
+ xmlns:e="http://apache.org/handlers"
+ xmlns:s="http://apache.org/handlers"/>
+
+
+ <jaxws:client id="client"
+ serviceClass="org.apache.handlers.AddNumbers"
+ endpointName="e:AddNumbersPort"
+ serviceName="s:AddNumbersService"
+ xmlns:e="http://apache.org/handlers"
+ xmlns:s="http://apache.org/handlers"
+ wsdlLocation="wsdl/addNumbers.wsdl"
+ address="http://localhost:8080/cxf/SoapHandler"/>
+
+ <osgi:service id="testHelloWorld" ref="client"
+ interface="org.apache.handlers.AddNumbers"/>
+
+
+</beans>
+<!-- END SNIPPET: beans -->
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/META-INF/spring/beans.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/META-INF/spring/beans.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/META-INF/spring/beans.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/config/demo_handlers.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/config/demo_handlers.xml?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/config/demo_handlers.xml (added)
+++ servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/config/demo_handlers.xml Wed Aug 6 18:08:51 2008
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-name>LoggingHandler</handler-name>
+ <handler-class>org.apache.servicemix.examples.cxf.soaphandler.LoggingHandler</handler-class>
+ </handler>
+ </handler-chain>
+</handler-chains>
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/config/demo_handlers.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/config/demo_handlers.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/config/demo_handlers.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/wsdl/addNumbers.wsdl
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/wsdl/addNumbers.wsdl?rev=683457&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/wsdl/addNumbers.wsdl (added)
+++ servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/wsdl/addNumbers.wsdl Wed Aug 6 18:08:51 2008
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<definitions
+ name="AddNumbers"
+ targetNamespace="http://apache.org/handlers"
+ xmlns:tns="http://apache.org/handlers"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:x1="http://apache.org/handlers/types">
+ <types>
+ <xsd:schema
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/handlers/types"
+ elementFormDefault="qualified">
+
+ <complexType name="addNumbersResponse">
+ <sequence>
+ <element name="return" type="xsd:int" />
+ </sequence>
+ </complexType>
+ <element name="addNumbersResponse" type="x1:addNumbersResponse"/>
+
+ <complexType name="addNumbers">
+ <sequence>
+ <element name="arg0" type="xsd:int" />
+ <element name="arg1" type="xsd:int" />
+ </sequence>
+ </complexType>
+ <element name="addNumbers" type="x1:addNumbers"/>
+
+ <element name="FaultDetail" type="x1:FaultDetail" />
+ <complexType name="FaultDetail">
+ <sequence>
+ <element name="faultInfo" type="xsd:string" />
+ <element name="message" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </xsd:schema>
+ </types>
+ <message name="addNumbers">
+ <part name="parameters" element="x1:addNumbers" />
+ </message>
+ <message name="addNumbersResponse">
+ <part name="result" element="x1:addNumbersResponse" />
+ </message>
+ <message name="addNumbersFault">
+ <part name="AddNumbersFault" element="x1:FaultDetail" />
+ </message>
+ <portType name="AddNumbers">
+ <operation name="addNumbers">
+ <input message="tns:addNumbers" />
+ <output message="tns:addNumbersResponse" />
+ <fault name="addNumbersFault" message="tns:addNumbersFault"/>
+ </operation>
+ </portType>
+ <binding name="AddNumbersBinding" type="tns:AddNumbers">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ <operation name="addNumbers">
+ <soap:operation soapAction="" />
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ <fault name="addNumbersFault">
+ <soap:fault name="addNumbersFault" use="literal" />
+ </fault>
+ </operation>
+ </binding>
+ <service name="AddNumbersService">
+ <port name="AddNumbersPort" binding="tns:AddNumbersBinding">
+ <soap:address location="http://localhost:8080/cxf/SoapHandler" />
+ </port>
+ </service>
+</definitions>
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/wsdl/addNumbers.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/wsdl/addNumbers.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/smx4/features/trunk/examples/cxf-soap-handler-osgi/src/main/resources/wsdl/addNumbers.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: servicemix/smx4/features/trunk/examples/itests/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/itests/pom.xml?rev=683457&r1=683456&r2=683457&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/examples/itests/pom.xml (original)
+++ servicemix/smx4/features/trunk/examples/itests/pom.xml Wed Aug 6 18:08:51 2008
@@ -187,6 +187,16 @@
</dependency>
<dependency>
<groupId>org.apache.servicemix.examples</groupId>
+ <artifactId>cxf-soap-handler-osgi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.examples</groupId>
+ <artifactId>cxf-handler-cfg</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.examples</groupId>
<artifactId>cxf-nmr</artifactId>
<version>${project.version}</version>
</dependency>
Modified: servicemix/smx4/features/trunk/examples/itests/src/test/java/org/apache/servicemix/examples/IntegrationTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/itests/src/test/java/org/apache/servicemix/examples/IntegrationTest.java?rev=683457&r1=683456&r2=683457&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/examples/itests/src/test/java/org/apache/servicemix/examples/IntegrationTest.java (original)
+++ servicemix/smx4/features/trunk/examples/itests/src/test/java/org/apache/servicemix/examples/IntegrationTest.java Wed Aug 6 18:08:51 2008
@@ -90,6 +90,8 @@
getBundle("org.apache.servicemix.nmr", "org.apache.servicemix.nmr.osgi"),
getBundle("org.apache.servicemix.document", "org.apache.servicemix.document"),
getBundle("org.apache.servicemix.examples", "cxf-http-osgi"),
+ getBundle("org.apache.servicemix.examples", "cxf-soap-handler-osgi"),
+ getBundle("org.apache.servicemix.examples", "cxf-handler-cfg"),
};
}
@@ -99,14 +101,6 @@
Thread.sleep(5000);
}
- protected Manifest getManifest() {
- Manifest mf = super.getManifest();
- String exportP = mf.getMainAttributes().getValue(Constants.EXPORT_PACKAGE);
- mf.getMainAttributes().putValue(Constants.EXPORT_PACKAGE,
- exportP + ",org.apache.servicemix.examples.cxf");
- return mf;
- }
-
public void testHttpOsgi() throws Exception {
Thread.sleep(5000);
waitOnContextCreation("cxf-http-osgi");
@@ -123,4 +117,49 @@
assertEquals("Hello Bonjour", helloWorld.sayHi("Bonjour"));
}
+ protected Manifest getManifest() {
+ Manifest mf = super.getManifest();
+ String exportP = mf.getMainAttributes().getValue(Constants.EXPORT_PACKAGE);
+ mf.getMainAttributes().putValue(Constants.EXPORT_PACKAGE,
+ exportP + ",org.apache.handlers, "
+ + "org.apache.springcfg.handlers, "
+ + "org.apache.handlers.types,org.apache.servicemix.examples.cxf,"
+ + "org.apache.servicemix.examples.cxf.soaphandler"
+ + "org.apache.servicemix.examples.cxf.springcfghandler");
+ return mf;
+ }
+
+ public void testSoapHandlerOsgi() throws Exception {
+ Thread.sleep(5000);
+ waitOnContextCreation("cxf-soap-handler-osgi");
+ Thread.sleep(5000);
+
+ ServiceReference ref = bundleContext.getServiceReference(org.apache.handlers.AddNumbers.class.getName());
+ assertNotNull("Service Reference is null", ref);
+
+ org.apache.handlers.AddNumbers addNumbers = null;
+
+ addNumbers = (org.apache.handlers.AddNumbers) bundleContext.getService(ref);
+ assertNotNull("Cannot find the service", addNumbers);
+
+ assertEquals(2, addNumbers.addNumbers(1,1));
+
+ }
+
+ public void testSpringConfigHandlerOsgi() throws Exception {
+ Thread.sleep(5000);
+ waitOnContextCreation("cxf-handler-cfg");
+ Thread.sleep(5000);
+
+ ServiceReference ref = bundleContext.getServiceReference(org.apache.springcfg.handlers.AddNumbers.class.getName());
+ assertNotNull("Service Reference is null", ref);
+
+ org.apache.springcfg.handlers.AddNumbers addNumbers = null;
+
+ addNumbers = (org.apache.springcfg.handlers.AddNumbers) bundleContext.getService(ref);
+ assertNotNull("Cannot find the service", addNumbers);
+
+ assertEquals(1016, addNumbers.addNumbers(10, 16));
+ }
+
}
Modified: servicemix/smx4/features/trunk/examples/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/pom.xml?rev=683457&r1=683456&r2=683457&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/examples/pom.xml (original)
+++ servicemix/smx4/features/trunk/examples/pom.xml Wed Aug 6 18:08:51 2008
@@ -44,6 +44,8 @@
<module>cxf-nmr</module>
<module>cxf-osgi</module>
<module>cxf-http-osgi</module>
+ <module>cxf-soap-handler-osgi</module>
+ <module>cxf-handler-cfg</module>
<module>itests</module>
</modules>