You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2010/02/08 10:18:11 UTC

svn commit: r907587 [1/2] - in /camel/trunk: camel-core/src/main/java/org/apache/camel/ components/ components/camel-soap/ components/camel-soap/src/ components/camel-soap/src/main/ components/camel-soap/src/main/java/ components/camel-soap/src/main/ja...

Author: ningjiang
Date: Mon Feb  8 09:18:06 2010
New Revision: 907587

URL: http://svn.apache.org/viewvc?rev=907587&view=rev
Log:
CAMEL-2396 applied patch with thanks to Christian

Added:
    camel/trunk/components/camel-soap/
    camel/trunk/components/camel-soap/pom.xml   (with props)
    camel/trunk/components/camel-soap/src/
    camel/trunk/components/camel-soap/src/main/
    camel/trunk/components/camel-soap/src/main/java/
    camel/trunk/components/camel-soap/src/main/java/org/
    camel/trunk/components/camel-soap/src/main/java/org/apache/
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/SoapJaxbDataFormat.java   (with props)
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ElementNameStrategy.java   (with props)
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ExceptionNameStrategy.java   (with props)
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/MethodInfo.java   (with props)
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/QNameStrategy.java   (with props)
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategy.java   (with props)
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeInfo.java   (with props)
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeNameStrategy.java   (with props)
    camel/trunk/components/camel-soap/src/main/resources/
    camel/trunk/components/camel-soap/src/main/resources/META-INF/
    camel/trunk/components/camel-soap/src/main/resources/META-INF/LICENSE.txt   (with props)
    camel/trunk/components/camel-soap/src/main/resources/META-INF/NOTICE.txt   (with props)
    camel/trunk/components/camel-soap/src/main/resources/META-INF/services/
    camel/trunk/components/camel-soap/src/main/resources/META-INF/services/org/
    camel/trunk/components/camel-soap/src/main/resources/META-INF/services/org/apache/
    camel/trunk/components/camel-soap/src/main/resources/META-INF/services/org/apache/camel/
    camel/trunk/components/camel-soap/src/main/resources/META-INF/services/org/apache/camel/dataformat/
    camel/trunk/components/camel-soap/src/main/resources/META-INF/services/org/apache/camel/dataformat/soapjaxb
    camel/trunk/components/camel-soap/src/main/resources/soap.xsd   (with props)
    camel/trunk/components/camel-soap/src/test/
    camel/trunk/components/camel-soap/src/test/java/
    camel/trunk/components/camel-soap/src/test/java/org/
    camel/trunk/components/camel-soap/src/test/java/org/apache/
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/CustomerServerBean.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapClientTest.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalSetterTest.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalTest.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapRoundtripTest.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapServerTest.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapUnMarshalTest.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/TestUtil.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/AnnotatedClassWithNamespace.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/AnnotatedClassWithoutNamespace.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/ExceptionNameStrategyTest.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/QNameStrategyTest.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategyTest.java   (with props)
    camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/TypeNameStrategyTest.java   (with props)
    camel/trunk/components/camel-soap/src/test/resources/
    camel/trunk/components/camel-soap/src/test/resources/log4j.properties   (with props)
    camel/trunk/components/camel-soap/src/test/resources/org/
    camel/trunk/components/camel-soap/src/test/resources/org/apache/
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/soap/
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/soap/CustomerService.wsdl   (with props)
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/soap/CustomerService2.wsdl   (with props)
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/soap/SoapMarshalTestExpectedFault.xml   (with props)
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/soap/SoapMarshalTestExpectedResult.xml   (with props)
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/soap/binding.xml   (with props)
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/soap/request.xml   (with props)
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/soap/requestFault.xml   (with props)
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/soap/response.xml   (with props)
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/converter/soap/responseFault.xml   (with props)
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
    camel/trunk/components/pom.xml

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java?rev=907587&r1=907586&r2=907587&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java Mon Feb  8 09:18:06 2010
@@ -114,6 +114,8 @@
     String TRACE_EVENT_NODE_ID   = "CamelTraceEventNodeId";
     String TRACE_EVENT_TIMESTAMP = "CamelTraceEventTimestamp";
     String TRACE_EVENT_EXCHANGE  = "CamelTraceEventExchange";
+    
+    String SOAP_ACTION = "CamelSoapAction";
 
     /**
      * Returns the {@link ExchangePattern} (MEP) of this exchange.

Added: camel/trunk/components/camel-soap/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/pom.xml?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/pom.xml (added)
+++ camel/trunk/components/camel-soap/pom.xml Mon Feb  8 09:18:06 2010
@@ -0,0 +1,203 @@
+<?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.
+    -->
+<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">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-parent</artifactId>
+        <version>2.3-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-soap</artifactId>
+    <packaging>bundle</packaging>
+    <name>Camel :: SOAP</name>
+    <description>Camel SOAP support</description>
+
+    <properties>
+        <camel.osgi.export.pkg>org.apache.camel.converter.jaxb.*</camel.osgi.export.pkg>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-jaxb</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+
+	<!-- JAXWS api jars -->
+	<dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
+            <version>1.1.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jaxws_2.1_spec</artifactId>
+            <version>1.0</version>
+        </dependency>
+
+        <!-- for testing -->
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-common-utilities</artifactId>
+            <version>${cxf-version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-spring</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.woodstox</groupId>
+            <artifactId>wstx-asl</artifactId>
+            <version>3.2.9</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <forkMode>pertest</forkMode>
+                    <excludes>
+                        <!-- TODO FIXME ASAP -->
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-common-xsd</artifactId>
+                <version>${cxf-version}</version>
+                <executions>
+                    <execution>
+                        <id>generate-sources</id>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <xsdOptions>
+                                <xsdOption>
+                                    <xsd>${basedir}/src/main/resources/soap.xsd</xsd>
+                                </xsdOption>
+                            </xsdOptions>
+                        </configuration>
+                        <goals>
+                            <goal>xsdtojava</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.cxf</groupId>
+                        <artifactId>cxf-xjc-dv</artifactId>
+                        <version>${cxf-version}</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.apache.cxf</groupId>
+                        <artifactId>cxf-common-utilities</artifactId>
+                        <version>${cxf-version}</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-codegen-plugin</artifactId>
+                <version>${cxf-version}</version>
+                <executions>
+                    <execution>
+                        <id>generate-sources-wsdl</id>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
+                            <wsdlOptions>
+                                <wsdlOption>
+                                    <wsdl>${basedir}/src/test/resources/org/apache/camel/converter/soap/CustomerService.wsdl</wsdl>
+                                    <bindingFiles>
+                                        <bindingFile>${basedir}/src/test/resources/org/apache/camel/converter/soap/binding.xml</bindingFile>
+                                    </bindingFiles>
+                                </wsdlOption>
+                                <wsdlOption>
+                                    <wsdl>${basedir}/src/test/resources/org/apache/camel/converter/soap/CustomerService2.wsdl</wsdl>
+                                </wsdlOption>
+                            </wsdlOptions>
+                        </configuration>
+                        <goals>
+                            <goal>wsdl2java</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.cxf</groupId>
+                        <artifactId>cxf-xjc-ts</artifactId>
+                        <version>${cxf-version}</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Propchange: camel/trunk/components/camel-soap/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-soap/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/SoapJaxbDataFormat.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/SoapJaxbDataFormat.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/SoapJaxbDataFormat.java (added)
+++ camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/SoapJaxbDataFormat.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,212 @@
+/**
+ * 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.converter.soap;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Method;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.JAXBIntrospector;
+import javax.xml.namespace.QName;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.bean.BeanInvocation;
+import org.apache.camel.converter.jaxb.JaxbDataFormat;
+import org.apache.camel.converter.soap.name.ElementNameStrategy;
+import org.apache.camel.converter.soap.name.ExceptionNameStrategy;
+import org.apache.camel.converter.soap.name.TypeNameStrategy;
+import org.apache.camel.spi.ClassResolver;
+import org.xmlsoap.schemas.soap.envelope.Body;
+import org.xmlsoap.schemas.soap.envelope.Detail;
+import org.xmlsoap.schemas.soap.envelope.Envelope;
+import org.xmlsoap.schemas.soap.envelope.Fault;
+import org.xmlsoap.schemas.soap.envelope.ObjectFactory;
+
+/**
+ * Marshaling from Objects to SOAP and back by using JAXB. The classes to be
+ * processed need to have JAXB annotations. For marshaling a
+ * ElementNameStrategy is used to determine how the top level elements in SOAP
+ * are named as this can not be extracted from JAXB.
+ */
+public class SoapJaxbDataFormat extends JaxbDataFormat {
+    private static final String SOAP_PACKAGE_NAME = Envelope.class.getPackage().getName();
+
+    private ElementNameStrategy elementNameStrategy;
+
+    /**
+     * Remember to set the context path when using this constructor
+     */
+    public SoapJaxbDataFormat() {
+        super();
+    }
+
+    /**
+     * Initialize with JAXB context path
+     * 
+     * @param contexPath
+     */
+    public SoapJaxbDataFormat(String contexPath) {
+        super(contexPath);
+    }
+
+    /**
+     * Initialize the data format. The serviceInterface is necessary to
+     * determine the element name and namespace of the element inside the soap
+     * body when marshaling
+     * 
+     * @param jaxbPackage
+     *            package for JAXB context
+     * @param serviceInterface
+     *            webservice interface
+     */
+    public SoapJaxbDataFormat(String contextPath, ElementNameStrategy elementNameStrategy) {
+        this(contextPath);
+        this.elementNameStrategy = elementNameStrategy;
+    }
+
+    /**
+     * Marshal inputObject to SOAP xml. If the exchange or message has an EXCEPTION_CAUGTH
+     * property or header then instead of the object the exception is marshaled.
+     * 
+     * To determine the name of the top level xml elment the elementNameStrategy is used.
+     */
+    public void marshal(Exchange exchange, final Object inputObject, OutputStream stream) throws IOException {
+        if (elementNameStrategy == null) {
+            elementNameStrategy = new TypeNameStrategy();
+        }
+
+        String soapAction = (String) exchange.getProperty(Exchange.SOAP_ACTION);
+        Body body = new Body();
+        ClassResolver classResolver = exchange.getContext().getClassResolver();
+
+        Throwable exception = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
+        if (exception == null) {
+            exception = exchange.getIn().getHeader(Exchange.EXCEPTION_CAUGHT, Throwable.class);
+        }
+        final JAXBElement<?> content;
+        if (exception != null) {
+            content = createFaultFromException(exception, soapAction, classResolver);
+        } else {
+            content = createBodyContentFromObject(inputObject, soapAction, classResolver);
+        }
+        body.getAny().add(content);
+        Envelope envelope = new Envelope();
+        envelope.setBody(body);
+        JAXBElement<Envelope> envelopeEl = new ObjectFactory().createEnvelope(envelope);
+        super.marshal(exchange, envelopeEl, stream);
+    }
+
+    /**
+     * Create body content from a non Exception object. If the inputObject is a
+     * BeanInvocation the following should be considered: The first parameter
+     * will be used for the SOAP body. BeanInvocations with more than one
+     * parameter are not supported. So the interface should be in doc lit bare
+     * style.
+     * 
+     * @param inputObject object to be put into the SOAP body
+     * @param soapAction for name resolution
+     * @param classResolver for name resolution
+     * @return JAXBElement for the body content
+     */
+    @SuppressWarnings("unchecked")
+    private JAXBElement<?> createBodyContentFromObject(final Object inputObject, String soapAction,
+            ClassResolver classResolver) {
+        Object graph;
+        if (inputObject instanceof BeanInvocation) {
+            BeanInvocation bi = (BeanInvocation) inputObject;
+            if (bi.getArgs().length > 1) {
+                throw new RuntimeCamelException(
+                        "SoapDataFormat does not work with Beaninvocations that contain more than 1 parameter");
+            }
+            graph = (bi.getArgs().length == 1) ? bi.getArgs()[0] : null;
+        } else {
+            graph = inputObject;
+        }
+        QName name = elementNameStrategy.findQNameForSoapActionOrType(soapAction, graph.getClass(), classResolver);
+        return new JAXBElement(name, graph.getClass(), graph);
+    }
+
+    /**
+     * Creates a SOAP fault from the exception and populates the message as well
+     * as the detail. The detail object is read from the method getFaultInfo of
+     * the throwable if present
+     * 
+     * @param exception
+     * @param soapAction
+     * @param classResolver
+     * @return SOAP fault from given Throwable
+     */
+    @SuppressWarnings("unchecked")
+    private JAXBElement<Fault> createFaultFromException(final Throwable exception, String soapAction,
+            ClassResolver classResolver) {
+        QName name = new ExceptionNameStrategy().findQNameForSoapActionOrType(soapAction, exception.getClass(),
+                classResolver);
+        Object faultObject = null;
+        try {
+            Method method = exception.getClass().getMethod("getFaultInfo");
+            faultObject = method.invoke(exception);
+        } catch (Exception e) {
+            throw new RuntimeCamelException("Exception while trying to get fault details", e);
+        }
+        Fault fault = new Fault();
+        fault
+                .setFaultcode(new QName(exception.getClass().getPackage().getName(), exception.getClass()
+                        .getSimpleName()));
+        fault.setFaultstring(exception.getMessage());
+        Detail detailEl = new ObjectFactory().createDetail();
+        JAXBElement<?> faultDetailContent = new JAXBElement(name, faultObject.getClass(), faultObject);
+        detailEl.getAny().add(faultDetailContent);
+        fault.setDetail(detailEl);
+        return new ObjectFactory().createFault(fault);
+    }
+
+    /**
+     * Unmarshal a given SOAP xml stream and return the content of the SOAP body
+     */
+    public Object unmarshal(Exchange exchange, InputStream stream) throws IOException {
+        Object rootObject = JAXBIntrospector.getValue(super.unmarshal(exchange, stream));
+        if (rootObject.getClass() != Envelope.class) {
+            throw new RuntimeCamelException("Expected Soap Envelope but got " + rootObject.getClass());
+        }
+        Envelope envelope = (Envelope) rootObject;
+        Object payloadEl = envelope.getBody().getAny().get(0);
+        return (isIgnoreJAXBElement()) ? JAXBIntrospector.getValue(payloadEl) : payloadEl;
+    }
+
+    /**
+     * Added the generated SOAP package to the JAXB context so Soap datatypes
+     * are available
+     */
+    @Override
+    protected JAXBContext createContext() throws JAXBException {
+        if (getContextPath() != null) {
+            return JAXBContext.newInstance(SOAP_PACKAGE_NAME + ":" + getContextPath());
+        } else {
+            return JAXBContext.newInstance();
+        }
+    }
+
+    public void setElementNameStrategy(ElementNameStrategy elementNameStrategy) {
+        this.elementNameStrategy = elementNameStrategy;
+    }
+
+}

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/SoapJaxbDataFormat.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/SoapJaxbDataFormat.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ElementNameStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ElementNameStrategy.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ElementNameStrategy.java (added)
+++ camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ElementNameStrategy.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,37 @@
+/**
+ * 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.converter.soap.name;
+
+import javax.xml.namespace.QName;
+
+import org.apache.camel.spi.ClassResolver;
+
+/**
+ * Strategy interface for determining the element name for a SOAP body or fault
+ */
+public interface ElementNameStrategy {
+    
+    /**
+     * Deterimine element name for given type
+     * 
+     * @param soapAction
+     * @param type
+     * @param classResolver
+     * @return resolved element name
+     */
+    QName findQNameForSoapActionOrType(String soapAction, Class<?> type, ClassResolver classResolver);
+}

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ElementNameStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ElementNameStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ExceptionNameStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ExceptionNameStrategy.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ExceptionNameStrategy.java (added)
+++ camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ExceptionNameStrategy.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,39 @@
+/**
+ * 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.converter.soap.name;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebFault;
+
+import org.apache.camel.spi.ClassResolver;
+
+/**
+ * Determine element name for an exception
+ */
+public class ExceptionNameStrategy implements ElementNameStrategy {
+    
+    /**
+     * @return QName from exception class by evaluating the WebFault annotataion
+     */
+    public QName findQNameForSoapActionOrType(String soapAction, Class<?> type, ClassResolver classResolver) {
+        WebFault webFault = type.getAnnotation(WebFault.class);
+        if (webFault == null || webFault.targetNamespace() == null) {
+            throw new RuntimeException("The type " + type.getName() + " needs to have an WebFault annotation with name and targetNamespace");
+        }
+        return new QName(webFault.targetNamespace(), webFault.name());
+    }
+}

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ExceptionNameStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ExceptionNameStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/MethodInfo.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/MethodInfo.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/MethodInfo.java (added)
+++ camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/MethodInfo.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,53 @@
+/**
+ * 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.converter.soap.name;
+
+/**
+ * Value object to hold information about a method in a JAX-WS service interface
+ */
+final class MethodInfo {
+    private String soapAction;
+    private TypeInfo in;
+    private TypeInfo out;
+    
+    /**
+     * Initialize 
+     * 
+     * @param soapAction
+     * @param in input parameter (document style so only one parameter)
+     * @param out return type
+     */
+    public MethodInfo(String soapAction, TypeInfo in, TypeInfo out) {
+        super();
+        this.soapAction = soapAction;
+        this.in = in;
+        this.out = out;
+    }
+
+    public String getSoapAction() {
+        return soapAction;
+    }
+
+    public TypeInfo getIn() {
+        return in;
+    }
+
+    public TypeInfo getOut() {
+        return out;
+    }
+
+}

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/MethodInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/MethodInfo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/QNameStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/QNameStrategy.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/QNameStrategy.java (added)
+++ camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/QNameStrategy.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,45 @@
+/**
+ * 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.converter.soap.name;
+
+import javax.xml.namespace.QName;
+
+import org.apache.camel.spi.ClassResolver;
+
+/**
+ * Simply ElementNameStrategy that returns one preset QName
+ */
+public class QNameStrategy implements ElementNameStrategy {
+    private QName elementName;
+    
+    /**
+     * Initialize with one QName
+     * 
+     * @param elmentName QName to be used for all finds
+     */
+    public QNameStrategy(QName elmentName) {
+        this.elementName = elmentName;
+    }
+    
+    /**
+     * @return preset element name
+     */
+    public QName findQNameForSoapActionOrType(String soapAction, Class<?> type, ClassResolver classResolver) {
+        return elementName;
+    }
+    
+}

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/QNameStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/QNameStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategy.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategy.java (added)
+++ camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategy.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,157 @@
+/**
+ * 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.converter.soap.name;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.xml.namespace.QName;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.ClassResolver;
+
+/**
+ * Offers a finder for a webservice interface to determine the QName of a
+ * webservice data element
+ */
+public class ServiceInterfaceStrategy implements ElementNameStrategy {
+    private Map<String, MethodInfo> soapActionToMethodInfo = new HashMap<String, MethodInfo>();
+    private Map<String, QName> inTypeNameToQName = new HashMap<String, QName>();
+    private Map<String, QName> outTypeNameToQName = new HashMap<String, QName>();
+    private boolean isClient;
+    private ElementNameStrategy fallBackStrategy;
+
+    /**
+     * Init with JAX-WS service interface
+     * 
+     * @param serviceInterface
+     * @param isClient
+     *            determines if marhalling looks at input or output of method
+     */
+    public ServiceInterfaceStrategy(Class<?> serviceInterface, boolean isClient) {
+        analyzeServiceInterface(serviceInterface);
+        this.isClient = isClient;
+        this.fallBackStrategy = new TypeNameStrategy();
+    }
+
+    private TypeInfo getOutInfo(Method method) {
+        ResponseWrapper respWrap = method.getAnnotation(ResponseWrapper.class);
+        if (respWrap != null) {
+            if (respWrap.className() != null) {
+                return new TypeInfo(respWrap.className(), new QName(respWrap.targetNamespace(), respWrap.localName()));
+            }
+        } else {
+            Class<?> type = method.getReturnType();
+            WebResult webResult = method.getAnnotation(WebResult.class);
+            if (webResult != null) {
+                return new TypeInfo(type.getName(), new QName(webResult.targetNamespace(), webResult.name()));
+            }
+        }
+        throw new RuntimeCamelException("The method " + method.getName()
+                + " has no ResponseWrapper and no suitable return type");
+    }
+
+    private TypeInfo getInInfo(Method method) {
+        RequestWrapper requestWrapper = method.getAnnotation(RequestWrapper.class);
+        Class<?>[] types = method.getParameterTypes();
+        if (requestWrapper != null) {
+            if (requestWrapper.className() != null) {
+                return new TypeInfo(requestWrapper.className(), new QName(requestWrapper.targetNamespace(),
+                        requestWrapper.localName()));
+            }
+        } else if (types.length == 1) {
+            Annotation[] firstParamAnnotations = method.getParameterAnnotations()[0];
+            for (Annotation annotation : firstParamAnnotations) {
+                if (annotation instanceof WebParam) {
+                    WebParam webParam = (WebParam) annotation;
+                    return new TypeInfo(types[0].getName(), new QName(webParam.targetNamespace(), webParam.name()));
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Determines how the parameter object of the service method will be named
+     * in xml. It will use either the RequestWrapper annotation of the method if
+     * present or the WebParam method of the parameter.
+     * 
+     * @param method
+     */
+    private MethodInfo analyzeMethod(Method method) {
+        TypeInfo inInfo = getInInfo(method);
+        TypeInfo outInfo = getOutInfo(method);
+        WebMethod webMethod = method.getAnnotation(WebMethod.class);
+        String soapAction = (webMethod != null) ? webMethod.action() : null;
+        return new MethodInfo(soapAction, inInfo, outInfo);
+    }
+
+    private void analyzeServiceInterface(Class<?> serviceInterface) {
+        Method[] methods = serviceInterface.getMethods();
+        for (Method method : methods) {
+            MethodInfo info = analyzeMethod(method);
+            inTypeNameToQName.put(info.getIn().getTypeName(), info.getIn().getElName());
+            if (info.getSoapAction() != null && !"".equals(info.getSoapAction())) {
+                soapActionToMethodInfo.put(info.getSoapAction(), info);
+            }
+            outTypeNameToQName.put(info.getOut().getTypeName(), info.getOut().getElName());
+        }
+    }
+
+    /**
+     * Determine the QName of the method parameter of the method that matches
+     * either soapAction and type or if not possible only the type
+     * 
+     * @param soapAction
+     * @param type
+     * @return matching QName throws RuntimeException if no matching QName was
+     *         found
+     */
+    public QName findQNameForSoapActionOrType(String soapAction, Class<?> type, ClassResolver classResolver) {
+        MethodInfo info = soapActionToMethodInfo.get(soapAction);
+        if (info != null) {
+            if (isClient) {
+                return info.getIn().getElName();
+            } else {
+                return info.getOut().getElName();
+            }
+        }
+        QName qName = null;
+        if (isClient) {
+            qName = inTypeNameToQName.get(type.getName());
+        } else {
+            qName = outTypeNameToQName.get(type.getName());
+        }
+        if (qName == null) {
+            try {
+                qName = fallBackStrategy.findQNameForSoapActionOrType(soapAction, type, classResolver);
+            } catch (Exception e) {
+                String msg = "No method found that matches the given SoapAction " + soapAction + " or that has an "
+                        + (isClient ? "input" : "output") + " of type " + type.getName();
+                throw new RuntimeCamelException(msg, e);
+            }
+        }
+        return qName;
+    }
+}

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeInfo.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeInfo.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeInfo.java (added)
+++ camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeInfo.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,49 @@
+/**
+ * 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.converter.soap.name;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Value object to hold type information about parameters and return type of a
+ * method
+ */
+final class TypeInfo {
+    private final String typeName;
+    private final QName elName;
+
+    /**
+     * Initialize TypeInfo with given name and resolved element name for a type
+     * 
+     * @param typeName
+     * @param elName
+     */
+    public TypeInfo(final String typeName, final QName elName) {
+        super();
+        this.typeName = typeName;
+        this.elName = elName;
+    }
+
+    public String getTypeName() {
+        return typeName;
+    }
+
+    public QName getElName() {
+        return elName;
+    }
+
+}

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeInfo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeNameStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeNameStrategy.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeNameStrategy.java (added)
+++ camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeNameStrategy.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,53 @@
+/**
+ * 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.converter.soap.name;
+
+import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+import org.apache.camel.spi.ClassResolver;
+
+/**
+ * Strategy to determine the marshalled element name by looking at the annotations of the
+ * class to be marshalled
+ */
+public class TypeNameStrategy implements ElementNameStrategy {
+
+    /**
+     * @return determine element name by using the XmlType.name() of the type to be
+     * marshalled and the XmlSchema.namespace() of the package-info
+     */
+    public QName findQNameForSoapActionOrType(String soapAction, Class<?> type, ClassResolver classResolver) {
+        XmlType xmlType = type.getAnnotation(XmlType.class);
+        if (xmlType == null || xmlType.name() == null) {
+            throw new RuntimeException("The type " + type.getName() + " needs to have an XmlType annotation with name");
+        }
+        String nameSpace = xmlType.namespace();
+        if ("##default".equals(nameSpace)) {
+            try {
+                Class<?> packageInfo = classResolver.resolveMandatoryClass(type.getPackage().getName() + ".package-info");
+                XmlSchema xmlSchema = packageInfo.getAnnotation(XmlSchema.class);
+                nameSpace = xmlSchema.namespace();
+            } catch (ClassNotFoundException e) {
+                throw new RuntimeException("package info not found for package " + type.getPackage().getName(), e);
+            }
+        }
+        return new QName(nameSpace, xmlType.name());
+    }
+    
+}

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeNameStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/converter/soap/name/TypeNameStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/main/resources/META-INF/LICENSE.txt
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/resources/META-INF/LICENSE.txt?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/resources/META-INF/LICENSE.txt (added)
+++ camel/trunk/components/camel-soap/src/main/resources/META-INF/LICENSE.txt Mon Feb  8 09:18:06 2010
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Propchange: camel/trunk/components/camel-soap/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/components/camel-soap/src/main/resources/META-INF/NOTICE.txt
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/resources/META-INF/NOTICE.txt?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/resources/META-INF/NOTICE.txt (added)
+++ camel/trunk/components/camel-soap/src/main/resources/META-INF/NOTICE.txt Mon Feb  8 09:18:06 2010
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

Propchange: camel/trunk/components/camel-soap/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/components/camel-soap/src/main/resources/META-INF/services/org/apache/camel/dataformat/soapjaxb
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/resources/META-INF/services/org/apache/camel/dataformat/soapjaxb?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/resources/META-INF/services/org/apache/camel/dataformat/soapjaxb (added)
+++ camel/trunk/components/camel-soap/src/main/resources/META-INF/services/org/apache/camel/dataformat/soapjaxb Mon Feb  8 09:18:06 2010
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.converter.jaxb.soap.SoapJaxbDataFormat

Added: camel/trunk/components/camel-soap/src/main/resources/soap.xsd
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/resources/soap.xsd?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/main/resources/soap.xsd (added)
+++ camel/trunk/components/camel-soap/src/main/resources/soap.xsd Mon Feb  8 09:18:06 2010
@@ -0,0 +1,126 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+
+<!-- Schema for the SOAP/1.1 envelope
+
+Portions © 2001 DevelopMentor. 
+© 2001 W3C (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.  
+ 
+This document is governed by the W3C Software License [1] as described in the FAQ [2].
+[1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
+[2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD 
+By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:
+
+Permission to use, copy, modify, and distribute this software and its documentation, with or without modification,  for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make:
+
+1.  The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 
+
+2.  Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, a short notice of the following form (hypertext is preferred, text is permitted) should be used within the body of any redistributed or derivative code: "Copyright © 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/" 
+
+3.  Notice of any changes or modifications to the W3C files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)   
+
+Original W3C files; http://www.w3.org/2001/06/soap-envelope
+Changes made: 
+     - reverted namespace to http://schemas.xmlsoap.org/soap/envelope/
+     - reverted mustUnderstand to only allow 0 and 1 as lexical values
+	 - made encodingStyle a global attribute 20020825
+	 - removed default value from mustUnderstand attribute declaration
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
+
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/"
+           targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" >
+
+     
+  <!-- Envelope, header and body -->
+  <xs:element name="Envelope" type="tns:Envelope" />
+  <xs:complexType name="Envelope" >
+    <xs:sequence>
+      <xs:element ref="tns:Header" minOccurs="0" />
+      <xs:element ref="tns:Body" minOccurs="1" />
+      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+    </xs:sequence>
+    <xs:anyAttribute namespace="##other" processContents="lax" />
+  </xs:complexType>
+
+  <xs:element name="Header" type="tns:Header" />
+  <xs:complexType name="Header" >
+    <xs:sequence>
+      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+    </xs:sequence>
+    <xs:anyAttribute namespace="##other" processContents="lax" />
+  </xs:complexType>
+  
+  <xs:element name="Body" type="tns:Body" />
+  <xs:complexType name="Body" >
+    <xs:sequence>
+      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+    </xs:sequence>
+    <xs:anyAttribute namespace="##any" processContents="lax" >
+	  <xs:annotation>
+	    <xs:documentation>
+		  Prose in the spec does not specify that attributes are allowed on the Body element
+		</xs:documentation>
+	  </xs:annotation>
+	</xs:anyAttribute>
+  </xs:complexType>
+
+       
+  <!-- Global Attributes.  The following attributes are intended to be usable via qualified attribute names on any complex type referencing them.  -->
+  <xs:attribute name="mustUnderstand" >	
+     <xs:simpleType>
+     <xs:restriction base='xs:boolean'>
+	   <xs:pattern value='0|1' />
+	 </xs:restriction>
+   </xs:simpleType>
+  </xs:attribute>
+  <xs:attribute name="actor" type="xs:anyURI" />
+
+  <xs:simpleType name="encodingStyle" >
+    <xs:annotation>
+	  <xs:documentation>
+	    'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element.  For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification
+	  </xs:documentation>
+	</xs:annotation>
+    <xs:list itemType="xs:anyURI" />
+  </xs:simpleType>
+
+  <xs:attribute name="encodingStyle" type="tns:encodingStyle" />
+  <xs:attributeGroup name="encodingStyle" >
+    <xs:attribute ref="tns:encodingStyle" />
+  </xs:attributeGroup>
+
+  <xs:element name="Fault" type="tns:Fault" />
+  <xs:complexType name="Fault" final="extension" >
+    <xs:annotation>
+	  <xs:documentation>
+	    Fault reporting structure
+	  </xs:documentation>
+	</xs:annotation>
+    <xs:sequence>
+      <xs:element name="faultcode" type="xs:QName" />
+      <xs:element name="faultstring" type="xs:string" />
+      <xs:element name="faultactor" type="xs:anyURI" minOccurs="0" />
+      <xs:element name="detail" type="tns:detail" minOccurs="0" />      
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="detail">
+    <xs:sequence>
+      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+    </xs:sequence>
+    <xs:anyAttribute namespace="##any" processContents="lax" /> 
+  </xs:complexType>
+
+</xs:schema>
+
+
+
+
+
+

Propchange: camel/trunk/components/camel-soap/src/main/resources/soap.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/main/resources/soap.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-soap/src/main/resources/soap.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/CustomerServerBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/CustomerServerBean.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/CustomerServerBean.java (added)
+++ camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/CustomerServerBean.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,43 @@
+/**
+ * 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.converter.soap;
+
+import com.example.customerservice.Customer;
+import com.example.customerservice.CustomerService;
+import com.example.customerservice.GetCustomersByName;
+import com.example.customerservice.GetCustomersByNameResponse;
+import com.example.customerservice.NoSuchCustomer;
+import com.example.customerservice.NoSuchCustomerException;
+
+public class CustomerServerBean implements CustomerService {
+
+    public GetCustomersByNameResponse getCustomersByName(GetCustomersByName request)
+        throws NoSuchCustomerException {
+        if ("none".equals(request.getName())) {
+            NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
+            noSuchCustomer.setCustomerId(request.getName());
+            throw new NoSuchCustomerException("Customer not found", noSuchCustomer);
+        }
+        GetCustomersByNameResponse response = new GetCustomersByNameResponse();
+        Customer customer = new Customer();
+        customer.setName(request.getName());
+        customer.setRevenue(100000);
+        response.getReturn().add(customer);
+        return response;
+    }
+
+}

Propchange: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/CustomerServerBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/CustomerServerBean.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapClientTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapClientTest.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapClientTest.java (added)
+++ camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapClientTest.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,95 @@
+/**
+ * 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.converter.soap;
+
+import java.io.InputStream;
+
+import junit.framework.Assert;
+
+import com.example.customerservice.Customer;
+import com.example.customerservice.CustomerService;
+import com.example.customerservice.GetCustomersByName;
+import com.example.customerservice.GetCustomersByNameResponse;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.bean.ProxyHelper;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.converter.soap.name.ElementNameStrategy;
+import org.apache.camel.converter.soap.name.TypeNameStrategy;
+import org.apache.camel.test.CamelTestSupport;
+
+public class SoapClientTest extends CamelTestSupport {
+    private final class FileReplyProcessor implements Processor {
+        private final InputStream in;
+
+        private FileReplyProcessor(InputStream in) {
+            this.in = in;
+        }
+
+        public void process(Exchange exchange) throws Exception {
+            exchange.getIn().setBody(in);
+        }
+    }
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+    protected CustomerService proxy;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate producer;
+
+    @SuppressWarnings("unchecked")
+    public void testRoundTrip() throws Exception {
+        context.setTracing(true);
+        Endpoint start = context.getEndpoint("direct:start");
+        proxy = ProxyHelper.createProxy(start,
+                this.getClass().getClassLoader(), CustomerService.class);
+
+        GetCustomersByNameResponse response = proxy
+                .getCustomersByName(new GetCustomersByName());
+        Assert.assertEquals(1, response.getReturn().size());
+        Customer firstCustomer = response.getReturn().get(0);
+        Assert.assertEquals(100000.0, firstCustomer.getRevenue());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            String jaxbPackage = GetCustomersByName.class.getPackage()
+                    .getName();
+
+            @Override
+            public void configure() throws Exception {
+                ElementNameStrategy elNameStrat = new TypeNameStrategy();
+                SoapJaxbDataFormat soapDataFormat = new SoapJaxbDataFormat(
+                        jaxbPackage, elNameStrat);
+                final InputStream in = this.getClass().getResourceAsStream(
+                        "response.xml");
+                from("direct:start").marshal(soapDataFormat).to("mock:result")
+                        .process(new FileReplyProcessor(in)).unmarshal(
+                                soapDataFormat);
+            }
+        };
+    }
+
+}

Propchange: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapClientTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapClientTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalSetterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalSetterTest.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalSetterTest.java (added)
+++ camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalSetterTest.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,39 @@
+/**
+ * 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.converter.soap;
+
+import com.example.customerservice.GetCustomersByName;
+
+/**
+ * Works like SoapMarshalTest but the Dataformat is initialized by using the setters
+ * instead of the contructor
+ */
+public class SoapMarshalSetterTest extends SoapMarshalTest {
+
+    /**
+     * Create Dataformat by using the setters
+     */
+    @Override
+    protected SoapJaxbDataFormat createDataFormat() {
+        String jaxbPackage = GetCustomersByName.class.getPackage().getName();
+        SoapJaxbDataFormat dataFormat = new SoapJaxbDataFormat();
+        dataFormat.setContextPath(jaxbPackage);
+        dataFormat.setElementNameStrategy(null);
+        return dataFormat;
+    }
+    
+}

Propchange: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalSetterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalSetterTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalTest.java?rev=907587&view=auto
==============================================================================
--- camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalTest.java (added)
+++ camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalTest.java Mon Feb  8 09:18:06 2010
@@ -0,0 +1,102 @@
+/**
+ * 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.converter.soap;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import com.example.customerservice.GetCustomersByName;
+import com.example.customerservice.NoSuchCustomer;
+import com.example.customerservice.NoSuchCustomerException;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.converter.soap.name.ElementNameStrategy;
+import org.apache.camel.converter.soap.name.TypeNameStrategy;
+import org.apache.camel.test.CamelTestSupport;
+
+public class SoapMarshalTest extends CamelTestSupport {
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate producer;
+
+    /**
+     * Test Soap marshalling by sending a GetCustomerByName object and checking
+     * against a xml file.
+     * 
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    public void testMarshalNormalObject() throws IOException, InterruptedException {
+        InputStream in = this.getClass().getResourceAsStream("SoapMarshalTestExpectedResult.xml");
+        resultEndpoint.expectedMessageCount(1);
+        resultEndpoint.expectedBodiesReceived(TestUtil.readStream(in));
+        GetCustomersByName request = new GetCustomersByName();
+        request.setName("Smith");
+        producer.sendBody(request);
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    /**
+     * Test Soap marshalling by sending a NoSuchCustomerException object and
+     * checking against a xml file. We expect to receive a SOAP fault here that
+     * contains a NoSuchCustomer object as detail.
+     * 
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    public void testMarshalException() throws IOException, InterruptedException {
+        InputStream in = this.getClass().getResourceAsStream("SoapMarshalTestExpectedFault.xml");
+        resultEndpoint.expectedMessageCount(1);
+        resultEndpoint.expectedBodiesReceived(TestUtil.readStream(in));
+        NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
+        noSuchCustomer.setCustomerId("None");
+        NoSuchCustomerException exception = new NoSuchCustomerException("No customer found", noSuchCustomer);
+        producer.sendBodyAndHeader(null, Exchange.EXCEPTION_CAUGHT, exception);
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    protected SoapJaxbDataFormat createDataFormat() {
+        String jaxbPackage = GetCustomersByName.class.getPackage().getName();
+        ElementNameStrategy elStrat = new TypeNameStrategy();
+        return new SoapJaxbDataFormat(jaxbPackage, elStrat);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() throws Exception {
+                SoapJaxbDataFormat df = createDataFormat();
+                from("direct:start") //
+                        .onException(Exception.class) //
+                            .marshal(df) //
+                            .end() //
+                        .marshal(df) //
+                        .to("mock:result");
+            }
+        };
+    }
+
+}

Propchange: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-soap/src/test/java/org/apache/camel/converter/soap/SoapMarshalTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date