Author: davsclaus
Date: Sat Apr 27 06:36:46 2013
New Revision: 1476502

URL: http://svn.apache.org/r1476502
Log:
CAMEL-4515: spring-ws now supports SOAP header to/from Camel Message so end 
users can set/access it. Thanks to Damian for the patch.

Added:
    
camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderResponseProcessor.java
    
camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java
    
camel/trunk/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/SoapHeaderTest-context.xml
Modified:
    
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConstants.java
    
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
    
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java

Modified: 
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConstants.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConstants.java?rev=1476502&r1=1476501&r2=1476502&view=diff
==============================================================================
--- 
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConstants.java
 (original)
+++ 
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConstants.java
 Sat Apr 27 06:36:46 2013
@@ -18,14 +18,14 @@ package org.apache.camel.component.sprin
 
 public final class SpringWebserviceConstants {
 
-    /* Producer constants */
     public static final String SPRING_WS_ENDPOINT_URI = 
"CamelSpringWebserviceEndpointUri";
+
     public static final String SPRING_WS_SOAP_ACTION = 
"CamelSpringWebserviceSoapAction";
+    public static final String SPRING_WS_SOAP_HEADER = 
"CamelSpringWebserviceSoapHeader";
+
     public static final String SPRING_WS_ADDRESSING_ACTION = 
"CamelSpringWebserviceAddressingAction";
     public static final String SPRING_WS_ADDRESSING_PRODUCER_FAULT_TO =  
"CamelSpringWebserviceAddressingFaultTo";
     public static final String SPRING_WS_ADDRESSING_PRODUCER_REPLY_TO = 
"CamelSpringWebserviceAddressingReplyTo";
-    
-    /* Consumers constants (reserved, not impl. yet) */    
     public static final String SPRING_WS_ADDRESSING_CONSUMER_OUTPUT_ACTION = 
"CamelSpringWebserviceAddressingOutputAction";
     public static final String SPRING_WS_ADDRESSING_CONSUMER_FAULT_ACTION = 
"CamelSpringWebserviceAddressingFaultAction";
 

Modified: 
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java?rev=1476502&r1=1476501&r2=1476502&view=diff
==============================================================================
--- 
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
 (original)
+++ 
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
 Sat Apr 27 06:36:46 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.spring.ws;
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -66,9 +65,9 @@ public class SpringWebserviceConsumer ex
             if (responseMessage != null) {
                 Source responseBody = responseMessage.getBody(Source.class);
                 WebServiceMessage response = messageContext.getResponse();
-                
+
                 configuration.getMessageFilter().filterConsumer(exchange, 
response);
-                
+
                 XmlConverter xmlConverter = configuration.getXmlConverter();
                 xmlConverter.toResult(responseBody, 
response.getPayloadResult());
             }
@@ -81,7 +80,7 @@ public class SpringWebserviceConsumer ex
         // create inbound message
         WebServiceMessage request = messageContext.getRequest();
         SpringWebserviceMessage inMessage = new 
SpringWebserviceMessage(request);
-        inMessage.setHeaders(extractSoapHeadersFromWebServiceMessage(request));
+        extractSourceFromSoapHeader(inMessage.getHeaders(), request);
         exchange.setIn(inMessage);
     }
 
@@ -96,28 +95,40 @@ public class SpringWebserviceConsumer ex
         }
     }
 
-    private Map<String, Object> 
extractSoapHeadersFromWebServiceMessage(WebServiceMessage request) {
-        Map<String, Object> headers = new HashMap<String, Object>();
+    /**
+     * Extracts the SOAP headers and set them as headers in the Exchange. Also 
sets
+     * it as a header with the key 
SpringWebserviceConstants.SPRING_WS_SOAP_HEADER
+     * and a value of type Source.
+     *
+     * @param headers   the Exchange Headers
+     * @param request   the WebService Request
+     */
+    private void extractSourceFromSoapHeader(Map<String, Object> headers, 
WebServiceMessage request) {
         if (request instanceof SoapMessage) {
             SoapMessage soapMessage = (SoapMessage) request;
             SoapHeader soapHeader = soapMessage.getSoapHeader();
+
             if (soapHeader != null) {
-                Iterator<?> attibutesIterator = soapHeader.getAllAttributes();
-                while (attibutesIterator.hasNext()) {
-                    QName name = (QName) attibutesIterator.next();
-                    headers.put(name.toString(), 
soapHeader.getAttributeValue(name));
+                //Set the raw soap header as a header in the exchange.
+                headers.put(SpringWebserviceConstants.SPRING_WS_SOAP_HEADER, 
soapHeader.getSource());
+
+                //Set header values for the soap header attributes
+                Iterator<QName> attIter = soapHeader.getAllAttributes();
+                while (attIter.hasNext()) {
+                    QName name = attIter.next();
+                    headers.put(name.getLocalPart(), 
soapHeader.getAttributeValue(name));
                 }
-                Iterator<?> elementIter = 
soapHeader.examineAllHeaderElements();
+
+                //Set header values for the soap header elements
+                Iterator<SoapHeaderElement> elementIter = 
soapHeader.examineAllHeaderElements();
                 while (elementIter.hasNext()) {
-                    Object element = elementIter.next();
-                    if (element instanceof SoapHeaderElement) {
-                        QName name = ((SoapHeaderElement) element).getName();
-                        headers.put(name.toString(), element);
-                    }
+                    SoapHeaderElement element = elementIter.next();
+                    QName name = element.getName();
+                    headers.put(name.getLocalPart(), element);
+
                 }
             }
         }
-        return headers;
     }
 
     @Override

Modified: 
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java?rev=1476502&r1=1476501&r2=1476502&view=diff
==============================================================================
--- 
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
 (original)
+++ 
camel/trunk/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
 Sat Apr 27 06:36:46 2013
@@ -30,6 +30,7 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.TypeConverter;
+import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.util.ExchangeHelper;
 import org.slf4j.Logger;
@@ -38,6 +39,8 @@ import org.springframework.ws.WebService
 import org.springframework.ws.client.core.SourceExtractor;
 import org.springframework.ws.client.core.WebServiceMessageCallback;
 import org.springframework.ws.client.core.WebServiceTemplate;
+import org.springframework.ws.soap.SoapHeader;
+import org.springframework.ws.soap.SoapMessage;
 import org.springframework.ws.soap.addressing.client.ActionCallback;
 import org.springframework.ws.soap.addressing.core.EndpointReference;
 import org.springframework.ws.soap.client.core.SoapActionCallback;
@@ -52,6 +55,7 @@ public class SpringWebserviceProducer ex
 
     private static final Logger LOG = 
LoggerFactory.getLogger(SpringWebserviceProducer.class);
     private static final SourceExtractor<Object> SOURCE_EXTRACTOR = new 
NoopSourceExtractor();
+    private static final XmlConverter XML_CONVERTER = new XmlConverter();
 
     public SpringWebserviceProducer(Endpoint endpoint) {
         super(endpoint);
@@ -73,15 +77,18 @@ public class SpringWebserviceProducer ex
         URI wsAddressingActionHeader = 
exchange.getIn().getHeader(SpringWebserviceConstants.SPRING_WS_ADDRESSING_ACTION,
 URI.class);
         URI wsReplyToHeader = 
exchange.getIn().getHeader(SpringWebserviceConstants.SPRING_WS_ADDRESSING_PRODUCER_REPLY_TO,
 URI.class);
         URI wsFaultToHeader = 
exchange.getIn().getHeader(SpringWebserviceConstants.SPRING_WS_ADDRESSING_PRODUCER_FAULT_TO,
 URI.class);
+        Source soapHeaderSource = 
exchange.getIn().getHeader(SpringWebserviceConstants.SPRING_WS_SOAP_HEADER, 
Source.class);
 
-        WebServiceMessageCallback callback = new 
DefaultWebserviceMessageCallback(soapActionHeader, wsAddressingActionHeader, 
wsReplyToHeader, 
-                                                                               
   wsFaultToHeader, getEndpoint().getConfiguration(), exchange);
-        Object body = null;
+        WebServiceMessageCallback callback = new 
DefaultWebserviceMessageCallback(soapActionHeader, wsAddressingActionHeader,
+                wsReplyToHeader, wsFaultToHeader, soapHeaderSource, 
getEndpoint().getConfiguration(), exchange);
+
+        Object body;
         if (endpointUriHeader != null) {
             body = 
getEndpoint().getConfiguration().getWebServiceTemplate().sendSourceAndReceive(endpointUriHeader,
 sourcePayload, callback, SOURCE_EXTRACTOR);
         } else {
             body = 
getEndpoint().getConfiguration().getWebServiceTemplate().sendSourceAndReceive(sourcePayload,
 callback, SOURCE_EXTRACTOR);
         }
+
         if (ExchangeHelper.isOutCapable(exchange)) {
             exchange.getOut().copyFrom(exchange.getIn());
             exchange.getOut().setBody(body);
@@ -99,19 +106,19 @@ public class SpringWebserviceProducer ex
         WebServiceTemplate webServiceTemplate = 
configuration.getWebServiceTemplate();
 
         WebServiceMessageSender[] messageSenders = 
webServiceTemplate.getMessageSenders();
-        
+
         for (int i = 0; i < messageSenders.length; i++) {
             WebServiceMessageSender messageSender = messageSenders[i];
             if (messageSender instanceof CommonsHttpMessageSender) {
                 if (configuration.getSslContextParameters() != null) {
                     LOG.warn("Not applying SSLContextParameters based 
configuration to CommonsHttpMessageSender.  "
-                             + "If you are using this MessageSender, which you 
are not by default, you will need "
-                             + "to configure SSL using the Commons HTTP 3.x 
Protocol registry.");
+                            + "If you are using this MessageSender, which you 
are not by default, you will need "
+                            + "to configure SSL using the Commons HTTP 3.x 
Protocol registry.");
                 }
-                
+
                 if (configuration.getTimeout() > -1) {
                     if 
(messageSender.getClass().equals(CommonsHttpMessageSender.class)) {
-                        
((CommonsHttpMessageSender)messageSender).setReadTimeout(configuration.getTimeout());
+                        ((CommonsHttpMessageSender) 
messageSender).setReadTimeout(configuration.getTimeout());
                     } else {
                         LOG.warn("Not applying timeout configuration to 
CommonsHttpMessageSender based implementation.  "
                                 + "You are using what appears to be a custom 
MessageSender, which you are not doing by default. "
@@ -121,7 +128,7 @@ public class SpringWebserviceProducer ex
             } else if 
(messageSender.getClass().equals(HttpUrlConnectionMessageSender.class)) {
                 // Only if exact match denoting likely use of default 
configuration.  We don't want to get
                 // sub-classes that might have been otherwise injected.
-                messageSenders[i] = new 
AbstractHttpWebServiceMessageSenderDecorator((HttpUrlConnectionMessageSender)messageSender,
 configuration);
+                messageSenders[i] = new 
AbstractHttpWebServiceMessageSenderDecorator((HttpUrlConnectionMessageSender) 
messageSender, configuration);
             } else {
                 // For example this will be the case during unit-testing with 
the net.javacrumbs.spring-ws-test API
                 LOG.warn("Ignoring the timeout and SSLContextParameters 
options for {}.  You will need to configure "
@@ -129,20 +136,20 @@ public class SpringWebserviceProducer ex
             }
         }
     }
-    
+
     /**
      * A decorator of {@link HttpUrlConnectionMessageSender} instances that 
can apply configuration options
      * from the Camel component/endpoint configuration without replacing the 
actual implementation which may
      * actually be an end-user implementation and not one of the built-in 
implementations.
      */
     protected static final class AbstractHttpWebServiceMessageSenderDecorator 
extends AbstractHttpWebServiceMessageSender {
-        
+
         private final AbstractHttpWebServiceMessageSender delegate;
-        
+
         private final SpringWebserviceConfiguration configuration;
-        
+
         private SSLContext sslContext;
-        
+
         public 
AbstractHttpWebServiceMessageSenderDecorator(AbstractHttpWebServiceMessageSender
 delegate, SpringWebserviceConfiguration configuration) {
             this.delegate = delegate;
             this.configuration = configuration;
@@ -152,12 +159,12 @@ public class SpringWebserviceProducer ex
         public WebServiceConnection createConnection(URI uri) throws 
IOException {
             WebServiceConnection wsc = delegate.createConnection(uri);
             if (wsc instanceof HttpUrlConnection) {
-                HttpURLConnection connection = 
((HttpUrlConnection)wsc).getConnection();
-                
+                HttpURLConnection connection = ((HttpUrlConnection) 
wsc).getConnection();
+
                 if (configuration.getTimeout() > -1) {
                     connection.setReadTimeout(configuration.getTimeout());
                 }
-                
+
                 if (configuration.getSslContextParameters() != null && 
connection instanceof HttpsURLConnection) {
                     try {
                         synchronized (this) {
@@ -168,14 +175,14 @@ public class SpringWebserviceProducer ex
                     } catch (GeneralSecurityException e) {
                         throw new RuntimeCamelException("Error creating 
SSLContext based on SSLContextParameters.", e);
                     }
-                    
+
                     ((HttpsURLConnection) 
connection).setSSLSocketFactory(sslContext.getSocketFactory());
                 }
             } else {
                 throw new RuntimeCamelException("Unsupported delegate.  
Delegate must return a org.springframework.ws.transport.http.HttpUrlConnection. 
 Found "
                         + wsc.getClass());
             }
-            
+
             return wsc;
         }
 
@@ -200,14 +207,17 @@ public class SpringWebserviceProducer ex
         private final URI wsAddressingActionHeader;
         private final URI wsReplyToHeader;
         private final URI wsFaultToHeader;
+        private final Source soapHeaderSource;
         private final SpringWebserviceConfiguration configuration;
         private final Exchange exchange;
 
-        public DefaultWebserviceMessageCallback(String soapAction, URI 
wsAddressingAction, URI wsReplyTo, URI wsFaultTo, SpringWebserviceConfiguration 
configuration, Exchange exchange) {
+        public DefaultWebserviceMessageCallback(String soapAction, URI 
wsAddressingAction, URI wsReplyTo, URI wsFaultTo, Source soapHeaderSource,
+                                                SpringWebserviceConfiguration 
configuration, Exchange exchange) {
             this.soapActionHeader = soapAction;
             this.wsAddressingActionHeader = wsAddressingAction;
             this.wsReplyToHeader = wsReplyTo;
             this.wsFaultToHeader = wsFaultTo;
+            this.soapHeaderSource = soapHeaderSource;
             this.configuration = configuration;
             this.exchange = exchange;
         }
@@ -225,7 +235,13 @@ public class SpringWebserviceProducer ex
             URI wsAddressingAction = wsAddressingActionHeader != null ? 
wsAddressingActionHeader : configuration.getWsAddressingAction();
             URI wsReplyTo = wsReplyToHeader != null ? wsReplyToHeader : 
configuration.getReplyTo();
             URI wsFaultTo = wsFaultToHeader != null ? wsFaultToHeader : 
configuration.getFaultTo();
-            
+
+            // Create the SOAP header
+            if (soapHeaderSource != null) {
+                SoapHeader header = ((SoapMessage) message).getSoapHeader();
+                XML_CONVERTER.toResult(soapHeaderSource, header.getResult());
+            }
+
             if (wsAddressingAction != null) {
                 ActionCallback actionCallback = new 
ActionCallback(wsAddressingAction);
                 if (wsReplyTo != null) {
@@ -237,7 +253,7 @@ public class SpringWebserviceProducer ex
                 }
                 actionCallback.doWithMessage(message);
             }
-            
+
             configuration.getMessageFilter().filterProducer(exchange, message);
         }
     }

Added: 
camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderResponseProcessor.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderResponseProcessor.java?rev=1476502&view=auto
==============================================================================
--- 
camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderResponseProcessor.java
 (added)
+++ 
camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderResponseProcessor.java
 Sat Apr 27 06:36:46 2013
@@ -0,0 +1,32 @@
+/**
+ * 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.camel.component.spring.ws;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+
+/**
+ * Returns the request as the response so it can be analysed (eg. for presence
+ * of SOAP Headers). The SOAP Header will be copied from in to out.
+ */
+public class SoapHeaderResponseProcessor implements Processor {
+
+    public void process(Exchange exchange) throws Exception {
+        exchange.setOut(exchange.getIn());
+    }
+
+}

Added: 
camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java?rev=1476502&view=auto
==============================================================================
--- 
camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java
 (added)
+++ 
camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java
 Sat Apr 27 06:36:46 2013
@@ -0,0 +1,61 @@
+/**
+ * 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.camel.component.spring.ws;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.junit.Test;
+import org.springframework.test.context.ContextConfiguration;
+import 
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+@ContextConfiguration
+public class SoapHeaderTest extends AbstractJUnit4SpringContextTests {
+
+    private final String xmlRequestForGoogleStockQuote = "<GetQuote 
xmlns=\"http://www.webserviceX.NET/\";><symbol>GOOG</symbol></GetQuote>";
+    private final String soapHeader = "<h:Header 
xmlns:h=\"http://www.webserviceX.NET/\";><h:MessageID>1234567890</h:MessageID><h:Nested><h:NestedID>1111</h:NestedID></h:Nested></h:Header>";
+
+    @Produce
+    private ProducerTemplate template;
+
+    /**
+     * This tests both the Producer and the Consumer. The SOAP Header is 
populated into the
+     * Camel Header which is copied across in the SoapHeaderResponseProcessor. 
The result is
+     * that the header sent in should be the same as the header returned.
+     *
+     * @throws Exception
+     */
+    @Test()
+    public void consumeStockQuoteWebserviceWithSoapHeader() throws Exception {
+        Exchange result = template.request("direct:stockQuoteWebservice", new 
Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody(xmlRequestForGoogleStockQuote);
+                
exchange.getIn().setHeader(SpringWebserviceConstants.SPRING_WS_SOAP_HEADER, 
soapHeader);
+
+            }
+        });
+        assertNotNull(result);
+        String header = 
result.getOut().getHeader(SpringWebserviceConstants.SPRING_WS_SOAP_HEADER, 
String.class);
+        assertEquals(soapHeader, header);
+    }
+}

Added: 
camel/trunk/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/SoapHeaderTest-context.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/SoapHeaderTest-context.xml?rev=1476502&view=auto
==============================================================================
--- 
camel/trunk/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/SoapHeaderTest-context.xml
 (added)
+++ 
camel/trunk/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/SoapHeaderTest-context.xml
 Sat Apr 27 06:36:46 2013
@@ -0,0 +1,53 @@
+<?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.
+-->
+<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
+         http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd";>
+
+    <camelContext xmlns="http://camel.apache.org/schema/spring";>
+        <!-- producer routes (web service clients) -->
+        <route>
+            <from uri="direct:stockQuoteWebservice"/>
+            <to 
uri="spring-ws:http://localhost?webServiceTemplate=#webServiceTemplate&amp;soapAction=http://www.stockquotes.edu/GetQuote"/>
+        </route>
+
+        <!-- consumer route (providing the actual web service) that responds 
with the request so we can see SOAP headers -->
+        <route>
+            <from 
uri="spring-ws:soapaction:http://www.stockquotes.edu/GetQuote?endpointMapping=#endpointMapping"/>
+            <to uri="responseProcessor"/>
+        </route>
+    </camelContext>
+
+    <bean id="messageFactory" 
class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/>
+
+    <bean id="endpointMapping"
+          
class="org.apache.camel.component.spring.ws.bean.CamelEndpointMapping"/>
+
+    <bean id="responseProcessor"
+          
class="org.apache.camel.component.spring.ws.SoapHeaderResponseProcessor"/>
+
+    <bean id="webServiceTemplate" 
class="org.springframework.ws.client.core.WebServiceTemplate">
+        <property name="defaultUri" value="http://localhost"/>
+        <property name="messageSender">
+            <bean 
class="net.javacrumbs.springws.test.helper.InMemoryWebServiceMessageSender"/>
+        </property>
+    </bean>
+
+</beans>
\ No newline at end of file


Reply via email to