Repository: camel
Updated Branches:
  refs/heads/master c16040248 -> 8ea12ce75


Added unit test which shows how to set up schema validate for soap dataformat


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8ea12ce7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8ea12ce7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8ea12ce7

Branch: refs/heads/master
Commit: 8ea12ce75793a019ac18c8ffd2beebcd25837739
Parents: c160402
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Tue May 20 22:44:45 2014 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Tue May 20 22:44:45 2014 +0800

----------------------------------------------------------------------
 .../dataformat/soap/SoapUnMarshalTest.java      |  6 +-
 .../camel/dataformat/soap/CustomerService.xsd   | 90 ++++++++++++++++++++
 2 files changed, 95 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8ea12ce7/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/SoapUnMarshalTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/SoapUnMarshalTest.java
 
b/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/SoapUnMarshalTest.java
index 779c10e..679d5ba 100644
--- 
a/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/SoapUnMarshalTest.java
+++ 
b/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/SoapUnMarshalTest.java
@@ -64,7 +64,11 @@ public class SoapUnMarshalTest extends CamelTestSupport {
 
             @Override
             public void configure() throws Exception {
-                from("direct:start").unmarshal().soapjaxb(SERVICE_PACKAGE)
+                SoapJaxbDataFormat dataFormate = new SoapJaxbDataFormat();
+                dataFormate.setContextPath(SERVICE_PACKAGE);
+                
dataFormate.setSchema("classpath:org/apache/camel/dataformat/soap/CustomerService.xsd,classpath:soap.xsd");
+                
+                from("direct:start").unmarshal(dataFormate)
                         .to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/8ea12ce7/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/CustomerService.xsd
----------------------------------------------------------------------
diff --git 
a/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/CustomerService.xsd
 
b/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/CustomerService.xsd
new file mode 100644
index 0000000..b600a40
--- /dev/null
+++ 
b/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/CustomerService.xsd
@@ -0,0 +1,90 @@
+<?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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
+            xmlns:tns="http://customerservice.example.com/"; 
attributeFormDefault="unqualified"
+            elementFormDefault="unqualified" 
targetNamespace="http://customerservice.example.com/";>
+            <xs:element name="getCustomersByName" 
type="tns:getCustomersByName" />
+            <xs:element name="getCustomersByNameResponse" 
type="tns:getCustomersByNameResponse" />
+            <xs:complexType name="getCustomersByName">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="name" type="xs:string" />
+                </xs:sequence>
+            </xs:complexType>
+            <xs:complexType name="getCustomersByNameResponse">
+                <xs:sequence>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" 
name="return"
+                        type="tns:customer" />
+                </xs:sequence>
+            </xs:complexType>
+            <xs:complexType name="customer">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="name" type="xs:string" />
+                    <xs:element maxOccurs="unbounded" minOccurs="0" 
name="address"
+                        nillable="true" type="xs:string" />
+                    <xs:element name="numOrders" type="xs:int" />
+                    <xs:element name="revenue" type="xs:double" />
+                    <xs:element minOccurs="0" name="test" type="xs:decimal" />
+                    <xs:element minOccurs="0" name="birthDate" 
type="xs:dateTime" />
+                    <xs:element minOccurs="0" name="type" 
type="tns:customerType" />
+                </xs:sequence>
+            </xs:complexType>
+            <xs:simpleType name="customerType">
+                <xs:restriction base="xs:string">
+                    <xs:enumeration value="PRIVATE" />
+                    <xs:enumeration value="BUSINESS" />
+                </xs:restriction>
+            </xs:simpleType>
+            <xs:element name="NoSuchCustomer" type="tns:NoSuchCustomer" />
+            <xs:complexType name="NoSuchCustomer">
+                <xs:sequence>
+                    <xs:element name="customerId" nillable="true" 
type="xs:string" />
+                </xs:sequence>
+            </xs:complexType>
+            <xs:element name="getAllCustomers">
+            </xs:element>
+            <xs:element name="getAllCustomersResponse" 
type="tns:getAllCustomersResponse">
+            </xs:element>
+
+            <xs:complexType name="getAllCustomersResponse">
+                <xs:sequence>
+                    <xs:element name="return" type="tns:customer" 
maxOccurs="unbounded"
+                        minOccurs="0"></xs:element>
+                </xs:sequence>
+            </xs:complexType>
+            
+            <xs:element name="getAllAmericanCustomers">
+            </xs:element>
+            <xs:element name="getAllAmericanCustomersResponse" 
type="tns:getAllAmericanCustomersResponse">
+            </xs:element>
+
+            <xs:complexType name="getAllAmericanCustomersResponse">
+                <xs:sequence>
+                    <xs:element name="return" type="tns:customer" 
maxOccurs="unbounded"
+                        minOccurs="0"></xs:element>
+                </xs:sequence>
+            </xs:complexType>
+
+            <xs:element name="saveCustomer" type="tns:saveCustomer">
+            </xs:element>
+            <xs:complexType name="saveCustomer">
+                <xs:sequence>
+                    <xs:element name="customer" 
type="tns:customer"></xs:element>
+                </xs:sequence>
+            </xs:complexType>
+
+</xs:schema>
\ No newline at end of file

Reply via email to