camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject svn commit: r810776 - in /camel/branches/camel-1.x/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/ test/java/org/apache/camel/component/cxf/soap/headers/ test/resources/ test/resources/org/apache/camel/component/cxf/spring/
Date Thu, 03 Sep 2009 04:08:46 GMT
Author: wtam
Date: Thu Sep  3 04:08:46 2009
New Revision: 810776

URL: http://svn.apache.org/viewvc?rev=810776&view=rev
Log:
[CAMEL-1983] camel-cxf should let users to set out SOAP headers

Added:
    camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterWithInsertionImpl.java
  (with props)
Modified:
    camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
    camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java
    camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java
    camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterImpl.java
    camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/message_headers_relay.xml
    camel/branches/camel-1.x/components/camel-cxf/src/test/resources/soap_header.wsdl

Modified: camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java?rev=810776&r1=810775&r2=810776&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
(original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
Thu Sep  3 04:08:46 2009
@@ -312,8 +312,8 @@
         }
         Map<String, Object> responseContext = (Map<String, Object>)context.get(Client.RESPONSE_CONTEXT);
         List<Header> headers = (List<Header>)responseContext.get(Header.HEADER_LIST);
-        responseContext.remove(Header.HEADER_LIST);
         if (!endpoint.isRelayHeaders()) {
+            responseContext.remove(Header.HEADER_LIST);
             Exchange e = exchange.getExchange();
             if (e == null) {
                 return;
@@ -387,17 +387,14 @@
                                        Map<String, Object> context,
                                        MessageHeadersRelay relay) {
         
-        List<Header> to = (List<Header>)context.get(Header.HEADER_LIST);
-        boolean hasHeaders = true;
-        if (to == null) {
-            to = new ArrayList<Header>();
-            hasHeaders = false;
-        }
+//        List<Header> to = (List<Header>)context.get(Header.HEADER_LIST);
+        List<Header> to = new ArrayList<Header>();
+
         relay.relay(direction, from, to);
         for (Header header : to) {
             header.setDirection(Header.Direction.DIRECTION_OUT);
         }
-        if (!hasHeaders && to.size() > 0) {
+        if (to.size() > 0) {
             context.put(Header.HEADER_LIST, to);
         }
     }

Modified: camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java?rev=810776&r1=810775&r2=810776&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java
(original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java
Thu Sep  3 04:08:46 2009
@@ -57,7 +57,28 @@
     
     public CxfExchange(CxfExchange exchange) {
         super(exchange);
-        this.exchange = exchange.getExchange();      
+        this.exchange = exchange.getExchange();
+        
+        if (DataFormat.MESSAGE == exchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY,
DataFormat.class)) {
+            // message body is an input stream so it is not copied to new exchange
+            return;
+        }
+        
+        org.apache.camel.Message message = exchange.getIn();
+        if (message != null) {
+            this.setIn(message);
+        }
+        
+        message = exchange.getOut(false);
+        if (message != null) {
+            this.setOut(message);
+        }
+        
+        message = exchange.getFault(false);
+        if (message != null) {
+            this.setFault(message);
+        }
+        
     }
 
     public CxfExchange(CamelContext context, ExchangePattern pattern, Message inMessage)
{

Modified: camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java?rev=810776&r1=810775&r2=810776&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java
(original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java
Thu Sep  3 04:08:46 2009
@@ -17,6 +17,7 @@
 
 package org.apache.camel.component.cxf.soap.headers;
 
+import java.io.StringReader;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
 import java.util.ArrayList;
@@ -35,10 +36,13 @@
 import javax.xml.ws.Holder;
 
 import org.w3c.dom.Node;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
+import org.apache.camel.Processor;
 import org.apache.camel.component.cxf.CxfConstants;
 import org.apache.camel.component.cxf.CxfEndpoint;
+import org.apache.camel.component.cxf.CxfMessage;
 import org.apache.camel.component.cxf.headers.MessageHeadersRelay;
 import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.spring.SpringTestSupport;
@@ -47,9 +51,12 @@
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.headers.Header;
+import org.apache.cxf.headers.Header.Direction;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
 import org.apache.cxf.outofband.header.OutofBandHeader;
 import org.springframework.context.support.AbstractXmlApplicationContext;
@@ -60,7 +67,8 @@
 
     private ServerImpl relayServer;
     private ServerImpl noRelayServer;
-    
+    private ServerImpl relayServerWithInsertion;
+
     @Override
     protected void setUp() throws Exception {
         setUseRouteBuilder(false);
@@ -76,7 +84,10 @@
         if (noRelayServer != null) {
             noRelayServer.stop();
         }        
-
+        if (relayServerWithInsertion != null) {
+            relayServerWithInsertion.stop();
+        }
+        
         super.tearDown();
         BusFactory.setDefaultBus(null);
     }
@@ -96,6 +107,11 @@
         address = "http://localhost:7070/HeaderService/";
         endpoint = (EndpointImpl) Endpoint.publish(address, impl);
         noRelayServer = endpoint.getServer();
+        
+        impl = new HeaderTesterWithInsertionImpl();
+        address = "http://localhost:5091/HeaderService/";
+        endpoint = (EndpointImpl) Endpoint.publish(address, impl);
+        relayServerWithInsertion = endpoint.getServer();
     }
 
     
@@ -200,7 +216,30 @@
                    response.getFirstName().equals("pass"));
         validateReturnedOutOfBandHeader(proxy);
     }
+    
+    public void testInoutOutOfBandHeaderCXFClientRelayWithHeaderInsertion() throws Exception
{
+        HeaderService s = new HeaderService(getClass().getClassLoader().getResource("soap_header.wsdl"),
+                                            HeaderService.SERVICE);
+        HeaderTester proxy = s.getSoapPortRelayWithInsertion();
+        addOutOfBoundHeader(proxy, false);
+        Me me = new Me();
+        me.setFirstName("john");
+        me.setLastName("Doh");
+        Me response = proxy.inoutOutOfBandHeader(me);
+        assertTrue("Expected the out of band header to propagate but it didn't", 
+                   response.getFirstName().equals("pass"));
+        
+        InvocationHandler handler  = Proxy.getInvocationHandler(proxy);
+        BindingProvider  bp = null;
+        if (!(handler instanceof BindingProvider)) {
+            fail("Unable to cast dynamic proxy InocationHandler to BindingProvider type");
+        }
 
+        bp = (BindingProvider)handler;
+        Map<String, Object> responseContext = bp.getResponseContext();
+        validateReturnedOutOfBandHeaderWithInsertion(responseContext, true);
+    }
+    
     public void testOutOutOfBandHeaderCXFClientRelay() throws Exception {
         HeaderService s = new HeaderService(getClass().getClassLoader().getResource("soap_header.wsdl"),
                                             HeaderService.SERVICE);
@@ -341,7 +380,6 @@
     public void testInOutOutOfBandHeaderCamelTemplateRelay() throws Exception {
         doTestInOutOutOfBandHeaderCamelTemplate("direct:relayProducer");
     }
-
     
     protected void doTestInOutOfBandHeaderCamelTemplate(String producerUri) throws Exception
{
         // START SNIPPET: sending
@@ -488,4 +526,105 @@
                    + hdrToTest.getHdrAttribute(), "testReturnHdrAttribute"
             .equals(hdrToTest.getHdrAttribute()));
     }
+    
+    protected static void validateReturnedOutOfBandHeaderWithInsertion(Map<String, Object>
responseContext, boolean expect) {
+        List<OutofBandHeader> hdrToTest = new ArrayList<OutofBandHeader>();
+        List oobHdr = (List)responseContext.get(Header.HEADER_LIST);
+        if (!expect) {
+            if (oobHdr == null || (oobHdr != null && oobHdr.size() == 0)) {
+                return;
+            }
+            fail("Should have got *no* out-of-band headers, but some were found");
+        }
+        if (oobHdr == null) {
+            fail("Should have got List of out-of-band headers");
+        }
+
+        assertTrue("HeaderHolder list expected to conain 2 object received " + oobHdr.size(),
+                   oobHdr.size() == 2);
+        
+        int i = 0;
+        if (oobHdr != null & oobHdr instanceof List) {
+            Iterator iter = oobHdr.iterator();
+            while (iter.hasNext()) {
+                Object hdr = iter.next();
+                if (hdr instanceof Header) {
+                    Header hdr1 = (Header)hdr;
+                    if (hdr1.getObject() instanceof Node) {
+                        try {
+                            JAXBElement job = (JAXBElement)JAXBContext
+                                .newInstance(org.apache.cxf.outofband.header.ObjectFactory.class)
+                                .createUnmarshaller().unmarshal((Node)hdr1.getObject());
+                            hdrToTest.add((OutofBandHeader)job.getValue());
+                        } catch (JAXBException ex) {
+                            ex.printStackTrace();
+                        }
+                    }
+                }
+            }
+        }
+
+        assertTrue("out-of-band header should not be null", hdrToTest.size() > 0);
+        assertTrue("Expected out-of-band Header name testOobReturnHeaderName recevied :"
+                   + hdrToTest.get(0).getName(), "testOobReturnHeaderName".equals(hdrToTest.get(0).getName()));
+        assertTrue("Expected out-of-band Header value testOobReturnHeaderValue recevied :"
+                   + hdrToTest.get(0).getValue(), "testOobReturnHeaderValue".equals(hdrToTest.get(0).getValue()));
+        assertTrue("Expected out-of-band Header attribute testReturnHdrAttribute recevied
:"
+                   + hdrToTest.get(0).getHdrAttribute(), "testReturnHdrAttribute"
+            .equals(hdrToTest.get(0).getHdrAttribute()));
+        
+        assertTrue("Expected out-of-band Header name New_testOobHeader recevied :"
+                   + hdrToTest.get(1).getName(), "New_testOobHeader".equals(hdrToTest.get(1).getName()));
+        assertTrue("Expected out-of-band Header value New_testOobHeaderValue recevied :"
+                   + hdrToTest.get(1).getValue(), "New_testOobHeaderValue".equals(hdrToTest.get(1).getValue()));
+        assertTrue("Expected out-of-band Header attribute testHdrAttribute recevied :"
+                   + hdrToTest.get(1).getHdrAttribute(), "testHdrAttribute"
+            .equals(hdrToTest.get(1).getHdrAttribute()));
+    }
+
+    public static class InsertRequestOutHeaderProcessor implements Processor {
+
+        public void process(Exchange exchange) throws Exception {
+            CxfMessage message = exchange.getIn().getBody(CxfMessage.class);
+            Message cxf = message.getMessage();
+            List<SoapHeader> soapHeaders = (List)cxf.get(Header.HEADER_LIST);
+
+            // Insert a new header
+            String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><outofbandHeader
"
+                + "xmlns=\"http://cxf.apache.org/outofband/Header\" hdrAttribute=\"testHdrAttribute\"
"
+                + "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" soap:mustUnderstand=\"1\">"
+                + "<name>New_testOobHeader</name><value>New_testOobHeaderValue</value></outofbandHeader>";
+            
+            SoapHeader newHeader = new SoapHeader(soapHeaders.get(0).getName(),
+                                                  DOMUtils.readXml(new StringReader(xml)).getDocumentElement());
+            // make sure direction is IN since it is a request message.
+            newHeader.setDirection(Direction.DIRECTION_IN);
+            //newHeader.setMustUnderstand(false);
+            soapHeaders.add(newHeader);
+            
+        }
+        
+    }
+    
+    public static class InsertResponseOutHeaderProcessor implements Processor {
+
+        public void process(Exchange exchange) throws Exception {
+            CxfMessage message = exchange.getOut().getBody(CxfMessage.class);
+            Map responseContext = (Map)message.getMessage().get(Client.RESPONSE_CONTEXT);
+            List<SoapHeader> soapHeaders = (List)responseContext.get(Header.HEADER_LIST);
+            
+            // Insert a new header
+            String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><outofbandHeader
"
+                + "xmlns=\"http://cxf.apache.org/outofband/Header\" hdrAttribute=\"testHdrAttribute\"
"
+                + "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" soap:mustUnderstand=\"1\">"
+                + "<name>New_testOobHeader</name><value>New_testOobHeaderValue</value></outofbandHeader>";
+            SoapHeader newHeader = new SoapHeader(soapHeaders.get(0).getName(),
+                           DOMUtils.readXml(new StringReader(xml)).getDocumentElement());
+            // make sure direction is OUT since it is a response message.
+            newHeader.setDirection(Direction.DIRECTION_OUT);
+            //newHeader.setMustUnderstand(false);
+            soapHeaders.add(newHeader);
+                                           
+        }
+    }
 }

Modified: camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterImpl.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterImpl.java?rev=810776&r1=810775&r2=810776&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterImpl.java
(original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterImpl.java
Thu Sep  3 04:08:46 2009
@@ -21,9 +21,6 @@
 import java.util.logging.Logger;
 
 import javax.annotation.Resource;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
@@ -56,8 +53,8 @@
     private static final Logger LOG = Logger.getLogger(HeaderTesterImpl.class.getName());
     
     @Resource
-    private WebServiceContext context;
-    private boolean relayHeaders = true;
+    protected WebServiceContext context;
+    protected boolean relayHeaders = true;
     
     public HeaderTesterImpl() {
     }
@@ -189,7 +186,7 @@
         }
     }
     
-    private boolean validateOutOfBandHander() {
+    protected boolean validateOutOfBandHander() {
         MessageContext ctx = context == null ? null : context.getMessageContext();
         if (!relayHeaders) {
             if (ctx != null 

Added: camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterWithInsertionImpl.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterWithInsertionImpl.java?rev=810776&view=auto
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterWithInsertionImpl.java
(added)
+++ camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterWithInsertionImpl.java
Thu Sep  3 04:08:46 2009
@@ -0,0 +1,93 @@
+/**
+ * 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.cxf.soap.headers;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.ws.handler.MessageContext;
+
+import org.w3c.dom.Node;
+
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.outofband.header.OutofBandHeader;
+
+public class HeaderTesterWithInsertionImpl extends HeaderTesterImpl {
+    
+    @Override
+    protected boolean validateOutOfBandHander() {
+        MessageContext ctx = context == null ? null : context.getMessageContext();
+        if (!relayHeaders) {
+            if (ctx != null 
+                && !ctx.containsKey(Header.HEADER_LIST)
+                || (ctx.containsKey(Header.HEADER_LIST) 
+                    && ((List)ctx.get(Header.HEADER_LIST)).size() == 0)) {
+                return true;
+            }
+            return false;
+        }
+        
+        boolean success = false;
+        if (ctx != null && ctx.containsKey(Header.HEADER_LIST)) {
+            List oobHdr = (List) ctx.get(Header.HEADER_LIST);
+            if (oobHdr.size() != 2) {
+                throw new RuntimeException("test failed expected 2 soap headers but found
" + oobHdr.size());
+            }
+            verifyHeader(oobHdr.get(0), "testOobHeader", "testOobHeaderValue");
+            verifyHeader(oobHdr.get(1), "New_testOobHeader", "New_testOobHeaderValue");
+            oobHdr.clear();
+            success = true;
+        } else {
+            throw new RuntimeException("MessageContext is null or doesnot contain OOBHeaders");
+        }
+        
+        return success;
+    }
+
+    private void verifyHeader(Object hdr, String headerName, String headerValue) {
+        if (hdr instanceof Header && ((Header) hdr).getObject() instanceof Node)
{
+            Header hdr1 = (Header) hdr;
+            try {
+                JAXBElement job = 
+                    (JAXBElement)JAXBContext.newInstance(org.apache.cxf.outofband.header.ObjectFactory.class)
+                        .createUnmarshaller()
+                        .unmarshal((Node) hdr1.getObject());
+                OutofBandHeader ob = (OutofBandHeader) job.getValue();
+                if (!headerName.equals(ob.getName())) {
+                    throw new RuntimeException("test failed expected name ' + headerName
+ ' but found '"
+                                               + ob.getName() + "'");
+                }
+                
+                if (!headerValue.equals(ob.getValue())) {
+                    throw new RuntimeException("test failed expected name ' + headerValue
+ ' but found '"
+                                               + ob.getValue() + "'");
+                }
+            } catch (JAXBException ex) {
+                throw new RuntimeException("test failed", ex);
+            }
+        } else {
+            throw new RuntimeException("test failed. Unexpected type " + hdr.getClass());
+        }
+        
+    }        
+    
+    
+
+}

Propchange: camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterWithInsertionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/HeaderTesterWithInsertionImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/message_headers_relay.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/message_headers_relay.xml?rev=810776&r1=810775&r2=810776&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/message_headers_relay.xml
(original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/message_headers_relay.xml
Thu Sep  3 04:08:46 2009
@@ -39,6 +39,21 @@
                    xmlns:tns="http://apache.org/camel/component/cxf/soap/headers">
   </cxf:cxfEndpoint> 
 
+  <cxf:cxfEndpoint id="routerRelayEndpointWithInsertion" 
+                   address="http://localhost:5000/HeaderService/"
+                   serviceClass="org.apache.camel.component.cxf.soap.headers.HeaderTester"
+                   endpointName="tns:SoapPortRelayWithInsertion"
+                   serviceName="tns:HeaderService"
+                   wsdlURL="soap_header.wsdl"
+                   xmlns:tns="http://apache.org/camel/component/cxf/soap/headers">
+        <cxf:inInterceptors>
+		    <ref bean="logInbound"/>
+		</cxf:inInterceptors>	
+		<cxf:outInterceptors>
+		    <ref bean="loggingOutInterceptor"/>
+		</cxf:outInterceptors>	
+  </cxf:cxfEndpoint> 
+
   <cxf:cxfEndpoint id="routerNoRelayEndpoint" 
                    address="http://localhost:7000/HeaderService"
                    serviceClass="org.apache.camel.component.cxf.soap.headers.HeaderTester"
@@ -57,6 +72,21 @@
                    wsdlURL="soap_header.wsdl"
                    xmlns:tns="http://apache.org/camel/component/cxf/soap/headers">
   </cxf:cxfEndpoint>
+  
+  <cxf:cxfEndpoint id="serviceRelayEndpointWithInsertion" 
+                   address="http://localhost:5091/HeaderService/"
+                   serviceClass="org.apache.camel.component.cxf.soap.headers.HeaderTester"
+                   endpointName="tns:SoapPortRelayWithInsertion"
+                   serviceName="tns:HeaderService"
+                   wsdlURL="soap_header.wsdl"
+                   xmlns:tns="http://apache.org/camel/component/cxf/soap/headers">
+        <cxf:inInterceptors>
+		    <ref bean="logInbound"/>
+		</cxf:inInterceptors>	
+        <cxf:outInterceptors>
+		    <ref bean="loggingOutInterceptor"/>
+		</cxf:outInterceptors>	
+  </cxf:cxfEndpoint>
 
   <cxf:cxfEndpoint id="serviceNoRelayEndpoint" 
                    address="http://localhost:7070/HeaderService/"
@@ -83,7 +113,7 @@
           </entry>
       </cxf:properties>
   </cxf:cxfEndpoint>
-  
+               
   <bean id="customHeadersRelay" class="org.apache.camel.component.cxf.soap.headers.CustomHeadersRelay"/>
        
    <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
@@ -92,6 +122,12 @@
           <to uri="cxf:bean:serviceRelayEndpoint"/>
       </route>
       <route>
+          <from uri="cxf:bean:routerRelayEndpointWithInsertion"/>
+          <process ref="InsertRequestOutHeaderProcessor" />
+          <to uri="cxf:bean:serviceRelayEndpointWithInsertion"/>
+          <process ref="InsertResponseOutHeaderProcessor" />
+      </route>      
+      <route>
          <from uri="direct:directProducer" />
          <to uri="cxf:bean:serviceRelayEndpoint?dataFormat=POJO" />
       </route>
@@ -108,4 +144,11 @@
           <to uri="mock:result"/>
       </route>
     </camelContext>
+    
+    <bean id="InsertRequestOutHeaderProcessor" class="org.apache.camel.component.cxf.soap.headers.CxfMessageHeadersRelayTest$InsertRequestOutHeaderProcessor"
/>
+    <bean id="InsertResponseOutHeaderProcessor" class="org.apache.camel.component.cxf.soap.headers.CxfMessageHeadersRelayTest$InsertResponseOutHeaderProcessor"
/>
+    <bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"
/>         
+    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+      
+    
 </beans>

Modified: camel/branches/camel-1.x/components/camel-cxf/src/test/resources/soap_header.wsdl
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/soap_header.wsdl?rev=810776&r1=810775&r2=810776&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/test/resources/soap_header.wsdl (original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/test/resources/soap_header.wsdl Thu
Sep  3 04:08:46 2009
@@ -278,6 +278,9 @@
         </port>        
         <port binding="tns:headerTesterSOAPBinding" name="SoapPortCustomRelay">
             <soap:address location="http://localhost:6000/HeaderService/"/>
-        </port>        
+        </port>      
+        <port binding="tns:headerTesterSOAPBinding" name="SoapPortRelayWithInsertion">
+            <soap:address location="http://localhost:5000/HeaderService/"/>
+        </port>  
     </service>
 </definitions>



Mime
View raw message