You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2016/05/24 13:28:48 UTC

[1/5] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

Repository: cxf
Updated Branches:
  refs/heads/master e158c96dc -> 517ef67f1


http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java
new file mode 100644
index 0000000..c96eec5
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java
@@ -0,0 +1,47 @@
+/**
+ * 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.cxf.systest.ws.transfer.validator;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.shared.faults.PutDenied;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceValidator;
+
+public class StudentPutResourceValidator implements ResourceValidator {
+
+    public static final String UID_NAMESPACE = "http://university.edu/student";
+    
+    public static final String UID_NAME = "uid";
+    
+    @Override
+    public boolean validate(Representation newRepresentation, Representation oldRepresentation) {
+        Element newRepresentationEl = (Element) newRepresentation.getAny();
+        Element oldRepresentationEl = (Element) oldRepresentation.getAny();
+        
+        String newUid = newRepresentationEl.getElementsByTagNameNS(UID_NAMESPACE, UID_NAME).item(0).getTextContent();
+        String oldUid = oldRepresentationEl.getElementsByTagNameNS(UID_NAMESPACE, UID_NAME).item(0).getTextContent();
+        
+        if (!newUid.equals(oldUid)) {
+            throw new PutDenied();
+        }
+        return true;
+    } 
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java
new file mode 100644
index 0000000..0371366
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java
@@ -0,0 +1,51 @@
+/**
+ * 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.cxf.systest.ws.transfer.validator;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.shared.faults.PutDenied;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceValidator;
+
+public class TeacherResourceValidator implements ResourceValidator {
+    
+    public static final String UID_NAMESPACE = "http://university.edu/teacher";
+    
+    public static final String UID_NAME = "uid";
+    
+    @Override
+    public boolean validate(Representation newRepresentation, Representation oldRepresentation) {
+        if (oldRepresentation != null) {
+            Element newRepresentationEl = (Element) newRepresentation.getAny();
+            Element oldRepresentationEl = (Element) oldRepresentation.getAny();
+
+            String newUid = newRepresentationEl.getElementsByTagNameNS(
+                UID_NAMESPACE, UID_NAME).item(0).getTextContent();
+            String oldUid = oldRepresentationEl.getElementsByTagNameNS(
+                UID_NAMESPACE, UID_NAME).item(0).getTextContent();
+
+            if (!newUid.equals(oldUid)) {
+                throw new PutDenied();
+            }
+        }
+        return true;
+    } 
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd b/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd
new file mode 100644
index 0000000..1947c45
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+
+<!--
+  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 version="1.0"
+           targetNamespace="http://university.edu/student"
+           xmlns:ns="http://university.edu/student"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:complexType name="birthDateType">
+        <xs:sequence>
+            <xs:element name="day" type="xs:integer"/>
+            <xs:element name="month" type="xs:integer"/>
+            <xs:element name="year" type="xs:integer"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:element name="student">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="surname" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="birthdate" type="ns:birthDateType" minOccurs="0" maxOccurs="1" />
+                <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="1" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/studentPut.xsd
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/schema/studentPut.xsd b/systests/ws-transfer/src/test/resources/schema/studentPut.xsd
new file mode 100644
index 0000000..831ffce
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/schema/studentPut.xsd
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<!--
+  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 version="1.0"
+           targetNamespace="http://university.edu/student"
+           xmlns:ns="http://university.edu/student"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:complexType name="birthDateType">
+        <xs:sequence>
+            <xs:element name="day" type="xs:integer"/>
+            <xs:element name="month" type="xs:integer"/>
+            <xs:element name="year" type="xs:integer"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:element name="student">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="surname" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="birthdate" type="ns:birthDateType" minOccurs="0" maxOccurs="1" />
+                <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="uid" type="xs:integer" minOccurs="1" maxOccurs="1" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/teacher.xsd
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/schema/teacher.xsd b/systests/ws-transfer/src/test/resources/schema/teacher.xsd
new file mode 100644
index 0000000..8dab259
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/schema/teacher.xsd
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<!--
+  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 version="1.0"
+           targetNamespace="http://university.edu/teacher"
+           xmlns:ns="http://university.edu/teacher"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:complexType name="birthDateType">
+        <xs:sequence>
+            <xs:element name="day" type="xs:integer"/>
+            <xs:element name="month" type="xs:integer"/>
+            <xs:element name="year" type="xs:integer"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:element name="teacher">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="surname" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="birthdate" type="ns:birthDateType" minOccurs="0" maxOccurs="1" />
+                <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="1" />
+                <xs:element name="uid" type="xs:integer" minOccurs="1" maxOccurs="1" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd b/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd
new file mode 100644
index 0000000..db1965f
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+  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 version="1.0"
+           targetNamespace="http://university.edu/teacher"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:element name="teacher">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createStudent.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createStudent.xml b/systests/ws-transfer/src/test/resources/xml/createStudent.xml
new file mode 100644
index 0000000..cb021af
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createStudent.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+
+<student xmlns="http://university.edu/student">
+    <name>John</name>
+    <surname>Smith</surname>
+    <birthdate>
+        <day>14</day>
+        <month>3</month>
+        <year>1994</year>
+    </birthdate>
+    <address>Street 21</address>
+</student>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml b/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml
new file mode 100644
index 0000000..3c00e64
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<student xmlns="http://university.edu/student">
+    <name>John</name>
+    <birthdate>
+        <day>14</day>
+        <month>3</month>
+        <year>1994</year>
+    </birthdate>
+</student>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml b/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml
new file mode 100644
index 0000000..957af34
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml
@@ -0,0 +1,32 @@
+<?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.
+-->
+
+<student xmlns="http://university.edu/student">
+    <name>John</name>
+    <surname>Smith</surname>
+    <birthdate>
+        <day>14</day>
+        <month>3</month>
+        <year>1994</year>
+    </birthdate>
+    <address>Street 21</address>
+    <school>Standford</school>
+</student>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createTeacher.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createTeacher.xml b/systests/ws-transfer/src/test/resources/xml/createTeacher.xml
new file mode 100644
index 0000000..0d6e18b
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createTeacher.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+
+<teacher xmlns="http://university.edu/teacher">
+    <name>Bob</name>
+    <surname>Stuart</surname>
+    <birthdate>
+        <day>5</day>
+        <month>7</month>
+        <year>1971</year>
+    </birthdate>
+    <address>Street 526</address>
+</teacher>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml b/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml
new file mode 100644
index 0000000..f9025b2
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+
+<teacher xmlns="http://university.edu/teacher">
+    <name>Bob</name>
+    <address>Street 526</address>
+</teacher>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml b/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml
new file mode 100644
index 0000000..31f86e6
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml
@@ -0,0 +1,32 @@
+<?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.
+-->
+
+<teacher xmlns="http://university.edu/teacher">
+    <name>Bob</name>
+    <surname>Stuart</surname>
+    <birthdate>
+        <day>5</day>
+        <month>7</month>
+        <year>1971</year>
+    </birthdate>
+    <address>Street 526</address>
+    <school>Standford</school>
+</teacher>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/putStudent.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/putStudent.xml b/systests/ws-transfer/src/test/resources/xml/putStudent.xml
new file mode 100644
index 0000000..2112f8c
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/putStudent.xml
@@ -0,0 +1,32 @@
+<?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.
+-->
+
+<student xmlns="http://university.edu/student">
+    <name>John</name>
+    <surname>Smith</surname>
+    <birthdate>
+        <day>14</day>
+        <month>3</month>
+        <year>1994</year>
+    </birthdate>
+    <address>Street 12</address>
+    <uid>1</uid>
+</student>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/putTeacher.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/putTeacher.xml b/systests/ws-transfer/src/test/resources/xml/putTeacher.xml
new file mode 100644
index 0000000..dda58a8
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/putTeacher.xml
@@ -0,0 +1,32 @@
+<?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.
+-->
+
+<teacher xmlns="http://university.edu/teacher">
+    <name>Bob</name>
+    <surname>Stuart</surname>
+    <birthdate>
+        <day>5</day>
+        <month>7</month>
+        <year>1971</year>
+    </birthdate>
+    <address>Street 526</address>
+    <uid>1</uid>
+</teacher>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/random.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xml/random.xml b/systests/ws-transfer/src/test/resources/xml/random.xml
new file mode 100644
index 0000000..43aa6b7
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xml/random.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<foo>
+	<bar/>
+</foo>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl b/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl
new file mode 100644
index 0000000..e9255f9
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl
@@ -0,0 +1,110 @@
+<?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.
+-->
+
+<xsl:stylesheet xmlns="http://university.edu/student"
+                xmlns:ns="http://university.edu/student"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:uid="org.apache.cxf.systest.ws.transfer.UIDManager"
+                exclude-result-prefixes="uid"
+                version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="/">
+        <xsl:element name="student">
+            <xsl:call-template name="name"/>
+            <xsl:call-template name="surname"/>
+            <xsl:call-template name="birthdate"/>
+            <xsl:call-template name="address"/>
+            <xsl:call-template name="uid"/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template name="name">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:name">
+                <xsl:element name="name">
+                    <xsl:value-of select="/ns:student/ns:name" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="name">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="surname">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:surname">
+                <xsl:element name="surname">
+                    <xsl:value-of select="/ns:student/ns:surname" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="surname">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="birthdate">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:birthdate">
+                <xsl:element name="date">
+                    <xsl:element name="day">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:day" />
+                    </xsl:element>
+                    <xsl:element name="month">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:month" />
+                    </xsl:element>
+                    <xsl:element name="year">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:year" />
+                    </xsl:element>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="date">
+                    <xsl:element name="day">Unspecified</xsl:element>
+                    <xsl:element name="month">Unspecified</xsl:element>
+                    <xsl:element name="year">Unspecified</xsl:element>
+                </xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="address">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:address">
+                <xsl:element name="address">
+                    <xsl:value-of select="/ns:student/ns:address" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="address">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="uid">
+        <xsl:element name="uid">
+            <xsl:value-of select="uid:getUID()" />
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl b/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl
new file mode 100644
index 0000000..2768e5e
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl
@@ -0,0 +1,108 @@
+<?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.
+-->
+
+<xsl:stylesheet xmlns="http://university.edu/student"
+                xmlns:ns="http://university.edu/student"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="/">
+        <xsl:element name="student">
+            <xsl:call-template name="name"/>
+            <xsl:call-template name="surname"/>
+            <xsl:call-template name="birthdate"/>
+            <xsl:call-template name="address"/>
+            <xsl:call-template name="uid"/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template name="name">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:name">
+                <xsl:element name="name">
+                    <xsl:value-of select="/ns:student/ns:name" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="name">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="surname">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:surname">
+                <xsl:element name="surname">
+                    <xsl:value-of select="/ns:student/ns:surname" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="surname">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="birthdate">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:birthdate">
+                <xsl:element name="date">
+                    <xsl:element name="day">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:day" />
+                    </xsl:element>
+                    <xsl:element name="month">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:month" />
+                    </xsl:element>
+                    <xsl:element name="year">
+                        <xsl:value-of select="/ns:student/ns:birthdate/ns:year" />
+                    </xsl:element>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="date">
+                    <xsl:element name="day">Unspecified</xsl:element>
+                    <xsl:element name="month">Unspecified</xsl:element>
+                    <xsl:element name="year">Unspecified</xsl:element>
+                </xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="address">
+        <xsl:choose>
+            <xsl:when test="/ns:student/ns:address">
+                <xsl:element name="address">
+                    <xsl:value-of select="/ns:student/ns:address" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="address">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="uid">
+        <xsl:element name="uid">
+            <xsl:value-of select="ns:student/ns:uid" />
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl b/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl
new file mode 100644
index 0000000..25c0aac
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl
@@ -0,0 +1,45 @@
+<?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.
+-->
+
+<xsl:stylesheet xmlns="http://university.edu/teacher"
+                xmlns:ns="http://university.edu/teacher"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:uid="org.apache.cxf.systest.ws.transfer.UIDManager"
+                exclude-result-prefixes="uid"
+                version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="@*|node()">
+        <xsl:copy>
+            <xsl:apply-templates select="@*|node()" />
+        </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template match="/ns:teacher">
+        <xsl:element name="teacher">
+            <xsl:apply-templates select="@*|node()" />
+            <xsl:element name="uid">
+                <xsl:value-of select="uid:getUID()" />
+            </xsl:element>
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl b/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl
new file mode 100644
index 0000000..6ab40d3
--- /dev/null
+++ b/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl
@@ -0,0 +1,108 @@
+<?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.
+-->
+
+<xsl:stylesheet xmlns="http://university.edu/teacher"
+                xmlns:ns="http://university.edu/teacher"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="/">
+        <xsl:element name="teacher">
+            <xsl:call-template name="name"/>
+            <xsl:call-template name="surname"/>
+            <xsl:call-template name="birthdate"/>
+            <xsl:call-template name="address"/>
+            <xsl:call-template name="uid" />
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template name="name">
+        <xsl:choose>
+            <xsl:when test="/ns:teacher/ns:name">
+                <xsl:element name="name">
+                    <xsl:value-of select="/ns:teacher/ns:name" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="name">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="surname">
+        <xsl:choose>
+            <xsl:when test="/ns:teacher/ns:surname">
+                <xsl:element name="surname">
+                    <xsl:value-of select="/ns:teacher/ns:surname" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="surname">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="birthdate">
+        <xsl:choose>
+            <xsl:when test="/ns:teacher/ns:birthdate">
+                <xsl:element name="date">
+                    <xsl:element name="day">
+                        <xsl:value-of select="/ns:teacher/ns:birthdate/ns:day" />
+                    </xsl:element>
+                    <xsl:element name="month">
+                        <xsl:value-of select="/ns:teacher/ns:birthdate/ns:month" />
+                    </xsl:element>
+                    <xsl:element name="year">
+                        <xsl:value-of select="/ns:teacher/ns:birthdate/ns:year" />
+                    </xsl:element>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="date">
+                    <xsl:element name="day">Unspecified</xsl:element>
+                    <xsl:element name="month">Unspecified</xsl:element>
+                    <xsl:element name="year">Unspecified</xsl:element>
+                </xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="address">
+        <xsl:choose>
+            <xsl:when test="/ns:teacher/ns:address">
+                <xsl:element name="address">
+                    <xsl:value-of select="/ns:teacher/ns:address" />
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="address">Unspecified</xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="uid">
+        <xsl:element name="uid">
+            <xsl:value-of select="/ns:teacher/ns:uid" />
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>


[4/5] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

Posted by dk...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceRemote.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceRemote.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceRemote.java
new file mode 100644
index 0000000..52916ea
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceRemote.java
@@ -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.cxf.ws.transfer.resource;
+
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.apache.cxf.ws.transfer.validationtransformation.ValidAndTransformHelper;
+
+/**
+ * Implementation of the Resource interface for resources, which are created remotely.
+ * @see org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceResolver
+ */
+public class ResourceRemote extends ResourceLocal implements ResourceFactory {
+
+    @Override
+    public CreateResponse create(Create body) {
+        Representation representation = body.getRepresentation();
+        ValidAndTransformHelper.validationAndTransformation(
+            getResourceTypeIdentifiers(), representation, null);
+        ReferenceParametersType refParams = getManager().create(representation);
+        CreateResponse response = new CreateResponse();
+        response.setResourceCreated(new EndpointReferenceType());
+        response.getResourceCreated().setReferenceParameters(refParams);
+        response.setRepresentation(body.getRepresentation());
+        return response;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactory.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactory.java
new file mode 100644
index 0000000..da28d43
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactory.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.cxf.ws.transfer.resourcefactory;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.Action;
+import javax.xml.ws.soap.Addressing;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * The interface definition of a Resource Factory web service, according to the specification.
+ */
+
+@WebService(targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+        name = TransferConstants.NAME_RESOURCE_FACTORY)
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+@Addressing(enabled = true, required = true)
+public interface ResourceFactory {
+    @Action(
+            input = TransferConstants.ACTION_CREATE,
+            output = TransferConstants.ACTION_CREATE_RESPONSE
+    )
+    @WebMethod(operationName = TransferConstants.NAME_OPERATION_CREATE)
+    @WebResult(
+            name = TransferConstants.NAME_MESSAGE_CREATE_RESPONSE,
+            targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+            partName = "Body"
+    )
+    CreateResponse create(
+            @WebParam(
+                    name = TransferConstants.NAME_MESSAGE_CREATE,
+                    targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+                    partName = "Body"
+            )
+            Create body
+    );
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactoryImpl.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactoryImpl.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactoryImpl.java
new file mode 100644
index 0000000..32ca4f6
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/ResourceFactoryImpl.java
@@ -0,0 +1,153 @@
+/**
+ * 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.cxf.ws.transfer.resourcefactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.ws.addressing.AttributedURIType;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.Dialect;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceReference;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceResolver;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownDialect;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceTypeIdentifier;
+import org.apache.cxf.ws.transfer.validationtransformation.ValidAndTransformHelper;
+
+/**
+ * ResourceFactory implementation.
+ */
+public class ResourceFactoryImpl implements ResourceFactory {
+
+    protected ResourceResolver resourceResolver;
+    
+    protected List<ResourceTypeIdentifier> resourceTypeIdentifiers;
+    
+    protected Map<String, Dialect> dialects;
+    
+    public ResourceFactoryImpl() {
+        dialects = new HashMap<String, Dialect>();
+    }
+    
+    @Override
+    public CreateResponse create(Create body) {
+        if (body.getDialect() != null && !body.getDialect().isEmpty()) {
+            if (dialects.containsKey(body.getDialect())) {
+                Dialect dialect = dialects.get(body.getDialect());
+                Representation representation = dialect.processCreate(body);
+                body.setRepresentation(representation);
+            } else {
+                throw new UnknownDialect();
+            }
+        }
+        ValidAndTransformHelper.validationAndTransformation(
+                resourceTypeIdentifiers, body.getRepresentation(), null);
+
+        ResourceReference resourceReference = resourceResolver.resolve(body);
+        if (resourceReference.getResourceManager() != null) {
+            return createLocally(body, resourceReference);
+        } else {
+            return createRemotely(body, resourceReference);
+        }
+    }
+
+    public ResourceResolver getResourceResolver() {
+        return resourceResolver;
+    }
+
+    public void setResourceResolver(ResourceResolver resourceResolver) {
+        this.resourceResolver = resourceResolver;
+    }
+
+    public List<ResourceTypeIdentifier> getResourceTypeIdentifiers() {
+        if (resourceTypeIdentifiers == null) {
+            resourceTypeIdentifiers = new ArrayList<>();
+        }
+        return resourceTypeIdentifiers;
+    }
+
+    public void setResourceTypeIdentifiers(List<ResourceTypeIdentifier> resourceTypeIdentifiers) {
+        this.resourceTypeIdentifiers = resourceTypeIdentifiers;
+    }
+    
+    /**
+     * Register Dialect object for URI.
+     * @param uri
+     * @param dialect 
+     */
+    public void registerDialect(String uri, Dialect dialect) {
+        if (dialects.containsKey(uri)) {
+            throw new IllegalArgumentException(String.format("URI \"%s\" is already registered", uri));
+        }
+        dialects.put(uri, dialect);
+    }
+    
+    /**
+     * Unregister dialect URI.
+     * @param uri 
+     */
+    public void unregisterDialect(String uri) {
+        if (!dialects.containsKey(uri)) {
+            throw new IllegalArgumentException(String.format("URI \"%s\" is not registered", uri));
+        }
+        dialects.remove(uri);
+    }
+    
+    private CreateResponse createLocally(Create body, ResourceReference ref) {
+        Representation representation = body.getRepresentation();
+        ReferenceParametersType refParams = ref.getResourceManager().create(representation);
+
+        CreateResponse response = new CreateResponse();
+        response.setResourceCreated(new EndpointReferenceType());
+        response.getResourceCreated().setAddress(new AttributedURIType());
+        response.getResourceCreated()
+                .getAddress()
+                .setValue(ref.getResourceURL());
+        response.getResourceCreated()
+                .setReferenceParameters(refParams);
+        response.setRepresentation(body.getRepresentation());
+
+        return response;
+    }
+    
+    private CreateResponse createRemotely(Create body, ResourceReference ref) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.getInInterceptors().add(new LoggingInInterceptor());
+        factory.getOutInterceptors().add(new LoggingOutInterceptor());
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(ref.getResourceURL() 
+                + TransferConstants.RESOURCE_REMOTE_SUFFIX);
+        ResourceFactory client = (ResourceFactory) factory.create();
+        CreateResponse response = client.create(body);
+        // Adding of endpoint address to the response.
+        response.getResourceCreated().setAddress(new AttributedURIType());
+        response.getResourceCreated().getAddress().setValue(ref.getResourceURL());
+        return response;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceReference.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceReference.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceReference.java
new file mode 100644
index 0000000..1e86030
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceReference.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.transfer.resourcefactory.resolver;
+
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+
+/**
+ * Class intended as return value from the ResourceResolver.
+ * @see ResourceResolver
+ */
+public class ResourceReference {
+    
+    private ResourceManager resourceManager;
+    
+    private String resourceURL;
+    
+    public ResourceReference() {
+        
+    }
+    
+    public ResourceReference(
+            String resourceURL,
+            ResourceManager resourceManager) {
+        this.resourceURL = resourceURL;
+        this.resourceManager = resourceManager;
+    }
+
+    public ResourceManager getResourceManager() {
+        return resourceManager;
+    }
+
+    public void setResourceManager(ResourceManager resourceManager) {
+        this.resourceManager = resourceManager;
+    }
+
+    public String getResourceURL() {
+        return resourceURL;
+    }
+
+    public void setResourceURL(String resourceURL) {
+        this.resourceURL = resourceURL;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceResolver.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceResolver.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceResolver.java
new file mode 100644
index 0000000..6e4339c
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/ResourceResolver.java
@@ -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.cxf.ws.transfer.resourcefactory.resolver;
+
+import org.apache.cxf.ws.transfer.Create;
+
+/**
+ * The interface for resolving, where the Resource will be created.
+ */
+public interface ResourceResolver {
+    
+    /**
+     * Method for resolving, where the Resource will be created.
+     * @param body SOAP body
+     * @return ResourceReference object. If the Resource should be created locally,
+     * so the ResourceReference object must contain address and reference to the 
+     * ResourceManager object. Otherwise the ResourceReference must contain only
+     * the address to the ResourceRemote endpoint.
+     */
+    ResourceReference resolve(Create body);
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/SimpleResourceResolver.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/SimpleResourceResolver.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/SimpleResourceResolver.java
new file mode 100644
index 0000000..c988319
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resourcefactory/resolver/SimpleResourceResolver.java
@@ -0,0 +1,69 @@
+/**
+ * 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.cxf.ws.transfer.resourcefactory.resolver;
+
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+
+/**
+ * The simple ResourceResolver, which always returns a predefined resource
+ * location.
+ */
+public class SimpleResourceResolver implements ResourceResolver {
+
+    protected ResourceManager resourceManager;
+    
+    protected String resourceURL;
+    
+    public SimpleResourceResolver() {
+        
+    }
+    
+    public SimpleResourceResolver(String resourceURL) {
+        this.resourceURL = resourceURL;
+    }
+    
+    public SimpleResourceResolver(String resourceURL, ResourceManager resourceManager) {
+        this.resourceURL = resourceURL;
+        this.resourceManager = resourceManager;
+    }
+    
+    @Override
+    public ResourceReference resolve(Create body) {
+        return new ResourceReference(resourceURL, resourceManager);
+    }
+    
+    public String getResourceURL() {
+        return resourceURL;
+    }
+
+    public void setResourceURL(String resourceURL) {
+        this.resourceURL = resourceURL;
+    }
+
+    public ResourceManager getResourceManager() {
+        return resourceManager;
+    }
+
+    public void setResourceManager(ResourceManager resourceManager) {
+        this.resourceManager = resourceManager;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/TransferConstants.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/TransferConstants.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/TransferConstants.java
new file mode 100644
index 0000000..3da2107
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/TransferConstants.java
@@ -0,0 +1,60 @@
+/**
+ * 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.cxf.ws.transfer.shared;
+
+/**
+ * Helper class for holding of constants.
+ */
+public final class TransferConstants {
+    
+    public static final String TRANSFER_2011_03_NAMESPACE = "http://www.w3.org/2011/03/ws-tra";
+    
+    public static final String NAME_RESOURCE = "Resource";
+    public static final String NAME_RESOURCE_FACTORY = "ResourceFactory";
+    
+    public static final String NAME_OPERATION_GET = "Get";
+    public static final String NAME_OPERATION_DELETE = "Delete";
+    public static final String NAME_OPERATION_PUT = "Put";
+    public static final String NAME_OPERATION_CREATE = "Create";
+    
+    public static final String NAME_MESSAGE_GET = "Get";
+    public static final String NAME_MESSAGE_GET_RESPONSE = "GetResponse";
+    public static final String NAME_MESSAGE_DELETE = "Delete";
+    public static final String NAME_MESSAGE_DELETE_RESPONSE = "DeleteResponse";
+    public static final String NAME_MESSAGE_PUT = "Put";
+    public static final String NAME_MESSAGE_PUT_RESPONSE = "PutResponse";
+    public static final String NAME_MESSAGE_CREATE = "Create";
+    public static final String NAME_MESSAGE_CREATE_RESPONSE = "CreateResponse";
+    
+    public static final String ACTION_GET = "http://www.w3.org/2011/03/ws-tra/Get";
+    public static final String ACTION_GET_RESPONSE = "http://www.w3.org/2011/03/ws-tra/GetResponse";
+    public static final String ACTION_DELETE = "http://www.w3.org/2011/03/ws-tra/Delete";
+    public static final String ACTION_DELETE_RESPONSE = "http://www.w3.org/2011/03/ws-tra/DeleteResponse";
+    public static final String ACTION_PUT = "http://www.w3.org/2011/03/ws-tra/Put";
+    public static final String ACTION_PUT_RESPONSE = "http://www.w3.org/2011/03/ws-tra/PutResponse";
+    public static final String ACTION_CREATE = "http://www.w3.org/2011/03/ws-tra/Create";
+    public static final String ACTION_CREATE_RESPONSE = "http://www.w3.org/2011/03/ws-tra/CreateResponse";
+    
+    public static final String RESOURCE_REMOTE_SUFFIX = "_factory";
+    
+    private TransferConstants() {
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/InvalidRepresentation.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/InvalidRepresentation.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/InvalidRepresentation.java
new file mode 100644
index 0000000..21ea6c3
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/InvalidRepresentation.java
@@ -0,0 +1,41 @@
+/**
+ * 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.cxf.ws.transfer.shared.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * Definition of the InvalidRepresentation SOAPFault.
+ */
+public class InvalidRepresentation extends WSTransferFault {
+
+    private static final long serialVersionUID = 330259919571428100L;
+
+    private static final String SUBCODE = "InvalidRepresentation";
+
+    private static final String REASON = "The supplied representation is invalid";
+
+    public InvalidRepresentation() {
+        super(REASON, null,
+                new QName(TransferConstants.TRANSFER_2011_03_NAMESPACE, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/PutDenied.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/PutDenied.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/PutDenied.java
new file mode 100644
index 0000000..b0c6ad6
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/PutDenied.java
@@ -0,0 +1,44 @@
+/**
+ * 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.cxf.ws.transfer.shared.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * Definition of the PutDenied SOAPFault.
+ */
+public class PutDenied extends WSTransferFault {
+
+    private static final long serialVersionUID = -6644888926499946963L;
+
+    private static final String SUBCODE = "UpdateDenied";
+
+    private static final String REASON = "One or more elements or attributes cannot be updated.";
+
+    private static final String DETAIL =
+            "An OPTIONAL list of the QNames of the elements or attributes that are not allowed to be updated.";
+
+    public PutDenied() {
+        super(REASON, DETAIL,
+                new QName(TransferConstants.TRANSFER_2011_03_NAMESPACE, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownDialect.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownDialect.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownDialect.java
new file mode 100644
index 0000000..5c9f9ea
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownDialect.java
@@ -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.cxf.ws.transfer.shared.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * Definition of the UnknownDialect SOAPFault.
+ */
+public class UnknownDialect extends WSTransferFault {
+
+    private static final long serialVersionUID = 7139243705016686015L;
+
+    private static final String SUBCODE = "UnknownDialect";
+
+    private static final String REASON = "The specified Dialect IRI is not known.";
+
+    private static final String DETAIL = "The unknown IRI if specified";
+
+    public UnknownDialect() {
+        super(REASON, DETAIL,
+                new QName(TransferConstants.TRANSFER_2011_03_NAMESPACE, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownResource.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownResource.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownResource.java
new file mode 100644
index 0000000..1b3c61d
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/UnknownResource.java
@@ -0,0 +1,42 @@
+/**
+ * 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.cxf.ws.transfer.shared.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * This fault MUST be generated when a request specifies a resource
+ * that is not known.
+ */
+public class UnknownResource extends WSTransferFault {
+
+    private static final long serialVersionUID = 2925090710469446447L;
+
+    private static final String SUBCODE = "UnknownResource";
+
+    private static final String REASON = "The resource is not known.";
+
+    public UnknownResource() {
+        super(REASON, null,
+                new QName(TransferConstants.TRANSFER_2011_03_NAMESPACE, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/WSTransferFault.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/WSTransferFault.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/WSTransferFault.java
new file mode 100644
index 0000000..673da39
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/shared/faults/WSTransferFault.java
@@ -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.cxf.ws.transfer.shared.faults;
+
+import javax.xml.namespace.QName;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.helpers.DOMUtils;
+
+/**
+ * The parent for all WS-Transfer-specific faults.
+ */
+public abstract class WSTransferFault extends SoapFault {
+
+    private static final long serialVersionUID = -7603229392321418734L;
+
+    public WSTransferFault(String reason, String detail, QName faultCode) {
+        super(reason, faultCode);
+        if (detail != null) {
+            Document doc = DOMUtils.createDocument();
+            Element detailEl = doc.createElement("detail");
+            detailEl.setTextContent(detail);
+            setDetail(detailEl);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTransformer.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTransformer.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTransformer.java
new file mode 100644
index 0000000..69cdb20
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTransformer.java
@@ -0,0 +1,30 @@
+/**
+ * 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.cxf.ws.transfer.validationtransformation;
+
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * The interface for a Transformer objects.
+ */
+public interface ResourceTransformer {
+    
+    ResourceValidator transform(Representation newRepresentation, Representation oldRepresentation);
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifier.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifier.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifier.java
new file mode 100644
index 0000000..f04e774
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifier.java
@@ -0,0 +1,36 @@
+/**
+ * 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.cxf.ws.transfer.validationtransformation;
+
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * The interface for TypeIdentifier objects.
+ */
+public interface ResourceTypeIdentifier {
+
+    /**
+     * Returns true if the representation corresponds to type, which object represents.
+     * @param representation
+     * @return
+     */
+    ResourceTypeIdentifierResult identify(Representation representation);
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifierResult.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifierResult.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifierResult.java
new file mode 100644
index 0000000..c8999c0
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceTypeIdentifierResult.java
@@ -0,0 +1,56 @@
+/**
+ * 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.cxf.ws.transfer.validationtransformation;
+
+/**
+ * This class represents the result from the ResourceTypeIdentifier.
+ */
+public class ResourceTypeIdentifierResult {
+    
+    private boolean correct;
+    
+    private ResourceTransformer transformer;
+    
+    public ResourceTypeIdentifierResult() {
+        
+    }
+    
+    public ResourceTypeIdentifierResult(boolean result, ResourceTransformer transformer) {
+        this.correct = result;
+        this.transformer = transformer;
+    }
+
+    public boolean isCorrect() {
+        return correct;
+    }
+
+    public void setCorrect(boolean correct) {
+        this.correct = correct;
+    }
+
+    public ResourceTransformer getTransformer() {
+        return transformer;
+    }
+
+    public void setTransformer(ResourceTransformer transformer) {
+        this.transformer = transformer;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceValidator.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceValidator.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceValidator.java
new file mode 100644
index 0000000..b31ec29
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ResourceValidator.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cxf.ws.transfer.validationtransformation;
+
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * The interface for Validator objects.
+ */
+public interface ResourceValidator {
+    
+    boolean validate(Representation newRepresentation, Representation oldRepresentation);
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ValidAndTransformHelper.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ValidAndTransformHelper.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ValidAndTransformHelper.java
new file mode 100644
index 0000000..4c806ef
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/ValidAndTransformHelper.java
@@ -0,0 +1,63 @@
+/**
+ * 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.cxf.ws.transfer.validationtransformation;
+
+import java.util.List;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.shared.faults.InvalidRepresentation;
+
+/**
+ * Helper class for validation and transformation.
+ */
+public final class ValidAndTransformHelper {
+    
+    private ValidAndTransformHelper() {
+        
+    }
+    
+    /**
+     * Validation and transformation process.
+     * @param resourceTypeIdentifiers List of resourceTypeIdentifiers.
+     * @param newRepresentation Incoming representation.
+     * @param oldRepresentation Representation stored in the ResourceManager.
+     */
+    public static void validationAndTransformation(
+            List<ResourceTypeIdentifier> resourceTypeIdentifiers,
+            Representation newRepresentation,
+            Representation oldRepresentation) {
+        if (resourceTypeIdentifiers != null && !resourceTypeIdentifiers.isEmpty()) {
+            for (ResourceTypeIdentifier resourceIdentifier : resourceTypeIdentifiers) {
+                ResourceTypeIdentifierResult valResult = resourceIdentifier.identify(newRepresentation);
+                if (valResult.isCorrect()) {
+                    if (valResult.getTransformer() != null) {
+                        ResourceTransformer transformer = valResult.getTransformer();
+                        ResourceValidator validator = transformer.transform(newRepresentation, oldRepresentation);
+                        if (validator != null && !validator.validate(newRepresentation, oldRepresentation)) {
+                            throw new InvalidRepresentation();
+                        }
+                    }
+                    return;
+                }
+            }
+            throw new InvalidRepresentation();
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceTypeIdentifier.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceTypeIdentifier.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceTypeIdentifier.java
new file mode 100644
index 0000000..a6b5505
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceTypeIdentifier.java
@@ -0,0 +1,87 @@
+/**
+ * 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.cxf.ws.transfer.validationtransformation;
+
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import javax.xml.ws.WebServiceContext;
+
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * Implementation of the ResourceTypeIdentifier interface using by XSDSchema validation.
+ */
+public class XSDResourceTypeIdentifier implements ResourceTypeIdentifier {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(XSDResourceTypeIdentifier.class);
+
+    protected ResourceTransformer resourceTransformer;
+
+    protected Validator validator;
+
+    @Resource
+    private WebServiceContext context;
+
+    public XSDResourceTypeIdentifier(Source xsd, ResourceTransformer resourceTransformer) {
+        try {
+            this.resourceTransformer = resourceTransformer;
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(xsd);
+            this.validator = schema.newValidator();
+        } catch (SAXException ex) {
+            LOG.severe(ex.getLocalizedMessage());
+            throw new SoapFault("Internal error", getSoapVersion().getReceiver());
+        }
+    }
+
+    @Override
+    public ResourceTypeIdentifierResult identify(Representation representation) {
+        try {
+            validator.validate(new DOMSource((Node) representation.getAny()));
+        } catch (SAXException ex) {
+            return new ResourceTypeIdentifierResult(false, resourceTransformer);
+        } catch (IOException ex) {
+            LOG.severe(ex.getLocalizedMessage());
+            throw new SoapFault("Internal error", getSoapVersion().getReceiver());
+        }
+        return new ResourceTypeIdentifierResult(true, resourceTransformer);
+    }
+
+    private SoapVersion getSoapVersion() {
+        WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
+        SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
+        return message.getVersion();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceValidator.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceValidator.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceValidator.java
new file mode 100644
index 0000000..f5da781
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSDResourceValidator.java
@@ -0,0 +1,88 @@
+/**
+ * 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.cxf.ws.transfer.validationtransformation;
+
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import javax.xml.ws.WebServiceContext;
+
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * Implementation of the ResourceValidator interface for Schema validation.
+ */
+public class XSDResourceValidator implements ResourceValidator {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(XSDResourceValidator.class);
+
+    protected Validator validator;
+
+    @Resource
+    private WebServiceContext context;
+
+    public XSDResourceValidator(Source xsd, ResourceTransformer resourceTransformer) {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(xsd);
+            this.validator = schema.newValidator();
+        } catch (SAXException ex) {
+            LOG.severe(ex.getLocalizedMessage());
+            throw new SoapFault("Internal error", getSoapVersion().getReceiver());
+        }
+    }
+
+    public XSDResourceValidator(Source xsd) {
+        this(xsd, null);
+    }
+
+    @Override
+    public boolean validate(Representation representation, Representation oldRepresentation) {
+        try {
+            validator.validate(new DOMSource((Node) representation.getAny()));
+        } catch (SAXException ex) {
+            return false;
+        } catch (IOException ex) {
+            LOG.severe(ex.getLocalizedMessage());
+            throw new SoapFault("Internal error", getSoapVersion().getReceiver());
+        }
+        return true;
+    }
+
+    private SoapVersion getSoapVersion() {
+        WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
+        SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
+        return message.getVersion();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSLTResourceTransformer.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSLTResourceTransformer.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSLTResourceTransformer.java
new file mode 100644
index 0000000..0538dd3
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/validationtransformation/XSLTResourceTransformer.java
@@ -0,0 +1,87 @@
+/**
+ * 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.cxf.ws.transfer.validationtransformation;
+
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.ws.WebServiceContext;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.feature.transform.XSLTUtils;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * Implementation of the ResourceTransformer for the XSL transformation.
+ */
+public class XSLTResourceTransformer implements ResourceTransformer {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(XSLTResourceTransformer.class);
+
+    protected Templates templates;
+
+    protected ResourceValidator validator;
+
+    @Resource
+    private WebServiceContext context;
+
+    public XSLTResourceTransformer(Source xsl) {
+        this(xsl, null);
+    }
+
+    public XSLTResourceTransformer(Source xsl, ResourceValidator validator) {
+        this.validator = validator;
+        try {
+            templates = TransformerFactory.newInstance().newTemplates(xsl);
+        } catch (TransformerConfigurationException e) {
+            LOG.severe(e.getLocalizedMessage());
+            throw new SoapFault("Internal error", getSoapVersion().getReceiver());
+        }
+    }
+
+    @Override
+    public ResourceValidator transform(Representation newRepresentation, Representation oldRepresentation) {
+        Document doc = DOMUtils.createDocument();
+        Node representation = (Node) newRepresentation.getAny();
+        Node importedNode = doc.importNode(representation, true);
+        doc.appendChild(importedNode);
+        Document result = XSLTUtils.transform(templates, doc);
+        newRepresentation.setAny(result.getDocumentElement());
+        return validator;
+    }
+
+    private SoapVersion getSoapVersion() {
+        WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
+        SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
+        return message.getVersion();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/handler-chains/reference-parameter-parsing.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/handler-chains/reference-parameter-parsing.xml b/rt/ws/transfer/src/main/resources/handler-chains/reference-parameter-parsing.xml
new file mode 100644
index 0000000..e1018f8
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/handler-chains/reference-parameter-parsing.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+  <handler-chain>
+    <handler>
+      <handler-name>ReferenceParameterParsingHandler</handler-name>
+      <handler-class>org.apache.cxf.ws.transfer.shared.handlers.ReferenceParameterParsingHandler</handler-class>
+    </handler>
+  </handler-chain>
+</handler-chains>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/catalog-fragment.cat
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/catalog-fragment.cat b/rt/ws/transfer/src/main/resources/schemas/catalog-fragment.cat
new file mode 100644
index 0000000..6eb029c
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/catalog-fragment.cat
@@ -0,0 +1,21 @@
+--
+  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.
+--
+
+SYSTEM "http://www.w3.org/2011/03/ws-fra" "fragment.xsd"
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/catalog.cat
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/catalog.cat b/rt/ws/transfer/src/main/resources/schemas/catalog.cat
new file mode 100644
index 0000000..22bc651
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/catalog.cat
@@ -0,0 +1,23 @@
+--
+  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.
+--
+
+SYSTEM "http://www.w3.org/2011/03/ws-tra" "transfer.xsd"
+SYSTEM "http://www.w3.org/2005/08/addressing" "ws-addr.xsd"
+SYSTEM "http://www.w3.org/2006/03/addressing/ws-addr.xsd" "ws-addr.xsd"
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/fragment.xsd
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/fragment.xsd b/rt/ws/transfer/src/main/resources/schemas/fragment.xsd
new file mode 100644
index 0000000..519cb3a
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/fragment.xsd
@@ -0,0 +1,87 @@
+<?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
+  targetNamespace='http://www.w3.org/2011/03/ws-fra'
+  xmlns:tns='http://www.w3.org/2011/03/ws-fra'
+  xmlns:xs='http://www.w3.org/2001/XMLSchema'
+  elementFormDefault='qualified'
+  blockDefault='#all' >
+ 
+  <xs:complexType name='ExpressionType' mixed="true">
+    <xs:sequence>
+      <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+    </xs:sequence>
+    <xs:attribute name='Language' type='xs:anyURI' use='optional'/>
+    <xs:attribute name='Mode' type='xs:anyURI' use='optional'/>
+    <xs:anyAttribute namespace='##other' processContents='lax'/>
+  </xs:complexType>
+  <xs:element name='Expression' type='tns:ExpressionType'/>
+
+  <xs:complexType name='ValueType' mixed="true">
+    <xs:sequence>
+      <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+    </xs:sequence>
+    <xs:anyAttribute namespace='##other' processContents='lax'/>
+  </xs:complexType>
+  <xs:element name='Value' type='tns:ValueType'/>
+  
+  <xs:element name='Fragment'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Expression' type='tns:ExpressionType'/>
+        <xs:element name='Value' type='tns:ValueType' minOccurs='0'/>
+        <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax'/>
+    </xs:complexType>
+  </xs:element>
+
+  <!-- Policy -->
+  <xs:complexType name='URI'>
+    <xs:simpleContent>
+      <xs:extension base='xs:anyURI'>
+        <xs:anyAttribute namespace='##other' processContents='lax'/>
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+
+  <xs:element name='FragmentAssertion'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Language' minOccurs='0' maxOccurs='unbounded'>
+          <xs:complexType>
+            <xs:sequence>
+              <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                          maxOccurs='0'/>
+            </xs:sequence>
+            <xs:attribute name='URI' type='xs:anyURI' use='required' />
+            <xs:anyAttribute namespace="##other" processContents='lax'/>
+          </xs:complexType>
+        </xs:element>
+        <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                    maxOccurs='unbounded'/>
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+</xs:schema>  

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/transfer.xjb
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/transfer.xjb b/rt/ws/transfer/src/main/resources/schemas/transfer.xjb
new file mode 100644
index 0000000..ea8d17e
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/transfer.xjb
@@ -0,0 +1,37 @@
+<?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.
+-->
+
+<bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb"
+          xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+    <bindings schemaLocation="http://www.w3.org/2006/03/addressing/ws-addr.xsd">
+        <schemaBindings map="false"/>
+        <bindings node="//xs:complexType[@name='ReferenceParametersType']">
+            <class ref="org.apache.cxf.ws.addressing.ReferenceParametersType"/>
+        </bindings>
+        <bindings node="//xs:complexType[@name='EndpointReferenceType']">
+            <class ref="org.apache.cxf.ws.addressing.EndpointReferenceType"/>
+        </bindings>
+        <bindings node="//xs:complexType[@name='AttributedURIType']">
+            <class ref="org.apache.cxf.ws.addressing.AttributedURIType"/>
+        </bindings>
+    </bindings>
+</bindings>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/transfer.xsd
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/transfer.xsd b/rt/ws/transfer/src/main/resources/schemas/transfer.xsd
new file mode 100644
index 0000000..de5c48a
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/transfer.xsd
@@ -0,0 +1,192 @@
+<?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
+  targetNamespace='http://www.w3.org/2011/03/ws-tra'
+  xmlns:tns='http://www.w3.org/2011/03/ws-tra'
+  xmlns:xs='http://www.w3.org/2001/XMLSchema'
+  xmlns:wsa='http://www.w3.org/2005/08/addressing'
+  elementFormDefault='qualified'
+  blockDefault='#all' >
+ 
+  <xs:import
+    namespace='http://www.w3.org/2005/08/addressing'
+    schemaLocation='http://www.w3.org/2006/03/addressing/ws-addr.xsd' />
+
+  <xs:complexType name='Representation'>
+    <xs:sequence>
+      <xs:any minOccurs='0' processContents='lax'/>
+    </xs:sequence>
+    <xs:anyAttribute namespace='##other' processContents='lax'/>
+  </xs:complexType>
+ 
+  <xs:element name='Get'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:any minOccurs='0' maxOccurs='unbounded' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:attribute name='Dialect' type='xs:anyURI' use='optional' />
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name='GetResponse'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Representation' type='tns:Representation' minOccurs='0'/>
+        <xs:any minOccurs='1' maxOccurs='unbounded' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+ 
+  <xs:element name='Put'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Representation' type='tns:Representation' minOccurs='0'/>
+        <xs:any minOccurs='1' maxOccurs='unbounded' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:attribute name='Dialect' type='xs:anyURI' use='optional' />
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name='PutResponse'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Representation' type='tns:Representation' minOccurs='0'/>
+        <xs:any minOccurs='1' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+ 
+  <xs:element name='Delete'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:any minOccurs='0' maxOccurs='unbounded' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:attribute name='Dialect' type='xs:anyURI' use='optional' />
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name='DeleteResponse'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:any minOccurs='0' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+ 
+  <xs:element name='Create'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Representation' type='tns:Representation' minOccurs='0'/>
+        <xs:any minOccurs='0' maxOccurs='unbounded' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:attribute name='Dialect' type='xs:anyURI' use='optional' />
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+ 
+  <xs:element name='CreateResponse'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='ResourceCreated' type='wsa:EndpointReferenceType' />
+        <xs:element name='Representation' type='tns:Representation' minOccurs='0'/>
+        <xs:any minOccurs='0' namespace='##other' processContents='lax' />
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <!-- Policy -->
+  <xs:complexType name='URI'>
+    <xs:simpleContent>
+      <xs:extension base='xs:anyURI'>
+        <xs:anyAttribute namespace='##other' processContents='lax'/>
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+
+  <xs:complexType name='QName'>
+    <xs:simpleContent>
+      <xs:extension base='xs:QName'>
+        <xs:anyAttribute namespace='##other' processContents='lax'/>
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+
+  <xs:complexType name='Empty'>
+    <xs:sequence/>
+    <xs:anyAttribute namespace='##other' processContents='lax'/>
+  </xs:complexType>
+
+  <xs:element name='TransferResource'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='PutOperationSupported' type='tns:Empty'
+                                                 minOccurs='0'/>
+        <xs:element name='DeleteOperationSupported' type='tns:Empty'
+                                                    minOccurs='0'/>
+        <xs:element name='FaultOnPutDenied' type='tns:Empty' minOccurs='0'/>
+        <xs:element name='Dialect' minOccurs='0' maxOccurs='unbounded'>
+          <xs:complexType>
+            <xs:sequence>
+              <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                          maxOccurs='0'/>
+            </xs:sequence>
+            <xs:attribute name='URI' type='xs:anyURI' use='required' />
+            <xs:anyAttribute namespace="##other" processContents='lax'/>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name='Resource' type='tns:QName' minOccurs='0'/>
+        <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                    maxOccurs='unbounded'/>
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name='TransferResourceFactory'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name='Resource' type='tns:QName' minOccurs='0'/>
+        <xs:element name='Dialect' minOccurs='0' maxOccurs='unbounded'>
+          <xs:complexType>
+            <xs:sequence>
+              <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                          maxOccurs='0'/>
+            </xs:sequence>
+            <xs:attribute name='URI' type='xs:anyURI' use='required' />
+            <xs:anyAttribute namespace="##other" processContents='lax'/>
+          </xs:complexType>
+        </xs:element>
+        <xs:any namespace='##other' processContents='lax' minOccurs='0'
+                                    maxOccurs='unbounded'/>
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+ 
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/resources/schemas/ws-addr.xsd
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/resources/schemas/ws-addr.xsd b/rt/ws/transfer/src/main/resources/schemas/ws-addr.xsd
new file mode 100644
index 0000000..05ca1bc
--- /dev/null
+++ b/rt/ws/transfer/src/main/resources/schemas/ws-addr.xsd
@@ -0,0 +1,141 @@
+<?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://www.w3.org/2005/08/addressing" targetNamespace="http://www.w3.org/2005/08/addressing" blockDefault="#all" elementFormDefault="qualified" finalDefault="" attributeFormDefault="unqualified">
+	
+	<!-- Constructs from the WS-Addressing Core -->
+
+	<xs:element name="EndpointReference" type="tns:EndpointReferenceType"/>
+	<xs:complexType name="EndpointReferenceType" mixed="false">
+		<xs:sequence>
+			<xs:element name="Address" type="tns:AttributedURIType"/>
+			<xs:element ref="tns:ReferenceParameters" minOccurs="0"/>
+			<xs:element ref="tns:Metadata" minOccurs="0"/>
+			<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+		</xs:sequence>
+		<xs:anyAttribute namespace="##other" processContents="lax"/>
+	</xs:complexType>
+	
+	<xs:element name="ReferenceParameters" type="tns:ReferenceParametersType"/>
+	<xs:complexType name="ReferenceParametersType" mixed="false">
+		<xs:sequence>
+			<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+		</xs:sequence>
+		<xs:anyAttribute namespace="##other" processContents="lax"/>
+	</xs:complexType>
+	
+	<xs:element name="Metadata" type="tns:MetadataType"/>
+	<xs:complexType name="MetadataType" mixed="false">
+		<xs:sequence>
+			<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+		</xs:sequence>
+		<xs:anyAttribute namespace="##other" processContents="lax"/>
+	</xs:complexType>
+	
+	<xs:element name="MessageID" type="tns:AttributedURIType"/>
+	<xs:element name="RelatesTo" type="tns:RelatesToType"/>
+	<xs:complexType name="RelatesToType" mixed="false">
+		<xs:simpleContent>
+			<xs:extension base="xs:anyURI">
+				<xs:attribute name="RelationshipType" type="tns:RelationshipTypeOpenEnum" use="optional" default="http://www.w3.org/2005/08/addressing/reply"/>
+				<xs:anyAttribute namespace="##other" processContents="lax"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	
+	<xs:simpleType name="RelationshipTypeOpenEnum">
+		<xs:union memberTypes="tns:RelationshipType xs:anyURI"/>
+	</xs:simpleType>
+	
+	<xs:simpleType name="RelationshipType">
+		<xs:restriction base="xs:anyURI">
+			<xs:enumeration value="http://www.w3.org/2005/08/addressing/reply"/>
+		</xs:restriction>
+	</xs:simpleType>
+	
+	<xs:element name="ReplyTo" type="tns:EndpointReferenceType"/>
+	<xs:element name="From" type="tns:EndpointReferenceType"/>
+	<xs:element name="FaultTo" type="tns:EndpointReferenceType"/>
+	<xs:element name="To" type="tns:AttributedURIType"/>
+	<xs:element name="Action" type="tns:AttributedURIType"/>
+
+	<xs:complexType name="AttributedURIType" mixed="false">
+		<xs:simpleContent>
+			<xs:extension base="xs:anyURI">
+				<xs:anyAttribute namespace="##other" processContents="lax"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	
+	<!-- Constructs from the WS-Addressing SOAP binding -->
+
+	<xs:attribute name="IsReferenceParameter" type="xs:boolean"/>
+	
+	<xs:simpleType name="FaultCodesOpenEnumType">
+		<xs:union memberTypes="tns:FaultCodesType xs:QName"/>
+	</xs:simpleType>
+	
+	<xs:simpleType name="FaultCodesType">
+		<xs:restriction base="xs:QName">
+			<xs:enumeration value="tns:InvalidAddressingHeader"/>
+			<xs:enumeration value="tns:InvalidAddress"/>
+			<xs:enumeration value="tns:InvalidEPR"/>
+			<xs:enumeration value="tns:InvalidCardinality"/>
+			<xs:enumeration value="tns:MissingAddressInEPR"/>
+			<xs:enumeration value="tns:DuplicateMessageID"/>
+			<xs:enumeration value="tns:ActionMismatch"/>
+			<xs:enumeration value="tns:MessageAddressingHeaderRequired"/>
+			<xs:enumeration value="tns:DestinationUnreachable"/>
+			<xs:enumeration value="tns:ActionNotSupported"/>
+			<xs:enumeration value="tns:EndpointUnavailable"/>
+		</xs:restriction>
+	</xs:simpleType>
+	
+	<xs:element name="RetryAfter" type="tns:AttributedUnsignedLongType"/>
+	<xs:complexType name="AttributedUnsignedLongType" mixed="false">
+		<xs:simpleContent>
+			<xs:extension base="xs:unsignedLong">
+				<xs:anyAttribute namespace="##other" processContents="lax"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	
+	<xs:element name="ProblemHeaderQName" type="tns:AttributedQNameType"/>
+	<xs:complexType name="AttributedQNameType" mixed="false">
+		<xs:simpleContent>
+			<xs:extension base="xs:QName">
+				<xs:anyAttribute namespace="##other" processContents="lax"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	
+	<xs:element name="ProblemIRI" type="tns:AttributedURIType"/>
+	
+	<xs:element name="ProblemAction" type="tns:ProblemActionType"/>
+	<xs:complexType name="ProblemActionType" mixed="false">
+		<xs:sequence>
+			<xs:element ref="tns:Action" minOccurs="0"/>
+			<xs:element name="SoapAction" minOccurs="0" type="xs:anyURI"/>
+		</xs:sequence>
+		<xs:anyAttribute namespace="##other" processContents="lax"/>
+	</xs:complexType>
+	
+</xs:schema>


[5/5] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

Posted by dk...@apache.org.
Squash commit of ws-transfer implementation from Erich Duda (dudaerich)
This closes #33


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/517ef67f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/517ef67f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/517ef67f

Branch: refs/heads/master
Commit: 517ef67f1a69d386de44153e5e09d51cb47bf4d7
Parents: e158c96
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue May 24 09:26:41 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue May 24 09:26:41 2016 -0400

----------------------------------------------------------------------
 rt/ws/pom.xml                                   |   1 +
 rt/ws/transfer/pom.xml                          |  91 +++
 .../apache/cxf/ws/transfer/dialect/Dialect.java |  64 ++
 .../dialect/fragment/FragmentDialect.java       | 622 +++++++++++++++++++
 .../fragment/FragmentDialectConstants.java      |  51 ++
 .../dialect/fragment/faults/FragmentFault.java  |  44 ++
 .../fragment/faults/InvalidExpression.java      |  42 ++
 .../fragment/faults/UnsupportedLanguage.java    |  41 ++
 .../fragment/faults/UnsupportedMode.java        |  42 ++
 .../language/FragmentDialectLanguage.java       |  37 ++
 .../language/FragmentDialectLanguageQName.java  | 134 ++++
 .../FragmentDialectLanguageXPath10.java         | 160 +++++
 .../transfer/manager/MemoryResourceManager.java | 160 +++++
 .../ws/transfer/manager/ResourceManager.java    |  59 ++
 .../cxf/ws/transfer/resource/Resource.java      | 101 +++
 .../cxf/ws/transfer/resource/ResourceLocal.java | 191 ++++++
 .../ws/transfer/resource/ResourceRemote.java    |  49 ++
 .../resourcefactory/ResourceFactory.java        |  61 ++
 .../resourcefactory/ResourceFactoryImpl.java    | 153 +++++
 .../resolver/ResourceReference.java             |  61 ++
 .../resolver/ResourceResolver.java              |  39 ++
 .../resolver/SimpleResourceResolver.java        |  69 ++
 .../ws/transfer/shared/TransferConstants.java   |  60 ++
 .../shared/faults/InvalidRepresentation.java    |  41 ++
 .../ws/transfer/shared/faults/PutDenied.java    |  44 ++
 .../transfer/shared/faults/UnknownDialect.java  |  43 ++
 .../transfer/shared/faults/UnknownResource.java |  42 ++
 .../transfer/shared/faults/WSTransferFault.java |  45 ++
 .../ResourceTransformer.java                    |  30 +
 .../ResourceTypeIdentifier.java                 |  36 ++
 .../ResourceTypeIdentifierResult.java           |  56 ++
 .../ResourceValidator.java                      |  31 +
 .../ValidAndTransformHelper.java                |  63 ++
 .../XSDResourceTypeIdentifier.java              |  87 +++
 .../XSDResourceValidator.java                   |  88 +++
 .../XSLTResourceTransformer.java                |  87 +++
 .../reference-parameter-parsing.xml             |  27 +
 .../main/resources/schemas/catalog-fragment.cat |  21 +
 .../src/main/resources/schemas/catalog.cat      |  23 +
 .../src/main/resources/schemas/fragment.xsd     |  87 +++
 .../src/main/resources/schemas/transfer.xjb     |  37 ++
 .../src/main/resources/schemas/transfer.xsd     | 192 ++++++
 .../src/main/resources/schemas/ws-addr.xsd      | 141 +++++
 .../integration/FragmentGetQNameTest.java       | 171 +++++
 .../integration/FragmentGetXPath10Test.java     | 333 ++++++++++
 .../integration/FragmentPutAddTest.java         | 238 +++++++
 .../integration/FragmentPutInsertAfterTest.java | 194 ++++++
 .../FragmentPutInsertBeforeTest.java            | 194 ++++++
 .../integration/FragmentPutRemoveTest.java      | 113 ++++
 .../integration/FragmentPutReplaceTest.java     | 419 +++++++++++++
 .../integration/IntegrationBaseTest.java        | 196 ++++++
 .../integration/ResourceFactoryTest.java        | 135 ++++
 .../ws/transfer/integration/ResourceTest.java   | 168 +++++
 .../unit/MemoryResourceManagerTest.java         | 204 ++++++
 .../transfer/unit/XSDResourceValidatorTest.java |  60 ++
 .../unit/XSLTResourceTransformerTest.java       |  60 ++
 .../invalidRepresentation.xml                   |  26 +
 .../xml/xsdresourcevalidator/schema.xsd         |  35 ++
 .../validRepresentation.xml                     |  27 +
 .../xsltresourcetransformer/representation.xml  |  26 +
 .../xml/xsltresourcetransformer/stylesheet.xsl  |  43 ++
 systests/pom.xml                                |   3 +-
 systests/ws-transfer/pom.xml                    |  61 ++
 .../systest/ws/transfer/CreateStudentTest.java  | 103 +++
 .../systest/ws/transfer/CreateTeacherTest.java  |  91 +++
 .../cxf/systest/ws/transfer/DeleteTest.java     | 118 ++++
 .../apache/cxf/systest/ws/transfer/GetTest.java | 111 ++++
 .../apache/cxf/systest/ws/transfer/PutTest.java | 129 ++++
 .../cxf/systest/ws/transfer/TestUtils.java      | 174 ++++++
 .../cxf/systest/ws/transfer/UIDManager.java     |  40 ++
 .../transfer/resolver/MyResourceResolver.java   |  55 ++
 .../validator/StudentPutResourceValidator.java  |  47 ++
 .../validator/TeacherResourceValidator.java     |  51 ++
 .../src/test/resources/schema/studentCreate.xsd |  46 ++
 .../src/test/resources/schema/studentPut.xsd    |  47 ++
 .../src/test/resources/schema/teacher.xsd       |  47 ++
 .../resources/schema/teacherCreateBasic.xsd     |  35 ++
 .../src/test/resources/xml/createStudent.xml    |  31 +
 .../test/resources/xml/createStudentPartial.xml |  29 +
 .../test/resources/xml/createStudentWrong.xml   |  32 +
 .../src/test/resources/xml/createTeacher.xml    |  31 +
 .../test/resources/xml/createTeacherPartial.xml |  25 +
 .../test/resources/xml/createTeacherWrong.xml   |  32 +
 .../src/test/resources/xml/putStudent.xml       |  32 +
 .../src/test/resources/xml/putTeacher.xml       |  32 +
 .../src/test/resources/xml/random.xml           |  24 +
 .../src/test/resources/xslt/studentCreate.xsl   | 110 ++++
 .../src/test/resources/xslt/studentPut.xsl      | 108 ++++
 .../test/resources/xslt/teacherCreateBasic.xsl  |  45 ++
 .../resources/xslt/teacherDefaultValues.xsl     | 108 ++++
 90 files changed, 7991 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/pom.xml
----------------------------------------------------------------------
diff --git a/rt/ws/pom.xml b/rt/ws/pom.xml
index 0bea25c..70e1c97 100644
--- a/rt/ws/pom.xml
+++ b/rt/ws/pom.xml
@@ -36,5 +36,6 @@
         <module>rm</module>
         <module>mex</module>
         <module>eventing</module>
+        <module>transfer</module>
     </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/pom.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/pom.xml b/rt/ws/transfer/pom.xml
new file mode 100644
index 0000000..d2c1a09
--- /dev/null
+++ b/rt/ws/transfer/pom.xml
@@ -0,0 +1,91 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>cxf-rt-ws-transfer</artifactId>
+  <packaging>jar</packaging>
+  <name>Apache CXF Runtime WS Transfer</name>
+  <url>http://cxf.apache.org</url>
+  
+  <parent>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-parent</artifactId>
+      <version>3.2.0-SNAPSHOT</version>
+      <relativePath>../../../parent/pom.xml</relativePath>
+  </parent>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>cxf-rt-frontend-jaxws</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>cxf-rt-transports-local</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  
+  <build>
+      <plugins>
+          <plugin>
+              <groupId>org.apache.cxf</groupId>
+              <artifactId>cxf-xjc-plugin</artifactId>
+              <version>${cxf.xjc-utils.version}</version>
+              <executions>
+                  <execution>
+                      <id>generate-transfer</id>
+                      <phase>generate-sources</phase>
+                      <goals>
+                          <goal>xsdtojava</goal>
+                      </goals>
+                      <configuration>
+                          <sourceRoot>${basedir}/target/generated-sources/xjc</sourceRoot>
+                          <xsdOptions>
+                              <xsdOption>
+                                  <xsd>${basedir}/src/main/resources/schemas/transfer.xsd</xsd>
+                                  <packagename>org.apache.cxf.ws.transfer</packagename>
+                                  <bindingFile>${basedir}/src/main/resources/schemas/transfer.xjb</bindingFile>
+                                  <catalog>${basedir}/src/main/resources/schemas/catalog.cat</catalog>
+                              </xsdOption>
+                          </xsdOptions>
+                      </configuration>
+                  </execution>
+                  <execution>
+                      <id>generate-fragment</id>
+                      <phase>generate-sources</phase>
+                      <goals>
+                          <goal>xsdtojava</goal>
+                      </goals>
+                      <configuration>
+                          <sourceRoot>${basedir}/target/generated-sources/xjc</sourceRoot>
+                          <xsdOptions>
+                              <xsdOption>
+                                  <xsd>${basedir}/src/main/resources/schemas/fragment.xsd</xsd>
+                                  <packagename>org.apache.cxf.ws.transfer.dialect.fragment</packagename>
+                                  <catalog>${basedir}/src/main/resources/schemas/catalog-fragment.cat</catalog>
+                              </xsdOption>
+                          </xsdOptions>
+                      </configuration>
+                  </execution>
+              </executions>
+          </plugin>
+      </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/Dialect.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/Dialect.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/Dialect.java
new file mode 100644
index 0000000..6ea5208
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/Dialect.java
@@ -0,0 +1,64 @@
+/**
+ * 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.cxf.ws.transfer.dialect;
+
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * The interface for a Dialect objects.
+ */
+public interface Dialect {
+    
+    /**
+     * Method for processing incoming Get message by Dialect extension.
+     * @param body Get body
+     * @param representation XML representation stored in the ResourceManager
+     * @return Representation, which will be returned in response.
+     */
+    Object processGet(Get body, Representation representation);
+    
+    /**
+     * Method for processing incoming Put message by Dialect extension.
+     * @param body Put body
+     * @param representation XML representation stored in the ResourceManager
+     * @return Representation, which will be stored in ResourceManager.
+     */
+    Representation processPut(Put body, Representation representation);
+    
+    /**
+     * Method for processing incoming Delete message by Dialect extension.
+     * @param body Delete body
+     * @param representation XML representation stored in the ResourceManager
+     * @return Representation, which will be stored in ResourceManager.
+     */
+    boolean processDelete(Delete body, Representation representation);
+    
+    /**
+     * Method for processing incoming Create message by Dialect extension.
+     * @param body Create body
+     * @return Representation, which will be stored in ResourceManager.
+     */
+    Representation processCreate(Create body);
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialect.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialect.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialect.java
new file mode 100644
index 0000000..8498ff8
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialect.java
@@ -0,0 +1,622 @@
+/**
+ * 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.cxf.ws.transfer.dialect.fragment;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import javax.annotation.Resource;
+import javax.xml.bind.JAXBElement;
+import javax.xml.ws.WebServiceContext;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.Dialect;
+import org.apache.cxf.ws.transfer.dialect.fragment.faults.InvalidExpression;
+import org.apache.cxf.ws.transfer.dialect.fragment.faults.UnsupportedLanguage;
+import org.apache.cxf.ws.transfer.dialect.fragment.faults.UnsupportedMode;
+import org.apache.cxf.ws.transfer.dialect.fragment.language.FragmentDialectLanguage;
+import org.apache.cxf.ws.transfer.dialect.fragment.language.FragmentDialectLanguageQName;
+import org.apache.cxf.ws.transfer.dialect.fragment.language.FragmentDialectLanguageXPath10;
+import org.apache.cxf.ws.transfer.shared.faults.InvalidRepresentation;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownDialect;
+
+/**
+ * Implementation of the WS-Fragment dialect.
+ */
+public class FragmentDialect implements Dialect {
+
+    @Resource
+    WebServiceContext context;
+
+    private final Map<String, FragmentDialectLanguage> languages;
+
+    private Pattern badXPathPattern;
+
+    private Pattern goodXPathPattern;
+
+    public FragmentDialect() {
+        languages = new HashMap<String, FragmentDialectLanguage>();
+        languages.put(FragmentDialectConstants.QNAME_LANGUAGE_IRI, new FragmentDialectLanguageQName());
+        languages.put(FragmentDialectConstants.XPATH10_LANGUAGE_IRI, new FragmentDialectLanguageXPath10());
+        if (badXPathPattern == null) {
+            StringBuilder sb = new StringBuilder();
+            sb.append("//@?");
+            sb.append(FragmentDialectLanguageQName.getQNamePatternString());
+            sb.append("$");
+            badXPathPattern = Pattern.compile(sb.toString());
+        }
+        if (goodXPathPattern == null) {
+            StringBuilder sb = new StringBuilder();
+            sb.append("/@?");
+            sb.append(FragmentDialectLanguageQName.getQNamePatternString());
+            sb.append("$");
+            goodXPathPattern = Pattern.compile(sb.toString());
+        }
+    }
+
+    @Override
+    public JAXBElement<ValueType> processGet(Get body, Representation representation) {
+        for (Object o : body.getAny()) {
+            if (o instanceof JAXBElement<?> && ((JAXBElement<?>)o).getDeclaredType() == ExpressionType.class) {
+                ExpressionType expression = (ExpressionType) ((JAXBElement<?>)o).getValue();
+                String languageIRI = expression.getLanguage();
+                languageIRI = languageIRI == null ? FragmentDialectConstants.XPATH10_LANGUAGE_IRI : languageIRI;
+                if (languages.containsKey(languageIRI)) {
+                    FragmentDialectLanguage language = languages.get(languageIRI);
+                    return generateGetResponse(language.getResourceFragment(representation, expression));
+                } else {
+                    throw new UnsupportedLanguage();
+                }
+            }
+        }
+        throw new SoapFault("wsf:Expression is not present.", getSoapVersion().getSender());
+    }
+
+    @Override
+    public Representation processPut(Put body, Representation representation) {
+        for (Object o : body.getAny()) {
+            if (o instanceof Fragment) {
+                Fragment fragment = (Fragment) o;
+                ExpressionType expression = fragment.getExpression();
+                ValueType value = fragment.getValue();
+
+                if (expression == null) {
+                    throw new SoapFault("wsf:Expression is not present.", getSoapVersion().getSender());
+                }
+                if (value == null) {
+                    value = new ValueType();
+                }
+                String languageIRI = expression.getLanguage();
+                languageIRI = languageIRI == null ? FragmentDialectConstants.XPATH10_LANGUAGE_IRI : languageIRI;
+                if (languages.containsKey(languageIRI)) {
+                    FragmentDialectLanguage language = languages.get(languageIRI);
+                    Object resourceFragment = language.getResourceFragment(representation, expression);
+                    String mode = expression.getMode();
+                    mode = mode == null ? FragmentDialectConstants.FRAGMENT_MODE_REPLACE : mode;
+                    if (resourceFragment == null && FragmentDialectConstants.FRAGMENT_MODE_REPLACE.equals(mode)
+                            && FragmentDialectConstants.XPATH10_LANGUAGE_IRI.equals(languageIRI)) {
+                        resourceFragment = language.getResourceFragment(representation, getParentXPath(expression));
+                        mode = FragmentDialectConstants.FRAGMENT_MODE_ADD;
+                    }
+                    return modifyRepresentation(resourceFragment, mode, value);
+                } else {
+                    throw new UnsupportedLanguage();
+                }
+            }
+        }
+        throw new SoapFault("wsf:Fragment is not present.", getSoapVersion().getSender());
+    }
+
+    @Override
+    public boolean processDelete(Delete body, Representation representation) {
+        throw new UnknownDialect();
+    }
+
+    @Override
+    public Representation processCreate(Create body) {
+        throw new UnknownDialect();
+    }
+
+    /**
+     * Register FragmentDialectLanguage object for IRI.
+     * @param iri
+     * @param language
+     */
+    public void registerLanguage(String iri, FragmentDialectLanguage language) {
+        if (languages.containsKey(iri)) {
+            throw new IllegalArgumentException(String.format("IRI \"%s\" is already registered", iri));
+        }
+        languages.put(iri, language);
+    }
+
+    /**
+     * Unregister FragmentDialectLanguage object for IRI.
+     * @param iri
+     */
+    public void unregisterLanguage(String iri) {
+        if (!languages.containsKey(iri)) {
+            throw new IllegalArgumentException(String.format("IRI \"%s\" is not registered", iri));
+        }
+        languages.remove(iri);
+    }
+
+    /**
+     * Generates Value element, which is returned as response to Get request.
+     * @param value Result of the XPath evaluation.
+     * @return
+     */
+    private JAXBElement<ValueType> generateGetResponse(Object value) {
+        if (value instanceof Node) {
+            return generateGetResponseNode((Node) value);
+        } else if (value instanceof NodeList) {
+            return generateGetResponseNodeList((NodeList) value);
+        } else if (value instanceof String) {
+            return generateGetResponseString((String) value);
+        }
+        ObjectFactory objectFactory = new ObjectFactory();
+        return objectFactory.createValue(new ValueType());
+    }
+
+    /**
+     * Generates Value element from NodeList.
+     * @param nodeList
+     * @return
+     */
+    private JAXBElement<ValueType> generateGetResponseNodeList(NodeList nodeList) {
+        ValueType resultValue = new ValueType();
+        for (int i = 0; i < nodeList.getLength(); i++) {
+            resultValue.getContent().add(nodeList.item(i));
+        }
+        ObjectFactory objectFactory = new ObjectFactory();
+        return objectFactory.createValue(resultValue);
+    }
+
+    /**
+     * Generates Value element from Node.
+     * @param node
+     * @return
+     */
+    private JAXBElement<ValueType> generateGetResponseNode(Node node) {
+        Document doc = DOMUtils.createDocument();
+        ValueType resultValue = new ValueType();
+        if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+            Element attrNodeEl = doc.createElementNS(
+                    FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                    FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME);
+            attrNodeEl.setAttribute(
+                    FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR,
+                    node.getNodeName()
+            );
+            attrNodeEl.setTextContent(node.getNodeValue());
+            resultValue.getContent().add(attrNodeEl);
+        } else if (node.getNodeType() == Node.TEXT_NODE) {
+            Element textNodeEl = doc.createElementNS(
+                    FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                    FragmentDialectConstants.FRAGMENT_TEXT_NODE_NAME);
+            textNodeEl.setNodeValue(node.getNodeValue());
+            resultValue.getContent().add(textNodeEl);
+        } else if (node.getNodeType() == Node.ELEMENT_NODE) {
+            resultValue.getContent().add(node);
+        }
+        ObjectFactory objectFactory = new ObjectFactory();
+        return objectFactory.createValue(resultValue);
+    }
+
+    /**
+     * Generates Value element from String.
+     * @param value
+     * @return
+     */
+    private JAXBElement<ValueType> generateGetResponseString(String value) {
+        ValueType resultValue = new ValueType();
+        resultValue.getContent().add(value);
+        ObjectFactory objectFactory = new ObjectFactory();
+        return objectFactory.createValue(resultValue);
+    }
+
+    /**
+     * Returns expression containing XPath, which refers to parent element.
+     * @param expression
+     * @return
+     */
+    private ExpressionType getParentXPath(ExpressionType expression) {
+        String expr;
+        if (expression.getContent().size() == 1) {
+            expr = (String) expression.getContent().get(0);
+        } else {
+            throw new InvalidExpression();
+        }
+        if (badXPathPattern.matcher(expr).find()) {
+            throw new InvalidExpression();
+        }
+        if (goodXPathPattern.matcher(expr).find()) {
+            expression.getContent().clear();
+            expr = expr.replaceFirst(goodXPathPattern.pattern(), "");
+            if (expr.isEmpty()) {
+                expr = "/";
+            }
+            expression.getContent().add(expr);
+            return expression;
+        } else {
+            throw new InvalidExpression();
+        }
+    }
+
+    /**
+     * Process Put requests.
+     * @param resourceFragment Result of the XPath evaluation. It can be Node or NodeList.
+     * @param mode Mode defined in the Mode attribute.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentation(
+            Object resourceFragment,
+            String mode,
+            ValueType value) {
+        if (resourceFragment instanceof Node) {
+            List<Node> nodeList = new ArrayList<Node>();
+            nodeList.add((Node) resourceFragment);
+            return modifyRepresentationMode(nodeList, mode, value);
+        } else if (resourceFragment instanceof NodeList) {
+            NodeList rfNodeList = (NodeList) resourceFragment;
+            List<Node> nodeList = new ArrayList<Node>();
+            for (int i = 0; i < rfNodeList.getLength(); i++) {
+                nodeList.add(rfNodeList.item(i));
+            }
+            return modifyRepresentationMode(nodeList, mode, value);
+        } else {
+            throw new InvalidExpression();
+        }
+    }
+
+    /**
+     * Process Put requests.
+     * @param mode Mode defined in the Mode attribute.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationMode(
+            List<Node> nodeList,
+            String mode,
+            ValueType value) {
+        switch (mode) {
+        case FragmentDialectConstants.FRAGMENT_MODE_REPLACE:
+            return modifyRepresentationModeReplace(nodeList, value);
+        case FragmentDialectConstants.FRAGMENT_MODE_ADD:
+            return modifyRepresentationModeAdd(nodeList, value);
+        case FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE:
+            return modifyRepresentationModeInsertBefore(nodeList, value);
+        case FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER:
+            return modifyRepresentationModeInsertAfter(nodeList, value);
+        case FragmentDialectConstants.FRAGMENT_MODE_REMOVE:
+            return modifyRepresentationModeRemove(nodeList, value);
+        default:
+            throw new UnsupportedMode();
+        }
+    }
+
+    /**
+     * Process Put requests for Replace mode.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationModeReplace(
+            List<Node> nodeList,
+            ValueType value) {
+
+        if (nodeList.isEmpty()) {
+            throw new InvalidExpression();
+        }
+        Node firstNode = nodeList.get(0);
+        Document ownerDocument = firstNode.getOwnerDocument();
+        // if firstNode.getOwnerDocument == null the firstNode is ownerDocument
+        ownerDocument = ownerDocument == null ? (Document) firstNode : ownerDocument;
+        Node nextSibling = null;
+        Node parent = null;
+
+        for (Node node : nodeList) {
+            nextSibling = node.getNextSibling();
+            parent = removeNode(node);
+        }
+
+        addNode(ownerDocument, parent, nextSibling, value);
+
+        Representation representation = new Representation();
+        representation.setAny(ownerDocument.getDocumentElement());
+        return representation;
+    }
+
+    /**
+     * Process Put requests for Add mode.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationModeAdd(
+            List<Node> nodeList,
+            ValueType value) {
+        if (nodeList.isEmpty()) {
+            throw new InvalidExpression();
+        }
+        Node firstNode = nodeList.get(0);
+        Document ownerDocument = firstNode.getOwnerDocument();
+        // if firstNode.getOwnerDocument == null the firstNode is ownerDocument
+        ownerDocument = ownerDocument == null ? (Document) firstNode : ownerDocument;
+
+        for (Node node : nodeList) {
+            addNode(ownerDocument, node, null, value);
+        }
+        Representation representation = new Representation();
+        representation.setAny(ownerDocument.getDocumentElement());
+        return representation;
+    }
+
+    /**
+     * Process Put requests for InsertBefore mode.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationModeInsertBefore(
+            List<Node> nodeList,
+            ValueType value) {
+        if (nodeList.isEmpty()) {
+            throw new InvalidExpression();
+        }
+        Node firstNode = nodeList.get(0);
+        Document ownerDocument = firstNode.getOwnerDocument();
+        // if firstNode.getOwnerDocument == null the firstNode is ownerDocument
+        ownerDocument = ownerDocument == null ? (Document) firstNode : ownerDocument;
+
+        Node parent = firstNode.getParentNode();
+        if (parent == null && firstNode.getNodeType() != Node.DOCUMENT_NODE) {
+            throw new InvalidExpression();
+        }
+        if (parent == null) {
+            parent = firstNode;
+            if (((Document) parent).getDocumentElement() != null) {
+                throw new InvalidExpression();
+            }
+        }
+
+        for (Node node : nodeList) {
+            if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+                throw new InvalidRepresentation();
+            }
+            insertBefore(ownerDocument, parent, node, value);
+        }
+
+        Representation representation = new Representation();
+        representation.setAny(ownerDocument.getDocumentElement());
+        return representation;
+    }
+
+    /**
+     * Process Put requests for InsertAfter mode.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationModeInsertAfter(
+            List<Node> nodeList,
+            ValueType value) {
+        if (nodeList.isEmpty()) {
+            throw new InvalidExpression();
+        }
+        Node firstNode = nodeList.get(0);
+        Document ownerDocument = firstNode.getOwnerDocument();
+        // if firstNode.getOwnerDocument == null the firstNode is ownerDocument
+        ownerDocument = ownerDocument == null ? (Document) firstNode : ownerDocument;
+
+        Node parent = firstNode.getParentNode();
+        if (parent == null && firstNode.getNodeType() != Node.DOCUMENT_NODE) {
+            throw new InvalidExpression();
+        }
+        if (parent == null) {
+            parent = firstNode;
+            if (((Document) parent).getDocumentElement() != null) {
+                throw new InvalidExpression();
+            }
+        }
+
+        for (Node node : nodeList) {
+            if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+                throw new InvalidRepresentation();
+            }
+            insertAfter(ownerDocument, parent, node, value);
+        }
+
+        Representation representation = new Representation();
+        representation.setAny(ownerDocument.getDocumentElement());
+        return representation;
+    }
+
+    /**
+     * Process Put requests for Remove mode.
+     * @param value Value defined in the Value element.
+     * @return Representation element, which is returned as response.
+     */
+    private Representation modifyRepresentationModeRemove(
+            List<Node> nodeList,
+            ValueType value) {
+        if (nodeList.isEmpty()) {
+            throw new InvalidExpression();
+        }
+        Node firstNode = nodeList.get(0);
+        Document ownerDocument = firstNode.getOwnerDocument();
+        // if firstNode.getOwnerDocument == null the firstNode is ownerDocument
+        ownerDocument = ownerDocument == null ? (Document) firstNode : ownerDocument;
+
+        for (Node node : nodeList) {
+            removeNode(node);
+        }
+
+        Representation representation = new Representation();
+        representation.setAny(ownerDocument.getDocumentElement());
+        return representation;
+    }
+
+    /**
+     * Helper method. It removes Node and returns its parent.
+     * @param resourceFragment Node to remove.
+     * @return Parent of removed Node.
+     */
+    private Node removeNode(Node resourceFragment) {
+        Node parent = null;
+        if (resourceFragment.getNodeType() == Node.ATTRIBUTE_NODE) {
+            parent = ((Attr)resourceFragment).getOwnerElement();
+        } else {
+            parent = resourceFragment.getParentNode();
+        }
+        if (parent == null) {
+            // resourceFragment is Document Node
+            parent = resourceFragment;
+        }
+        if (resourceFragment.getNodeType() == Node.ATTRIBUTE_NODE) {
+            ((Element)parent).removeAttributeNode((Attr)resourceFragment);
+        } else {
+            if (parent != resourceFragment) {
+                parent.removeChild(resourceFragment);
+            } else {
+                // Both parent and resourceFragment are Document
+                Document doc = (Document) parent;
+                if (doc.getDocumentElement() != null) {
+                    doc.removeChild(doc.getDocumentElement());
+                }
+            }
+        }
+
+        return parent;
+    }
+
+    private void insertAfter(Document ownerDocument, Node parent, Node refChild, ValueType value) {
+        for (Object o : value.getContent()) {
+            if (o instanceof Node) {
+                Node node = (Node) o;
+
+                if (
+                        FragmentDialectConstants.FRAGMENT_2011_03_IRI.equals(node.getNamespaceURI())
+                                && FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME.equals(node.getLocalName())) {
+                    throw new InvalidRepresentation();
+                }
+
+                Node importedNode = ownerDocument.importNode(node, true);
+                if (parent.getNodeType() == Node.DOCUMENT_NODE) {
+                    parent.appendChild(importedNode);
+                } else {
+                    Node nextSibling = refChild.getNextSibling();
+                    if (nextSibling == null) {
+                        parent.appendChild(importedNode);
+                    } else {
+                        parent.insertBefore(importedNode, nextSibling);
+                    }
+                }
+            } else {
+                throw new InvalidExpression();
+            }
+        }
+    }
+
+    private void insertBefore(Document ownerDocument, Node parent, Node refChild, ValueType value) {
+        for (Object o : value.getContent()) {
+            if (o instanceof Node) {
+                Node node = (Node) o;
+
+                if (
+                        FragmentDialectConstants.FRAGMENT_2011_03_IRI.equals(node.getNamespaceURI())
+                                && FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME.equals(node.getLocalName())) {
+                    throw new InvalidRepresentation();
+                }
+
+                Node importedNode = ownerDocument.importNode(node, true);
+                if (parent.getNodeType() == Node.DOCUMENT_NODE) {
+                    parent.appendChild(importedNode);
+                } else {
+                    parent.insertBefore(importedNode, refChild);
+                }
+            } else {
+                throw new InvalidExpression();
+            }
+        }
+    }
+
+    /**
+     * Helper method. It adds new Node as the last child of parent.
+     * @param ownerDocument Document, where the Node is added.
+     * @param parent Parent, where the Node is added.
+     * @param value Value defined in the Value element. It represents newly added Node.
+     */
+    private void addNode(Document ownerDocument, Node parent, Node nextSibling, ValueType value) {
+        if (ownerDocument == parent && ownerDocument.getDocumentElement() != null) {
+            throw new InvalidRepresentation();
+        }
+        for (Object o : value.getContent()) {
+            if (o instanceof String) {
+                parent.setTextContent(parent.getTextContent() + ((String) o));
+            } else if (o instanceof Node) {
+                Node node = (Node) o;
+                if (
+                        FragmentDialectConstants.FRAGMENT_2011_03_IRI.equals(node.getNamespaceURI())
+                                && FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME.equals(node.getLocalName())) {
+                    String attrName = ((Element)node).getAttributeNS(
+                            FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                            FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR);
+                    String attrValue = node.getTextContent();
+                    if (attrName == null) {
+                        throw new SoapFault("wsf:AttributeNode@name is not present.", getSoapVersion().getSender());
+                    }
+                    if (((Element) parent).hasAttribute(attrName)) {
+                        throw new InvalidRepresentation();
+                    }
+                    ((Element) parent).setAttribute(attrName, attrValue);
+                } else {
+                    // import the node to the ownerDocument
+                    Node importedNode = ownerDocument.importNode((Node) o, true);
+                    if (nextSibling == null) {
+                        parent.appendChild(importedNode);
+                    } else {
+                        parent.insertBefore(importedNode, nextSibling);
+                    }
+                }
+            } else {
+                throw new InvalidExpression();
+            }
+        }
+    }
+
+    private SoapVersion getSoapVersion() {
+        WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
+        SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
+        return message.getVersion();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialectConstants.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialectConstants.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialectConstants.java
new file mode 100644
index 0000000..6ffd009
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/FragmentDialectConstants.java
@@ -0,0 +1,51 @@
+/**
+ * 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.cxf.ws.transfer.dialect.fragment;
+
+/**
+ * Helper class for holding of constants.
+ */
+public final class FragmentDialectConstants {
+    
+    public static final String FRAGMENT_2011_03_IRI = "http://www.w3.org/2011/03/ws-fra";
+    
+    public static final String QNAME_LANGUAGE_IRI = "http://www.w3.org/2011/03/ws-fra/QName";
+    
+    public static final String XPATH10_LANGUAGE_IRI = "http://www.w3.org/2011/03/ws-fra/XPath10";
+    
+    public static final String FRAGMENT_TEXT_NODE_NAME = "TextNode";
+    
+    public static final String FRAGMENT_ATTR_NODE_NAME = "AttributeNode";
+    
+    public static final String FRAGMENT_ATTR_NODE_NAME_ATTR = "name";
+    
+    public static final String FRAGMENT_MODE_REPLACE = "http://www.w3.org/2011/03/ws-fra/Modes/Replace";
+    
+    public static final String FRAGMENT_MODE_ADD = "http://www.w3.org/2011/03/ws-fra/Modes/Add";
+    
+    public static final String FRAGMENT_MODE_INSERT_BEFORE = "http://www.w3.org/2011/03/ws-fra/Modes/InsertBefore";
+    
+    public static final String FRAGMENT_MODE_INSERT_AFTER = "http://www.w3.org/2011/03/ws-fra/Modes/InsertAfter";
+    
+    public static final String FRAGMENT_MODE_REMOVE = "http://www.w3.org/2011/03/ws-fra/Modes/Remove";
+    
+    private FragmentDialectConstants() {
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/FragmentFault.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/FragmentFault.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/FragmentFault.java
new file mode 100644
index 0000000..3777238
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/FragmentFault.java
@@ -0,0 +1,44 @@
+/**
+ * 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.cxf.ws.transfer.dialect.fragment.faults;
+
+import javax.xml.namespace.QName;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.helpers.DOMUtils;
+
+/**
+ * The parent for all WS-Fragment-specific faults.
+ */
+public abstract class FragmentFault extends SoapFault {
+
+    private static final long serialVersionUID = 2111286624025926462L;
+
+    public FragmentFault(String reason, String detail, QName faultCode) {
+        super(reason, faultCode);
+        if (detail != null) {
+            Document doc = DOMUtils.createDocument();
+            Element detailEl = doc.createElement("detail");
+            detailEl.setTextContent(detail);
+            setDetail(detailEl);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/InvalidExpression.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/InvalidExpression.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/InvalidExpression.java
new file mode 100644
index 0000000..23da1bc
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/InvalidExpression.java
@@ -0,0 +1,42 @@
+/**
+ * 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.cxf.ws.transfer.dialect.fragment.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+
+/**
+ * Definition of the InvalidExpression SOAPFault.
+ */
+public class InvalidExpression extends FragmentFault {
+
+    private static final long serialVersionUID = -1920756304737648952L;
+
+    private static final String SUBCODE = "InvalidExpression";
+
+    private static final String REASON = "The specified Language expression is invalid.";
+
+    private static final String DETAIL = "The invalid language expression.";
+
+    public InvalidExpression() {
+        super(REASON, DETAIL,
+                new QName(FragmentDialectConstants.FRAGMENT_2011_03_IRI, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedLanguage.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedLanguage.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedLanguage.java
new file mode 100644
index 0000000..bb13b4c
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedLanguage.java
@@ -0,0 +1,41 @@
+/**
+ * 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.cxf.ws.transfer.dialect.fragment.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+
+/**
+ * Definition of the UnsupportedLanguage SOAPFault.
+ */
+public class UnsupportedLanguage extends FragmentFault {
+
+    private static final long serialVersionUID = 7627652802987243575L;
+
+    private static final String SUBCODE = "UnsupportedLanguage";
+
+    private static final String REASON = "The specified Language IRI is not supported.";
+
+    private static final String DETAIL = "The unsupported Language IRI.";
+
+    public UnsupportedLanguage() {
+        super(REASON, DETAIL,
+                new QName(FragmentDialectConstants.FRAGMENT_2011_03_IRI, SUBCODE));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedMode.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedMode.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedMode.java
new file mode 100644
index 0000000..f38b912
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/faults/UnsupportedMode.java
@@ -0,0 +1,42 @@
+/**
+ * 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.cxf.ws.transfer.dialect.fragment.faults;
+
+import javax.xml.namespace.QName;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+
+/**
+ * Definition of the UnsupportedMode SOAPFault.
+ */
+public class UnsupportedMode extends FragmentFault {
+
+    private static final long serialVersionUID = -5824904523582078377L;
+
+    private static final String SUBCODE = "UnsupportedMode";
+
+    private static final String REASON = "The specified mode is not supported.";
+
+    private static final String DETAIL = "The unsupported Mode.";
+
+    public UnsupportedMode() {
+        super(REASON, DETAIL,
+                new QName(FragmentDialectConstants.FRAGMENT_2011_03_IRI, SUBCODE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguage.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguage.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguage.java
new file mode 100644
index 0000000..8ff8018
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguage.java
@@ -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.cxf.ws.transfer.dialect.fragment.language;
+
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+
+/**
+ * Interface for FragmentDialect languages.
+ */
+public interface FragmentDialectLanguage {
+    
+    /**
+     * Returns fragment of resource, which is described by expression.
+     * @param representation Resource, from which is fragment computed.
+     * @param expression Expression written in the language.
+     * @return It can return org.w3c.dom.Node | org.w3c.dom.NodeList | String
+     */
+    Object getResourceFragment(Representation representation, ExpressionType expression);
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageQName.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageQName.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageQName.java
new file mode 100644
index 0000000..a5d78ad
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageQName.java
@@ -0,0 +1,134 @@
+/**
+ * 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.cxf.ws.transfer.dialect.fragment.language;
+
+import java.util.Iterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.xml.namespace.NamespaceContext;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.apache.cxf.helpers.XPathUtils;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.faults.InvalidExpression;
+
+/**
+ * Implementation of the QName language.
+ */
+public class FragmentDialectLanguageQName implements FragmentDialectLanguage {
+
+    private static Pattern qNamePattern;
+    
+    public FragmentDialectLanguageQName() {
+        if (qNamePattern == null) {
+            String qName = getQNamePatternString();
+            qNamePattern = Pattern.compile("^" + qName);
+        }
+    }
+
+    /**
+     * Returns regex string, which describes QName format.
+     * @return
+     */
+    public static String getQNamePatternString() {
+        // See http://www.w3.org/TR/REC-xml-names/#NT-PrefixedName
+        // NCNameStartChar
+        // see http://www.w3.org/TR/REC-xml-names/#NT-NCName
+        // and http://www.w3.org/TR/REC-xml/#NT-NameStartChar
+        String ncNameStartChar = "[A-Z]|_|[a-z]|[\\x{c0}-\\x{d6}]|[\\x{d8}-\\x{f6}]|[\\x{f8}-\\x{2ff}]|"
+                + "[\\x{370}-\\x{37d}]|[\\x{37f}-\\x{1fff}]|[\\x{200c}-\\x{200d}]|"
+                + "[\\x{2070}-\\x{218f}]|[\\x{2c00}-\\x{2fef}]|[\\x{3001}-\\x{d7ff}]|"
+                + "[\\x{f900}-\\x{fdcf}]|[\\x{fdf0}-\\x{fffd}]|[\\x{10000}-\\x{effff}]";
+        // NCNameChar
+        // see http://www.w3.org/TR/REC-xml/#NT-NameChar
+        String ncNameChar = ncNameStartChar
+                + "|-|\\.|[0-9]|\\x{b7}|[\\x{0300}-\\x{036f}]|[\\x{203f}-\\x{2040}]";
+        // NCName
+        // see http://www.w3.org/TR/REC-xml/#NT-Name
+        String ncName = String.format("(%s)(%s)*", ncNameStartChar, ncNameChar);
+        // QName
+        // see http://www.w3.org/TR/REC-xml-names/#NT-QName
+        return String.format("((%s):)?(%s)", ncName, ncName);
+    }
+    
+    @Override
+    public Object getResourceFragment(final Representation representation, ExpressionType expression) {
+        String expressionStr = getXPathFromQNameExpression(expression);
+        // Evaluate XPath
+        XPathUtils xu = new XPathUtils(new NamespaceContext() {
+            @Override
+            public String getNamespaceURI(String prefix) {
+                if (prefix != null && !prefix.isEmpty()) {
+                    Element resource = (Element) representation.getAny();
+                    return resource.getAttribute("xmlns:" + prefix);
+                } else {
+                    return null;
+                }
+            }
+
+            @Override
+            public String getPrefix(String s) {
+                throw new UnsupportedOperationException();
+            }
+
+            @Override
+            public Iterator<String> getPrefixes(String s) {
+                throw new UnsupportedOperationException();
+            }
+        });
+        Node resource = (Node) representation.getAny();
+        if (resource == null) {
+            // Returns empty NodeList
+            return new NodeList() {
+                @Override
+                public Node item(int i) {
+                    return null;
+                }
+
+                @Override
+                public int getLength() {
+                    return 0;
+                }
+            };
+        }
+        return xu.getValueList(expressionStr, resource);
+    }
+    
+    /**
+     * Converts expression in QName language to XPath expression.
+     * @param expression Expression in QName language.
+     * @return Expression in XPath language.
+     */
+    private String getXPathFromQNameExpression(ExpressionType expression) {
+        if (expression.getContent().size() == 1) {
+            String expressionValue = (String) expression.getContent().get(0);
+            Matcher m = qNamePattern.matcher(expressionValue);
+            if (m.matches()) {
+                return "/node()/" + expressionValue;
+            } else {
+                throw new InvalidExpression();
+            }
+        } else {
+            throw new InvalidExpression();
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageXPath10.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageXPath10.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageXPath10.java
new file mode 100644
index 0000000..86bddab
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/dialect/fragment/language/FragmentDialectLanguageXPath10.java
@@ -0,0 +1,160 @@
+/**
+ * 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.cxf.ws.transfer.dialect.fragment.language;
+
+import java.util.Iterator;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathException;
+import javax.xml.xpath.XPathFactory;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.faults.InvalidExpression;
+
+/**
+ * Implementation of the XPath 1.0 language.
+ */
+public class FragmentDialectLanguageXPath10 implements FragmentDialectLanguage {
+
+    private static XPathFactory xpathFactory = XPathFactory.newInstance();
+
+    @Override
+    public Object getResourceFragment(final Representation representation, ExpressionType expression) {
+        String expressionStr = getXPathFromExpression(expression);
+        // Evaluate XPath
+        XPath xPath = xpathFactory.newXPath();
+        xPath.setNamespaceContext(new NamespaceContext() {
+
+            @Override
+            public String getNamespaceURI(String prefix) {
+                if (prefix != null && !prefix.isEmpty()) {
+                    Element resource = (Element) representation.getAny();
+                    return resource.getAttribute("xmlns:" + prefix);
+                } else {
+                    return null;
+                }
+            }
+
+            @Override
+            public String getPrefix(String string) {
+                throw new UnsupportedOperationException();
+            }
+
+            @Override
+            public Iterator<String> getPrefixes(String string) {
+                throw new UnsupportedOperationException();
+            }
+        });
+        try {
+            Object resource = representation.getAny();
+            if (resource == null) {
+                resource = DOMUtils.createDocument();
+            }
+            NodeList result = (NodeList) xPath.evaluate(
+                expressionStr, resource, XPathConstants.NODESET);
+            if (checkResultConstraints(result)) {
+                if (result.getLength() == 0) {
+                    return  null;
+                } else {
+                    return result;
+                }
+            } else {
+                return result.item(0);
+            }
+        } catch (XPathException ex) {
+            // See https://www.java.net/node/681793
+        }
+
+        try {
+            return (String) xPath.evaluate(
+                expressionStr, representation.getAny(), XPathConstants.STRING);
+        } catch (XPathException ex) {
+            throw new InvalidExpression();
+        }
+    }
+    
+    /**
+     * Get XPath from the Expression element.
+     * @param expression
+     * @return 
+     */
+    private String getXPathFromExpression(ExpressionType expression) {
+        if (expression.getContent().size() == 1) {
+            return (String) expression.getContent().get(0);
+        } else {
+            throw new InvalidExpression();
+        }
+    }
+    
+    /**
+     * Check if result from evaluation of XPath expression fullfils constraints
+     * defined in the specification.
+     * See http://www.w3.org/TR/ws-fragment/#IdResSubset
+     * @param result
+     * @return If the result is true, the server should return all sequence of elements,
+     *         otherwise it should return only the first element.
+     */
+    private boolean checkResultConstraints(NodeList result) {
+        if (result.getLength() > 0) {
+            Node firstNode = result.item(0);
+            if (firstNode.getNodeType() == Node.ELEMENT_NODE) {
+                Element firstEl = (Element) firstNode;
+                // QName attributes
+                String localName = firstEl.getLocalName();
+                String namespace = firstEl.getNamespaceURI();
+                Node parent = firstEl.getParentNode();
+                for (int i = 1; i < result.getLength(); i++) {
+                    Node node = result.item(i);
+                    if (node.getNodeType() == Node.ELEMENT_NODE) {
+                        Element element = (Element) node;
+                        if (!stringEquals(element.getLocalName(), localName)) {
+                            return false;
+                        }
+                        if (!stringEquals(element.getNamespaceURI(), namespace)) {
+                            return false;
+                        }
+                        if (element.getParentNode() != parent) {
+                            return false;
+                        }
+                    } else {
+                        return false;
+                    }
+                }
+            } else {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    /**
+     * Helper method for equation two strings, which can be nullable.
+     * @param str1
+     * @param str2
+     * @return 
+     */
+    private boolean stringEquals(String str1, String str2) {
+        return str1 == null ? str2 == null : str1.equals(str2);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/MemoryResourceManager.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/MemoryResourceManager.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/MemoryResourceManager.java
new file mode 100644
index 0000000..9609013e
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/MemoryResourceManager.java
@@ -0,0 +1,160 @@
+/**
+ * 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.cxf.ws.transfer.manager;
+
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.WebServiceContext;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownResource;
+
+/**
+ * In memory implementation for ResourceManager interface.
+ */
+public class MemoryResourceManager implements ResourceManager {
+
+    public static final String REF_NAMESPACE = "http://cxf.apache.org/rt/ws/transfer/MemoryResourceManager";
+
+    public static final String REF_LOCAL_NAME = "uuid";
+
+    private static final Logger LOG = LogUtils.getL7dLogger(MemoryResourceManager.class);
+
+    protected Map<String, String> storage;
+
+    @Resource
+    private WebServiceContext context;
+
+    public MemoryResourceManager() {
+        storage = new HashMap<String, String>();
+    }
+
+    @Override
+    public Representation get(ReferenceParametersType ref) {
+        String uuid = getUUID(ref);
+        if (!storage.containsKey(uuid)) {
+            throw new UnknownResource();
+        }
+        String resource = storage.get(uuid);
+        if (resource.isEmpty()) {
+            return new Representation();
+        } else {
+            Document doc = null;
+            try {
+                doc = StaxUtils.read(new StringReader(storage.get(uuid)));
+            } catch (XMLStreamException e) {
+                LOG.severe(e.getLocalizedMessage());
+                throw new SoapFault("Internal Error", getSoapVersion().getReceiver());
+            }
+            Representation representation = new Representation();
+            representation.setAny(doc.getDocumentElement());
+            return representation;
+        }
+    }
+
+    @Override
+    public void delete(ReferenceParametersType ref) {
+        String uuid = getUUID(ref);
+        if (!storage.containsKey(uuid)) {
+            throw new UnknownResource();
+        }
+        storage.remove(uuid);
+    }
+
+    @Override
+    public void put(ReferenceParametersType ref, Representation newRepresentation) {
+        String uuid = getUUID(ref);
+        if (!storage.containsKey(uuid)) {
+            throw new UnknownResource();
+        }
+        Element representationEl = (Element) newRepresentation.getAny();
+        if (representationEl == null) {
+            storage.put(uuid, "");
+        } else {
+            storage.put(uuid, StaxUtils.toString(representationEl));
+        }
+    }
+
+    @Override
+    public ReferenceParametersType create(Representation initRepresentation) {
+        // Store xmlResource
+        String uuid = UUID.randomUUID().toString();
+        Element representationEl = (Element) initRepresentation.getAny();
+        if (representationEl == null) {
+            storage.put(uuid, "");
+        } else {
+            storage.put(uuid, StaxUtils.toString(representationEl));
+        }
+
+        Element uuidEl = DOMUtils.createDocument().createElementNS(REF_NAMESPACE, REF_LOCAL_NAME);
+        uuidEl.setTextContent(uuid);
+
+        // Create referenceParameter
+        ReferenceParametersType refParam = new ReferenceParametersType();
+        refParam.getAny().add(uuidEl);
+        return refParam;
+    }
+
+    private String getUUID(ReferenceParametersType ref) {
+        for (Object object : ref.getAny()) {
+            if (object instanceof JAXBElement) {
+                JAXBElement<?> element = (JAXBElement<?>) object;
+                QName qName = element.getName();
+                if (
+                        REF_NAMESPACE.equals(qName.getNamespaceURI())
+                                && REF_LOCAL_NAME.equals(qName.getLocalPart())) {
+                    return (String) element.getValue();
+                }
+            } else if (object instanceof Element) {
+                Element element = (Element) object;
+                if (
+                        REF_NAMESPACE.equals(element.getNamespaceURI())
+                                && REF_LOCAL_NAME.equals(element.getLocalName())) {
+                    return element.getTextContent();
+                }
+            }
+        }
+        throw new UnknownResource();
+    }
+
+    private SoapVersion getSoapVersion() {
+        WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
+        SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
+        return message.getVersion();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/ResourceManager.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/ResourceManager.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/ResourceManager.java
new file mode 100644
index 0000000..7dbc6ac
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/manager/ResourceManager.java
@@ -0,0 +1,59 @@
+/**
+ * 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.cxf.ws.transfer.manager;
+
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Representation;
+
+/**
+ * Interface for managing resource representations.
+ */
+public interface ResourceManager {
+    
+    /**
+     * Returns Representation object given by reference parameter.
+     * @param ref Reference parameter returned by create method.
+     * @return Representation object containing the XML resource.
+     * @see ResourceManager#create(org.apache.cxf.ws.transfer.Representation) 
+     */
+    Representation get(ReferenceParametersType ref);
+    
+    /**
+     * Deletes Representation object given by reference parameter.
+     * @param ref Reference parameter returned by create method.
+     * @see ResourceManager#create(org.apache.cxf.ws.transfer.Representation)
+     */
+    void delete(ReferenceParametersType ref);
+    
+    /**
+     * Replaces Representation object given by reference parameter with newRepresentation.
+     * @param ref Reference parameter returned by create method.
+     * @param newRepresentation New Representation object, which will replace the old one.
+     * @see ResourceManager#create(org.apache.cxf.ws.transfer.Representation)
+     */
+    void put(ReferenceParametersType ref, Representation newRepresentation);
+    
+    /**
+     * Creates new Representation object from initRepresenation.
+     * @param initRepresentation Representation object containing initial XML resource.
+     * @return Reference parameter for newly created Representation object.
+     */
+    ReferenceParametersType create(Representation initRepresentation);
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/Resource.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/Resource.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/Resource.java
new file mode 100644
index 0000000..3280e39
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/Resource.java
@@ -0,0 +1,101 @@
+/**
+ * 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.cxf.ws.transfer.resource;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.Action;
+import javax.xml.ws.soap.Addressing;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.DeleteResponse;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+
+/**
+ * The interface definition of a Resource web service, according to the specification.
+ */
+@WebService(targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+        name = TransferConstants.NAME_RESOURCE)
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+@Addressing(enabled = true, required = true)
+public interface Resource {
+
+    @Action(
+            input = TransferConstants.ACTION_GET,
+            output = TransferConstants.ACTION_GET_RESPONSE)
+    @WebMethod(operationName = TransferConstants.NAME_OPERATION_GET)
+    @WebResult(
+            name = TransferConstants.NAME_MESSAGE_GET_RESPONSE,
+            targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+            partName = "Body"
+    )
+    GetResponse get(
+        @WebParam(
+                name = TransferConstants.NAME_MESSAGE_GET,
+                targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+                partName = "Body"
+        )
+        Get body
+    );
+
+    @Action(
+            input = TransferConstants.ACTION_DELETE,
+            output = TransferConstants.ACTION_DELETE_RESPONSE
+    )
+    @WebMethod(operationName = TransferConstants.NAME_OPERATION_DELETE)
+    @WebResult(
+            name = TransferConstants.NAME_MESSAGE_DELETE_RESPONSE,
+            targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+            partName = "Body"
+    )
+    DeleteResponse delete(
+        @WebParam(
+                name = TransferConstants.NAME_MESSAGE_DELETE,
+                targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+                partName = "Body"
+        )
+        Delete body
+    );
+
+    @Action(
+            input = TransferConstants.ACTION_PUT,
+            output = TransferConstants.ACTION_PUT_RESPONSE
+    )
+    @WebMethod(operationName = TransferConstants.NAME_OPERATION_PUT)
+    @WebResult(
+            name = TransferConstants.NAME_MESSAGE_PUT_RESPONSE,
+            targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+            partName = "Body"
+    )
+    PutResponse put(
+        @WebParam(
+                name = TransferConstants.NAME_MESSAGE_PUT,
+                targetNamespace = TransferConstants.TRANSFER_2011_03_NAMESPACE,
+                partName = "Body"
+        )
+        Put body
+    );
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceLocal.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceLocal.java b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceLocal.java
new file mode 100644
index 0000000..49333d6
--- /dev/null
+++ b/rt/ws/transfer/src/main/java/org/apache/cxf/ws/transfer/resource/ResourceLocal.java
@@ -0,0 +1,191 @@
+/**
+ * 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.cxf.ws.transfer.resource;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.ws.WebServiceContext;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.DeleteResponse;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.Dialect;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialect;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownDialect;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceTypeIdentifier;
+import org.apache.cxf.ws.transfer.validationtransformation.ValidAndTransformHelper;
+
+/**
+ * Implementation of the Resource interface for resources, which are created locally.
+ * @see org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceResolver
+ */
+public class ResourceLocal implements Resource {
+    
+    @javax.annotation.Resource
+    protected WebServiceContext context;
+    
+    protected ResourceManager manager;
+    
+    protected List<ResourceTypeIdentifier> resourceTypeIdentifiers;
+    
+    protected Map<String, Dialect> dialects;
+
+    public ResourceLocal() {
+        dialects = new HashMap<String, Dialect>();
+        dialects.put(FragmentDialectConstants.FRAGMENT_2011_03_IRI, new FragmentDialect());
+    }
+    
+    public ResourceManager getManager() {
+        return manager;
+    }
+
+    public void setManager(ResourceManager manager) {
+        this.manager = manager;
+    }
+
+    public List<ResourceTypeIdentifier> getResourceTypeIdentifiers() {
+        if (resourceTypeIdentifiers == null) {
+            resourceTypeIdentifiers = new ArrayList<>();
+        }
+        return resourceTypeIdentifiers;
+    }
+
+    public void setResourceTypeIdentifiers(List<ResourceTypeIdentifier> resourceTypeIdentifiers) {
+        this.resourceTypeIdentifiers = resourceTypeIdentifiers;
+    }
+    
+    /**
+     * Register Dialect object for URI.
+     * @param iri
+     * @param dialect 
+     */
+    public void registerDialect(String iri, Dialect dialect) {
+        if (dialects.containsKey(iri)) {
+            throw new IllegalArgumentException(String.format("IRI \"%s\" is already registered", iri));
+        }
+        dialects.put(iri, dialect);
+    }
+    
+    /**
+     * Unregister dialect URI.
+     * @param iri 
+     */
+    public void unregisterDialect(String iri) {
+        if (!dialects.containsKey(iri)) {
+            throw new IllegalArgumentException(String.format("IRI \"%s\" is not registered", iri));
+        }
+        dialects.remove(iri);
+    }
+    
+    @Override
+    public GetResponse get(Get body) {
+        // Getting reference paramaters
+        AddressingProperties addrProps = (AddressingProperties) ((WrappedMessageContext) context
+                .getMessageContext()).getWrappedMessage()
+                .getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
+        ReferenceParametersType refParams = addrProps
+                .getToEndpointReference()
+                .getReferenceParameters();
+        GetResponse response = new GetResponse();
+        // Getting representation from the ResourceManager
+        Representation representation = manager.get(refParams);
+        // Dialect processing
+        if (body.getDialect() != null && !body.getDialect().isEmpty()) {
+            if (dialects.containsKey(body.getDialect())) {
+                Dialect dialect = dialects.get(body.getDialect());
+                // Send fragment of resource instead it's representation.
+                response.getAny().add(dialect.processGet(body, representation));
+            } else {
+                throw new UnknownDialect();
+            }
+        } else {
+            // Send representation obtained from ResourceManager.
+            response.setRepresentation(representation);
+        }
+        return response;
+    }
+
+    @Override
+    public DeleteResponse delete(Delete body) {
+        // Getting reference paramaters
+        AddressingProperties addrProps = (AddressingProperties) ((WrappedMessageContext) context
+                .getMessageContext()).getWrappedMessage()
+                .getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
+        ReferenceParametersType refParams = addrProps
+                .getToEndpointReference()
+                .getReferenceParameters();
+        boolean delete = true;
+        // Dialect processing
+        if (body.getDialect() != null && !body.getDialect().isEmpty()) {
+            if (dialects.containsKey(body.getDialect())) {
+                Dialect dialect = dialects.get(body.getDialect());
+                delete = dialect.processDelete(body, manager.get(refParams));
+            } else {
+                throw new UnknownDialect();
+            }
+        }
+        if (delete) {
+            manager.delete(refParams);
+        }
+        return new DeleteResponse();
+    }
+
+    @Override
+    public PutResponse put(Put body) {
+        // Getting reference paramaters
+        AddressingProperties addrProps = (AddressingProperties) ((WrappedMessageContext) context
+                .getMessageContext()).getWrappedMessage()
+                .getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
+        ReferenceParametersType refParams = addrProps
+                .getToEndpointReference()
+                .getReferenceParameters();
+        // Getting representation from the ResourceManager
+        Representation storedRepresentation = manager.get(refParams);
+        // Getting representation from the incoming SOAP message. This representation will be stored.
+        Representation putRepresentation = body.getRepresentation();
+        // Dialect processing
+        if (body.getDialect() != null && !body.getDialect().isEmpty()) {
+            if (dialects.containsKey(body.getDialect())) {
+                Dialect dialect = dialects.get(body.getDialect());
+                putRepresentation = dialect.processPut(body, storedRepresentation);
+            } else {
+                throw new UnknownDialect();
+            }
+        }
+        ValidAndTransformHelper.validationAndTransformation(
+                resourceTypeIdentifiers, putRepresentation, storedRepresentation);
+        manager.put(refParams, putRepresentation);
+        PutResponse response = new PutResponse();
+        response.setRepresentation(putRepresentation);
+        return response;
+    }
+    
+}


[2/5] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

Posted by dk...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java
new file mode 100644
index 0000000..2059a7a
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java
@@ -0,0 +1,196 @@
+/**
+ * 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.cxf.ws.transfer.integration;
+
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.BindingProvider;
+
+import org.w3c.dom.Document;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.ContextUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resource.ResourceLocal;
+import org.apache.cxf.ws.transfer.resource.ResourceRemote;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactoryImpl;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.SimpleResourceResolver;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+public class IntegrationBaseTest {
+    
+    public static final String RESOURCE_FACTORY_ADDRESS = "local://ResourceFactory";
+    
+    public static final String RESOURCE_ADDRESS = "local://ResourceLocal";
+    
+    public static final String RESOURCE_REMOTE_ADDRESS = "local://ResourceRemote";
+    
+    public static final String RESOURCE_REMOTE_MANAGER_ADDRESS = "local://ResourceRemote"
+            + TransferConstants.RESOURCE_REMOTE_SUFFIX;
+    
+    public static final String RESOURCE_LOCAL_ADDRESS = "local://ResourceLocal";
+    
+    protected static DocumentBuilderFactory documentBuilderFactory;
+    
+    protected static DocumentBuilder documentBuilder;
+    
+    protected static Document document;
+    
+    protected Bus bus;
+    
+    @BeforeClass
+    public static void beforeClass() throws ParserConfigurationException {
+        documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        document = documentBuilder.newDocument();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        documentBuilderFactory = null;
+        documentBuilder = null;
+        document = null;
+    }
+    
+    @Before
+    public void before() {
+        bus = BusFactory.getDefaultBus();
+    }
+    
+    @After
+    public void after() {
+        bus.shutdown(true);
+        bus = null;
+    }
+    
+    protected Server createLocalResourceFactory(ResourceManager manager) {
+        ResourceFactoryImpl implementor = new ResourceFactoryImpl();
+        implementor.setResourceResolver(new SimpleResourceResolver(RESOURCE_ADDRESS, manager));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_ADDRESS);
+        factory.setServiceBean(implementor);
+        
+        return factory.create();
+    }
+    
+    protected Server createRemoteResourceFactory() {
+        ResourceFactoryImpl implementor = new ResourceFactoryImpl();
+        implementor.setResourceResolver(new SimpleResourceResolver(RESOURCE_REMOTE_ADDRESS, null));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_ADDRESS);
+        factory.setServiceBean(implementor);
+        return factory.create();
+    }
+    
+    protected Server createRemoteResource(ResourceManager manager) {
+        ResourceRemote implementor = new ResourceRemote();
+        implementor.setManager(manager);
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        
+        Map<String, Object> props = factory.getProperties(true);
+        props.put("jaxb.additionalContextClasses",
+                org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType.class);
+        factory.setProperties(props);
+        
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_REMOTE_MANAGER_ADDRESS);
+        factory.setServiceBean(implementor);
+        return factory.create();
+    }
+    
+    protected Server createLocalResource(ResourceManager manager) {
+        ResourceLocal implementor = new ResourceLocal();
+        implementor.setManager(manager);
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        
+        Map<String, Object> props = factory.getProperties(true);
+        props.put("jaxb.additionalContextClasses",
+                org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType.class);
+        factory.setProperties(props);
+        
+        factory.setBus(bus);
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(RESOURCE_LOCAL_ADDRESS);
+        factory.setServiceBean(implementor);
+        return factory.create();
+    }
+
+    protected Representation getRepresentation(String content) throws XMLStreamException {
+        Document doc = null;
+        doc = StaxUtils.read(new StringReader(content));
+        Representation representation = new Representation();
+        representation.setAny(doc.getDocumentElement());
+        return representation;
+    }
+
+    protected Resource createClient(ReferenceParametersType refParams) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+
+        Map<String, Object> props = factory.getProperties();
+        if (props == null) {
+            props = new HashMap<String, Object>();
+        }
+        props.put("jaxb.additionalContextClasses",
+                ExpressionType.class);
+        factory.setProperties(props);
+
+        factory.setBus(bus);
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(RESOURCE_ADDRESS);
+        Resource proxy = (Resource) factory.create();
+
+        // Add reference parameters
+        AddressingProperties addrProps = new AddressingProperties();
+        EndpointReferenceType endpoint = new EndpointReferenceType();
+        endpoint.setReferenceParameters(refParams);
+        endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS));
+        addrProps.setTo(endpoint);
+        ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
+
+        return proxy;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java
new file mode 100644
index 0000000..85dabb0
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java
@@ -0,0 +1,135 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.transfer.integration;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ResourceFactoryTest extends IntegrationBaseTest {
+    
+    private static final String RESOURCE_UUID = "123456";
+    
+    private static final String REF_PARAM_NAMESPACE = "org.apache.cxf.transfer/manager";
+    
+    private static final String REF_PARAM_LOCAL_NAME = "UUID";
+    
+    private ReferenceParametersType createReferenceParameters() {
+        ReferenceParametersType refParam = new ReferenceParametersType();
+        Element uuidEl = DOMUtils.createDocument().createElementNS(
+                REF_PARAM_NAMESPACE, REF_PARAM_LOCAL_NAME);
+        uuidEl.setTextContent(RESOURCE_UUID);
+        refParam.getAny().add(uuidEl);
+        return refParam;
+    }
+    
+    private Element createXMLRepresentation() {
+        Element root = document.createElement("root");
+        Element child1 = document.createElement("child1");
+        Element child2 = document.createElement("child2");
+        root.appendChild(child1);
+        root.appendChild(child2);
+        return root;
+    }
+    
+    private ResourceFactory createClient() {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_ADDRESS);
+        return (ResourceFactory) factory.create();
+    }
+    
+    @Test
+    public void createLocalResourceTest() {
+        ReferenceParametersType refParams = createReferenceParameters();
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.create(EasyMock.isA(Representation.class)))
+                .andReturn(refParams);
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+        
+        Server localResourceFactory = createLocalResourceFactory(manager);
+        ResourceFactory client = createClient();
+        
+        Create createRequest = new Create();
+        Representation representation = new Representation();
+        representation.setAny(createXMLRepresentation());
+        createRequest.setRepresentation(representation);
+        
+        CreateResponse response = client.create(createRequest);
+        EasyMock.verify(manager);
+        
+        Assert.assertEquals("ResourceAddress is other than expected.", RESOURCE_ADDRESS,
+                response.getResourceCreated().getAddress().getValue());
+        Element refParamEl = (Element) response.getResourceCreated().getReferenceParameters().getAny().get(0);
+        Assert.assertEquals(REF_PARAM_NAMESPACE, refParamEl.getNamespaceURI());
+        Assert.assertEquals(REF_PARAM_LOCAL_NAME, refParamEl.getLocalName());
+        Assert.assertEquals(RESOURCE_UUID, refParamEl.getTextContent());
+        Assert.assertEquals("root", ((Element) response.getRepresentation().getAny()).getLocalName());
+        Assert.assertEquals(2, ((Element) response.getRepresentation().getAny()).getChildNodes().getLength());
+        
+        localResourceFactory.destroy();
+    }
+    
+    @Test
+    public void createRemoteResourceTest() {
+        ReferenceParametersType refParams = createReferenceParameters();
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.create(EasyMock.isA(Representation.class)))
+                .andReturn(refParams);
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+        
+        Server remoteResourceFactory = createRemoteResourceFactory();
+        Server remoteResource = createRemoteResource(manager);
+        ResourceFactory client = createClient();
+        
+        Create createRequest = new Create();
+        Representation representation = new Representation();
+        representation.setAny(createXMLRepresentation());
+        createRequest.setRepresentation(representation);
+        
+        CreateResponse response = client.create(createRequest);
+        EasyMock.verify(manager);
+        
+        Assert.assertEquals("ResourceAddress is other than expected.", RESOURCE_REMOTE_ADDRESS,
+                response.getResourceCreated().getAddress().getValue());
+        Element refParamEl = (Element) response.getResourceCreated().getReferenceParameters().getAny().get(0);
+        Assert.assertEquals(REF_PARAM_NAMESPACE, refParamEl.getNamespaceURI());
+        Assert.assertEquals(REF_PARAM_LOCAL_NAME, refParamEl.getLocalName());
+        Assert.assertEquals(RESOURCE_UUID, refParamEl.getTextContent());
+        Assert.assertEquals("root", ((Element) response.getRepresentation().getAny()).getLocalName());
+        Assert.assertEquals(2, ((Element) response.getRepresentation().getAny()).getChildNodes().getLength());
+        
+        remoteResourceFactory.destroy();
+        remoteResource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java
new file mode 100644
index 0000000..e2d4a3c
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java
@@ -0,0 +1,168 @@
+/**
+ * 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.cxf.ws.transfer.integration;
+
+import javax.xml.ws.BindingProvider;
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.ContextUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ResourceTest extends IntegrationBaseTest {
+    
+    private static final String UUID_VALUE = "123456";
+    
+    private static final String REPRESENTATION_NAME = "name1";
+    
+    private static final String REPRESENTATION_NAMESPACE = "test";
+    
+    private static final String REPRESENTATION_VALUE = "value1";
+    
+    protected Resource createClient(ReferenceParametersType refParams) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(RESOURCE_LOCAL_ADDRESS);
+        Resource proxy = (Resource) factory.create();
+
+        // Add reference parameters
+        AddressingProperties addrProps = new AddressingProperties();
+        EndpointReferenceType endpoint = new EndpointReferenceType();
+        endpoint.setReferenceParameters(refParams);
+        endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS));
+        addrProps.setTo(endpoint);
+        ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
+
+        return proxy;
+    }
+    
+    @Test
+    public void getRequestTest() {
+        Element representationEl = document.createElementNS(REPRESENTATION_NAMESPACE, REPRESENTATION_NAME);
+        representationEl.setTextContent(REPRESENTATION_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+        
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.get(EasyMock.isA(ReferenceParametersType.class))).andReturn(representation);
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = document.createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent(UUID_VALUE);
+        refParams.getAny().add(uuid);
+        
+        Server server = createLocalResource(manager);
+        Resource client = createClient(refParams);
+        
+        GetResponse response = client.get(new Get());
+        EasyMock.verify(manager);
+        
+        representationEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                REPRESENTATION_NAMESPACE, representationEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                REPRESENTATION_NAME, representationEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                REPRESENTATION_VALUE, representationEl.getTextContent());
+        
+        server.destroy();
+    }
+    
+    @Test
+    public void putRequestTest() {
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.get(EasyMock.isA(ReferenceParametersType.class))).andReturn(new Representation());
+        EasyMock.expectLastCall().once();
+        manager.put(EasyMock.isA(ReferenceParametersType.class), EasyMock.isA(Representation.class));
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = document.createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent(UUID_VALUE);
+        refParams.getAny().add(uuid);
+        
+        Element representationEl = document.createElementNS(REPRESENTATION_NAMESPACE, REPRESENTATION_NAME);
+        representationEl.setTextContent(REPRESENTATION_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+        
+        Server server = createLocalResource(manager);
+        Resource client = createClient(refParams);
+        
+        Put putRequest = new Put();
+        putRequest.setRepresentation(representation);
+        
+        PutResponse response = client.put(putRequest);
+        EasyMock.verify(manager);
+        
+        representationEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                REPRESENTATION_NAMESPACE, representationEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                REPRESENTATION_NAME, representationEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                REPRESENTATION_VALUE, representationEl.getTextContent());
+        
+        server.destroy();
+    }
+    
+    @Test
+    public void deleteRequestTest() {
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        manager.delete(EasyMock.isA(ReferenceParametersType.class));
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = document.createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent(UUID_VALUE);
+        refParams.getAny().add(uuid);
+        
+        Server server = createLocalResource(manager);
+        Resource client = createClient(refParams);
+        
+        client.delete(new Delete());
+        EasyMock.verify(manager);
+        
+        server.destroy();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java
new file mode 100644
index 0000000..f473339
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java
@@ -0,0 +1,204 @@
+/**
+ * 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.cxf.ws.transfer.unit;
+
+import javax.xml.parsers.ParserConfigurationException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownResource;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MemoryResourceManagerTest {
+    
+    public static final String ELEMENT_NAMESPACE = "test";
+    
+    public static final String ELEMENT_NAME = "name1";
+    
+    public static final String ELEMENT_VALUE = "value1";
+    
+    public static final String ELEMENT_VALUE_NEW = "value2";
+    
+    private static Document document;
+    
+    private ResourceManager resourceManager;
+    
+    @BeforeClass
+    public static void beforeClass() throws ParserConfigurationException {
+        document = DOMUtils.createDocument();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        document = null;
+    }
+    
+    @Before
+    public void before() {
+        resourceManager = new MemoryResourceManager();
+    }
+    
+    @After
+    public void after() {
+        resourceManager = null;
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void getEmptyReferenceParamsTest() {
+        resourceManager.get(new ReferenceParametersType());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void getUnknownReferenceParamsTest() {
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = DOMUtils.createDocument().createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent("123456");
+        refParams.getAny().add(uuid);
+        resourceManager.get(refParams);
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void putEmptyReferenceParamsTest() {
+        resourceManager.put(new ReferenceParametersType(), new Representation());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void putUnknownReferenceParamsTest() {
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = DOMUtils.createDocument().createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent("123456");
+        refParams.getAny().add(uuid);
+        resourceManager.put(refParams, new Representation());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void deleteEmptyReferenceParamsTest() {
+        resourceManager.delete(new ReferenceParametersType());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void deleteUnknownReferenceParamsTest() {
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = DOMUtils.createDocument().createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent("123456");
+        refParams.getAny().add(uuid);
+        resourceManager.delete(refParams);
+    }
+    
+    @Test
+    public void createTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        Assert.assertTrue("ResourceManager returned unexpected count of reference elements.",
+                refParams.getAny().size() == 1);
+    }
+    
+    @Test
+    public void getTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        Representation returnedRepresentation = resourceManager.get(refParams);
+        
+        Element returnedEl = (Element) returnedRepresentation.getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                ELEMENT_NAMESPACE, returnedEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                ELEMENT_NAME, returnedEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                ELEMENT_VALUE, returnedEl.getTextContent());
+    }
+    
+    @Test
+    public void putTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+        
+        Element representationElNew = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationElNew.setTextContent(ELEMENT_VALUE_NEW);
+        Representation representationNew = new Representation();
+        representationNew.setAny(representationElNew);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        resourceManager.put(refParams, representationNew);
+        Representation returnedRepresentation = resourceManager.get(refParams);
+        
+        Element returnedEl = (Element) returnedRepresentation.getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                ELEMENT_NAMESPACE, returnedEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                ELEMENT_NAME, returnedEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                ELEMENT_VALUE_NEW, returnedEl.getTextContent());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void deleteTest() {
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        resourceManager.delete(refParams);
+        resourceManager.get(refParams);
+    }
+    
+    @Test
+    public void createEmptyRepresentationTest() {
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Assert.assertTrue("ResourceManager returned unexpected count of reference elements.",
+                refParams.getAny().size() == 1);
+    }
+    
+    @Test
+    public void putEmptyRepresentationTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        resourceManager.put(refParams, new Representation());
+    }
+    
+    @Test
+    public void getEmptyRepresentationTest() {
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Representation returnedRepresentation = resourceManager.get(refParams);
+        Assert.assertNull(returnedRepresentation.getAny());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java
new file mode 100644
index 0000000..45af31f
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.cxf.ws.transfer.unit;
+
+import java.io.InputStream;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.validationtransformation.XSDResourceValidator;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class XSDResourceValidatorTest {
+    
+
+    private Representation loadRepresentation(InputStream input) throws XMLStreamException {
+        Document doc = StaxUtils.read(input);
+        Representation representation = new Representation();
+        representation.setAny(doc.getDocumentElement());
+        return representation;
+    }
+    
+    @Test
+    public void validRepresentationTest() throws XMLStreamException {
+        XSDResourceValidator validator = new XSDResourceValidator(
+                new StreamSource(getClass().getResourceAsStream("/xml/xsdresourcevalidator/schema.xsd")));
+        boolean result = validator.validate(loadRepresentation(
+                getClass().getResourceAsStream("/xml/xsdresourcevalidator/validRepresentation.xml")), null);
+        Assert.assertTrue(result);
+    }
+    
+    @Test
+    public void invalidRepresentationTest() throws XMLStreamException {
+        XSDResourceValidator validator = new XSDResourceValidator(
+                new StreamSource(getClass().getResourceAsStream("/xml/xsdresourcevalidator/schema.xsd")));
+        boolean result = validator.validate(loadRepresentation(
+                getClass().getResourceAsStream("/xml/xsdresourcevalidator/invalidRepresentation.xml")), null);
+        Assert.assertFalse(result);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java
new file mode 100644
index 0000000..f70b9c2
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.cxf.ws.transfer.unit;
+
+import java.io.InputStream;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceTransformer;
+import org.apache.cxf.ws.transfer.validationtransformation.XSLTResourceTransformer;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class XSLTResourceTransformerTest {
+    
+    private Representation loadRepresentation(InputStream input) throws XMLStreamException {
+        Document doc = StaxUtils.read(input);
+        Representation representation = new Representation();
+        representation.setAny(doc.getDocumentElement());
+        return representation;
+    }
+    
+    @Test
+    public void transformTest() throws XMLStreamException {
+        ResourceTransformer transformer = new XSLTResourceTransformer(new StreamSource(
+                getClass().getResourceAsStream("/xml/xsltresourcetransformer/stylesheet.xsl")));
+        Representation representation = loadRepresentation(
+                getClass().getResourceAsStream("/xml/xsltresourcetransformer/representation.xml"));
+        
+        transformer.transform(representation, null);
+
+        Element representationEl = (Element) representation.getAny();
+        Assert.assertEquals("Expected root element with name \"person\".", "person",
+                representationEl.getLocalName());
+        Assert.assertTrue("Expected one element \"firstname\".",
+                representationEl.getElementsByTagName("firstname").getLength() == 1);
+        Assert.assertTrue("Expected one element \"lastname\".",
+                representationEl.getElementsByTagName("lastname").getLength() == 1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml
new file mode 100644
index 0000000..52be6ce
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+
+
+<person>
+    <name>Name</name>
+    <surname>Surname</surname>
+</person>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd
new file mode 100644
index 0000000..6a0e7f5
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+  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 version="1.0"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:element name="person">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="name" type="xs:string"/>
+                <xs:element name="surname" type="xs:string"/>
+                <xs:element name="address" type="xs:string"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml
new file mode 100644
index 0000000..7d81e0f
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml
@@ -0,0 +1,27 @@
+<?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.
+-->
+
+
+<person>
+    <name>Name</name>
+    <surname>Surname</surname>
+    <address>Address</address>
+</person>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml
new file mode 100644
index 0000000..a472f3c
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+
+
+<person>
+    <name>Name</name>
+    <surname>Surname</surname>
+</person>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl
new file mode 100644
index 0000000..5519af8
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl
@@ -0,0 +1,43 @@
+<?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.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="/">
+        <xsl:element name="person">
+            <xsl:apply-templates/>
+        </xsl:element>
+    </xsl:template>
+   
+    <xsl:template match="/person/name">
+        <xsl:element name="firstname">
+            <xsl:value-of select="."/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="/person/surname">
+        <xsl:element name="lastname">
+            <xsl:value-of select="."/>
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/pom.xml
----------------------------------------------------------------------
diff --git a/systests/pom.xml b/systests/pom.xml
index b935926..3a5ba50 100644
--- a/systests/pom.xml
+++ b/systests/pom.xml
@@ -50,6 +50,7 @@
         <module>cdi</module>
         <module>rs-http-sci</module>
         <module>tracing</module>
-	<module>jibx</module>
+        <module>jibx</module>
+        <module>ws-transfer</module>
     </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/pom.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/pom.xml b/systests/ws-transfer/pom.xml
new file mode 100644
index 0000000..f032f51
--- /dev/null
+++ b/systests/ws-transfer/pom.xml
@@ -0,0 +1,61 @@
+<?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/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    
+    <artifactId>cxf-systests-ws-transfer</artifactId>
+    <name>Apache CXF WS-Transfer System Tests</name>
+    <description>Apache CXF WS-Transfer System Tests</description>
+    <url>http://cxf.apache.org</url>
+    
+    <parent>
+        <artifactId>cxf-parent</artifactId>
+        <groupId>org.apache.cxf</groupId>
+        <version>3.2.0-SNAPSHOT</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+    
+    <dependencies>
+        <dependency>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>${project.groupId}</groupId>
+          <artifactId>cxf-rt-frontend-jaxws</artifactId>
+          <version>${project.version}</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>${project.groupId}</groupId>
+          <artifactId>cxf-rt-ws-transfer</artifactId>
+          <version>${project.version}</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>${project.groupId}</groupId>
+          <artifactId>cxf-rt-transports-http-jetty</artifactId>
+          <version>${project.version}</version>
+          <scope>test</scope>
+        </dependency>
+    </dependencies>
+    
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java
new file mode 100644
index 0000000..2f9feaa
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java
@@ -0,0 +1,103 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CreateStudentTest {
+    
+    
+    @BeforeClass
+    public static void beforeClass() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void createStudentTest() throws XMLStreamException {
+        Document createStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudent.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_STUDENTS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+
+    @Test
+    public void createStudentPartialTest() throws XMLStreamException {
+        Document createStudentPartialXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudentPartial.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentPartialXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_STUDENTS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void createStudentWrongTest() throws XMLStreamException {
+        Document createStudentWrongXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudentWrong.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentWrongXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        rf.create(request);
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void createRandomTest() throws XMLStreamException {
+        Document randomXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/random.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(randomXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        rf.create(request);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java
new file mode 100644
index 0000000..9a67b9a
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java
@@ -0,0 +1,91 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CreateTeacherTest {
+    
+    @BeforeClass
+    public static void beforeClass() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void createTeacherTest() throws XMLStreamException {
+        Document createTeacherXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacher.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_TEACHERS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+
+    @Test
+    public void createTeacherPartialTest() throws XMLStreamException {
+        Document createTeacherPartialXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacherPartial.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherPartialXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_TEACHERS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void createTeacherWrongTest() throws XMLStreamException {
+        Document createTeacherWrongXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacherWrong.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherWrongXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        rf.create(request);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java
new file mode 100644
index 0000000..b25a944
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java
@@ -0,0 +1,118 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DeleteTest {
+    
+    @Before
+    public void before() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @After
+    public void after() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void deleteStudent() throws XMLStreamException {
+        CreateResponse response = createStudent();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void getDeletedStudent() throws XMLStreamException {
+        CreateResponse response = createStudent();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.get(new Get());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void deleteDeletedStudent() throws XMLStreamException {
+        CreateResponse response = createStudent();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.delete(new Delete());
+    }
+    
+    @Test
+    public void deleteTeacher() throws XMLStreamException {
+        CreateResponse response = createTeacher();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void getDeletedTeacher() throws XMLStreamException {
+        CreateResponse response = createTeacher();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.get(new Get());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void deleteDeletedTeacher() throws XMLStreamException {
+        CreateResponse response = createTeacher();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.delete(new Delete());
+    }
+    
+    private CreateResponse createStudent() throws XMLStreamException {
+        Document createStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudent.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+    
+    private CreateResponse createTeacher() throws XMLStreamException {
+        Document createTeacherXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacher.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java
new file mode 100644
index 0000000..65fdce7
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java
@@ -0,0 +1,111 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class GetTest {
+    
+    private static EndpointReferenceType studentRef;
+    
+    private static EndpointReferenceType teacherRef;
+    
+    @BeforeClass
+    public static void beforeClass() throws XMLStreamException {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        
+        Document createStudentXML = StaxUtils.read(
+                GetTest.class.getResourceAsStream("/xml/createStudent.xml"));
+        Create studentRequest = new Create();
+        studentRequest.setRepresentation(new Representation());
+        studentRequest.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        studentRef = rf.create(studentRequest).getResourceCreated();
+        
+        Document createTeacherXML = StaxUtils.read(
+                GetTest.class.getResourceAsStream("/xml/createTeacher.xml"));
+        Create teacherRequest = new Create();
+        teacherRequest.setRepresentation(new Representation());
+        teacherRequest.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        teacherRef = rf.create(teacherRequest).getResourceCreated();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void getStudentTest() {
+        Resource client = TestUtils.createResourceClient(studentRef);
+        GetResponse response = client.get(new Get());
+        
+        Element representation = (Element) response.getRepresentation().getAny();
+        NodeList children = representation.getChildNodes();
+        for (int i = 0; i < children.getLength(); i++) {
+            Element child = (Element) children.item(i);
+            if ("name".equals(child.getLocalName())) {
+                Assert.assertEquals("John", child.getTextContent());
+            } else if ("surname".equals(child.getLocalName())) {
+                Assert.assertEquals("Smith", child.getTextContent());
+            } else if ("address".equals(child.getLocalName())) {
+                Assert.assertEquals("Street 21", child.getTextContent());
+            }
+        }
+    }
+    
+    @Test
+    public void getTeacherTest() {
+        Resource client = TestUtils.createResourceClient(teacherRef);
+        GetResponse response = client.get(new Get());
+        
+        Element representation = (Element) response.getRepresentation().getAny();
+        NodeList children = representation.getChildNodes();
+        for (int i = 0; i < children.getLength(); i++) {
+            Element child = (Element) children.item(i);
+            if ("name".equals(child.getLocalName())) {
+                Assert.assertEquals("Bob", child.getTextContent());
+            } else if ("surname".equals(child.getLocalName())) {
+                Assert.assertEquals("Stuart", child.getTextContent());
+            } else if ("address".equals(child.getLocalName())) {
+                Assert.assertEquals("Street 526", child.getTextContent());
+            }
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java
new file mode 100644
index 0000000..ec906b6
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java
@@ -0,0 +1,129 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PutTest {
+    
+    @Before
+    public void before() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @After
+    public void after() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void rightStudentPutTest() throws XMLStreamException {
+        CreateResponse createResponse = createStudent();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putStudent.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void wrongStudentPutTest() throws XMLStreamException {
+        createStudent();
+        CreateResponse createResponse = createStudent();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putStudent.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    @Test
+    public void rightTeacherPutTest() throws XMLStreamException {
+        CreateResponse createResponse = createTeacher();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putTeacher.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void wrongTeacherPutTest() throws XMLStreamException {
+        createStudent();
+        CreateResponse createResponse = createTeacher();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putTeacher.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    private CreateResponse createStudent() throws XMLStreamException {
+        Document createStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudent.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+    
+    private CreateResponse createTeacher() throws XMLStreamException {
+        Document createTeacherXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacher.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java
new file mode 100644
index 0000000..90645d3
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java
@@ -0,0 +1,174 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingProvider;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.systest.ws.transfer.resolver.MyResourceResolver;
+import org.apache.cxf.systest.ws.transfer.validator.StudentPutResourceValidator;
+import org.apache.cxf.systest.ws.transfer.validator.TeacherResourceValidator;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resource.ResourceLocal;
+import org.apache.cxf.ws.transfer.resource.ResourceRemote;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactoryImpl;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+import org.apache.cxf.ws.transfer.validationtransformation.XSDResourceTypeIdentifier;
+import org.apache.cxf.ws.transfer.validationtransformation.XSLTResourceTransformer;
+
+/**
+ * Parent test for all tests in WS-Transfer System Tests.
+ */
+public final class TestUtils {
+    
+    public static final String RESOURCE_STUDENTS_URL = "http://localhost:8080/ResourceStudents";
+    
+    public static final String RESOURCE_FACTORY_URL = "http://localhost:8080/ResourceFactory";
+    
+    public static final String RESOURCE_TEACHERS_URL = "http://localhost:8081/ResourceTeachers";
+    
+    private static Server resourceFactoryServer;
+    
+    private static Server studentsResourceServer;
+    
+    private static Server teachersResourceFactoryServer;
+    
+    private static Server teachersResourceServer;
+    
+    private TestUtils() {
+        
+    }
+    
+    protected static ResourceFactory createResourceFactoryClient() {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setServiceClass(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_URL);
+        return (ResourceFactory) factory.create();
+    }
+    
+    protected static Resource createResourceClient(EndpointReferenceType ref) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(ref.getAddress().getValue());
+        Resource proxy = (Resource) factory.create();
+
+        // Add reference parameters
+        AddressingProperties addrProps = new AddressingProperties();
+        addrProps.setTo(ref);
+        ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
+
+        return proxy;
+    }
+    
+    protected static void createStudentsServers() {
+        UIDManager.reset();
+        ResourceManager studentsResourceManager = new MemoryResourceManager();
+        resourceFactoryServer = createResourceFactory(studentsResourceManager);
+        studentsResourceServer = createStudentsResource(studentsResourceManager);
+    }
+    
+    protected static void createTeachersServers() {
+        ResourceManager teachersResourceManager = new MemoryResourceManager();
+        ResourceRemote resource = new ResourceRemote();
+        resource.setManager(teachersResourceManager);
+        resource.getResourceTypeIdentifiers().add(new XSDResourceTypeIdentifier(
+                new StreamSource(TestUtils.class.getResourceAsStream("/schema/teacher.xsd")),
+                new XSLTResourceTransformer(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/xslt/teacherDefaultValues.xsl")),
+                        new TeacherResourceValidator())));
+        teachersResourceFactoryServer = createTeachersResourceFactoryEndpoint(resource);
+        teachersResourceServer = createTeacherResourceEndpoint(resource);
+    }
+    
+    protected static void destroyStudentsServers() {
+        resourceFactoryServer.destroy();
+        studentsResourceServer.destroy();
+    }
+    
+    protected static void destroyTeachersServers() {
+        teachersResourceFactoryServer.destroy();
+        teachersResourceServer.destroy();
+    }
+    
+    private static Server createResourceFactory(ResourceManager resourceManager) {
+        ResourceFactoryImpl resourceFactory = new ResourceFactoryImpl();
+        resourceFactory.setResourceResolver(
+                new MyResourceResolver(RESOURCE_STUDENTS_URL, resourceManager, RESOURCE_TEACHERS_URL));
+        resourceFactory.getResourceTypeIdentifiers().add(
+                new XSDResourceTypeIdentifier(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/schema/studentCreate.xsd")),
+                        new XSLTResourceTransformer(
+                                new StreamSource(TestUtils.class.getResourceAsStream("/xslt/studentCreate.xsl")))));
+        resourceFactory.getResourceTypeIdentifiers().add(
+                new XSDResourceTypeIdentifier(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/schema/teacherCreateBasic.xsd")),
+                        new XSLTResourceTransformer(
+                                new StreamSource(
+                                        TestUtils.class.getResourceAsStream("/xslt/teacherCreateBasic.xsl")))));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory.class);
+        factory.setServiceBean(resourceFactory);
+        factory.setAddress(RESOURCE_FACTORY_URL);
+        
+        return factory.create();
+    }
+    
+    private static Server createStudentsResource(ResourceManager resourceManager) {
+        ResourceLocal resourceLocal = new ResourceLocal();
+        resourceLocal.setManager(resourceManager);
+        resourceLocal.getResourceTypeIdentifiers().add(
+                new XSDResourceTypeIdentifier(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/schema/studentPut.xsd")),
+                        new XSLTResourceTransformer(
+                                new StreamSource(TestUtils.class.getResourceAsStream("/xslt/studentPut.xsl")),
+                                new StudentPutResourceValidator())));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(Resource.class);
+        factory.setServiceBean(resourceLocal);
+        factory.setAddress(RESOURCE_STUDENTS_URL);
+        return factory.create();
+    }
+    
+    private static Server createTeachersResourceFactoryEndpoint(ResourceRemote resource) {
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setServiceBean(resource);
+        factory.setAddress(RESOURCE_TEACHERS_URL + TransferConstants.RESOURCE_REMOTE_SUFFIX);
+        return factory.create();
+    }
+    
+    private static Server createTeacherResourceEndpoint(ResourceRemote resource) {
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(Resource.class);
+        factory.setServiceBean(resource);
+        factory.setAddress(RESOURCE_TEACHERS_URL);
+        return factory.create();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java
new file mode 100644
index 0000000..ea06312
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java
@@ -0,0 +1,40 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public final class UIDManager {
+    
+    private static final AtomicInteger UID = new AtomicInteger(1);
+    
+    private UIDManager() {
+        
+    }
+    
+    public static int getUID() {
+        return UID.getAndIncrement();
+    }
+    
+    public static void reset() {
+        UID.set(1);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java
new file mode 100644
index 0000000..54f4c16
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java
@@ -0,0 +1,55 @@
+/**
+ * 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.cxf.systest.ws.transfer.resolver;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceReference;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceResolver;
+import org.apache.cxf.ws.transfer.shared.faults.InvalidRepresentation;
+
+public class MyResourceResolver implements ResourceResolver {
+
+    protected String studentURL;
+    
+    protected ResourceManager studentManager;
+    
+    protected String teachersURL;
+    
+    public MyResourceResolver(String studentURL, ResourceManager studentManager, String teachersURL) {
+        this.studentURL = studentURL;
+        this.studentManager = studentManager;
+        this.teachersURL = teachersURL;
+    }
+    
+    @Override
+    public ResourceReference resolve(Create body) {
+        Element representationEl = (Element) body.getRepresentation().getAny();
+        if ("student".equals(representationEl.getLocalName())) {
+            return new ResourceReference(studentURL, studentManager);
+        } else if ("teacher".equals(representationEl.getLocalName())) {
+            return new ResourceReference(teachersURL, null);
+        } else {
+            throw new InvalidRepresentation();
+        }
+    }
+    
+}


[3/5] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

Posted by dk...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetQNameTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetQNameTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetQNameTest.java
new file mode 100644
index 0000000..9346dc7
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetQNameTest.java
@@ -0,0 +1,171 @@
+/**
+ * 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.cxf.ws.transfer.integration;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ObjectFactory;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentGetQNameTest extends IntegrationBaseTest {
+    
+    @Test
+    public void getTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
+        expression.getContent().add("a");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("a", ((Element)value.getContent().get(0)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getWithNamespaceTest() throws XMLStreamException {
+        String content = "<ns:root xmlns:ns=\"www.example.org\"><ns:a><ns:b>Text</ns:b></ns:a></ns:root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
+        expression.getContent().add("ns:a");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("a", ((Element)value.getContent().get(0)).getLocalName());
+        Assert.assertEquals("www.example.org", ((Element)value.getContent().get(0)).getNamespaceURI());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void qetEmptyResultTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
+        expression.getContent().add("c");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(0, value.getContent().size());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getMoreValuesTest() throws XMLStreamException {
+        String content = "<root><b>Text1</b><b>Text2</b><b>Text3</b></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
+        expression.getContent().add("b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(3, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        Assert.assertEquals("b", ((Element)value.getContent().get(1)).getLocalName());
+        Assert.assertEquals("b", ((Element)value.getContent().get(2)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void getWrongQNameTest() throws XMLStreamException {
+        String content = "<root><a><b>Text1</b><b>Text2</b><b>Text3</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
+        expression.getContent().add("//b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        client.get(request);
+    }
+    
+    private static ValueType getValue(GetResponse response) {
+        @SuppressWarnings("unchecked")
+        JAXBElement<ValueType> jaxb = (JAXBElement<ValueType>) response.getAny().get(0);
+        return jaxb.getValue();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetXPath10Test.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetXPath10Test.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetXPath10Test.java
new file mode 100644
index 0000000..56f8291
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentGetXPath10Test.java
@@ -0,0 +1,333 @@
+/**
+ * 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.cxf.ws.transfer.integration;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.stream.XMLStreamException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ObjectFactory;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentGetXPath10Test extends IntegrationBaseTest {
+    
+    @Test
+    public void getTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a/b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getImpliedLanguageTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.getContent().add("/root/a/b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getWithNamespaceTest() throws XMLStreamException {
+        String content = "<ns:root xmlns:ns=\"www.example.org\"><ns:a><ns:b>Text</ns:b></ns:a></ns:root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/ns:root/ns:a/ns:b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        Assert.assertEquals("www.example.org", ((Element)value.getContent().get(0)).getNamespaceURI());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void qetEmptyResultTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("//c");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(0, value.getContent().size());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getMoreValuesTest() throws XMLStreamException {
+        String content = "<root><a><b>Text1</b><b>Text2</b><b>Text3</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("//b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(3, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        Assert.assertEquals("b", ((Element)value.getContent().get(1)).getLocalName());
+        Assert.assertEquals("b", ((Element)value.getContent().get(2)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getMoreValues2Test() throws XMLStreamException {
+        String content = "<root><a><b>Text1</b><b>Text2</b><b><b>Text3</b></b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("//b");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("b", ((Element)value.getContent().get(0)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getAttrTest() throws XMLStreamException {
+        String content = "<root><a><b attr1=\"value1\">Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a/b/@attr1");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertTrue(value.getContent().get(0) instanceof Element);
+        Element attrEl = (Element) value.getContent().get(0);
+        Assert.assertEquals(FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME, attrEl.getLocalName());
+        Assert.assertEquals(FragmentDialectConstants.FRAGMENT_2011_03_IRI, attrEl.getNamespaceURI());
+        Assert.assertEquals("attr1", attrEl.getAttribute(FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR));
+        Assert.assertEquals("value1", attrEl.getTextContent());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getAttrNSTest() throws XMLStreamException {
+        String content = "<root xmlns:ns=\"www.example.org\"><a><b ns:attr1=\"value1\">Text</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a/b/@ns:attr1");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertTrue(value.getContent().get(0) instanceof Element);
+        Element attrEl = (Element) value.getContent().get(0);
+        Assert.assertEquals(FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME, attrEl.getLocalName());
+        Assert.assertEquals(FragmentDialectConstants.FRAGMENT_2011_03_IRI, attrEl.getNamespaceURI());
+        Assert.assertEquals("ns:attr1", attrEl.getAttribute(FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR));
+        Assert.assertEquals("value1", attrEl.getTextContent());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getNumberTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b><b>Text2</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("count(//b)");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("2", value.getContent().get(0));
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getBooleanTrueTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b><b>Text2</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("count(//b) = 2");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("true", value.getContent().get(0));
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void getBooleanFalseTest() throws XMLStreamException {
+        String content = "<root><a><b>Text</b><b>Text2</b></a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+
+        ObjectFactory objectFactory = new ObjectFactory();
+        
+        Get request = new Get();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("count(//b) != 2");
+        request.getAny().add(objectFactory.createExpression(expression));
+        
+        GetResponse response = client.get(request);
+        ValueType value = getValue(response);
+        Assert.assertEquals(1, value.getContent().size());
+        Assert.assertEquals("false", value.getContent().get(0));
+        
+        resource.destroy();
+    }
+    
+    private static ValueType getValue(GetResponse response) {
+        @SuppressWarnings("unchecked")
+        JAXBElement<ValueType> jaxb = (JAXBElement<ValueType>) response.getAny().get(0);
+        return jaxb.getValue();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutAddTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutAddTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutAddTest.java
new file mode 100644
index 0000000..e971794
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutAddTest.java
@@ -0,0 +1,238 @@
+/**
+ * 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.cxf.ws.transfer.integration;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.Fragment;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentPutAddTest extends IntegrationBaseTest {
+    
+    @Test
+    public void addToEmptyDocumentTest() {
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("a");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void addToNonEmptyDocumentTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void addTextElementTest() throws XMLStreamException {
+        String content = "<a>f</a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/a");
+        ValueType value = new ValueType();
+        value.getContent().add("oo");
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("foo", rootEl.getTextContent());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void addAttributeTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/a");
+
+        Document doc = DOMUtils.createDocument();
+        Element addedAttr = doc.createElementNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME
+        );
+        addedAttr.setAttributeNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR,
+                "foo"
+        );
+        addedAttr.setTextContent("1");
+        ValueType value = new ValueType();
+        value.getContent().add(addedAttr);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element aEl = (Element) response.getRepresentation().getAny();
+        String attribute = aEl.getAttribute("foo");
+        Assert.assertEquals("1", attribute);
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void addExistingAttributeTest() throws XMLStreamException {
+        String content = "<a foo=\"1\"/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/a");
+
+        Document doc = DOMUtils.createDocument();
+        Element addedAttr = doc.createElementNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME
+        );
+        addedAttr.setAttributeNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR,
+                "foo"
+        );
+        addedAttr.setTextContent("2");
+        ValueType value = new ValueType();
+        value.getContent().add(addedAttr);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void addSiblingTest() throws XMLStreamException {
+        String content = "<a><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_ADD);
+        expression.getContent().add("/a");
+        Element addedElement = DOMUtils.createDocument().createElement("c");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element child0 = (Element) rootEl.getChildNodes().item(0);
+        Element child1 = (Element) rootEl.getChildNodes().item(1);
+        Assert.assertEquals("a", rootEl.getNodeName());
+        Assert.assertEquals("b", child0.getNodeName());
+        Assert.assertEquals("c", child1.getNodeName());
+        
+        resource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertAfterTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertAfterTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertAfterTest.java
new file mode 100644
index 0000000..57e5ed1
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertAfterTest.java
@@ -0,0 +1,194 @@
+/**
+ * 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.cxf.ws.transfer.integration;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.Fragment;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentPutInsertAfterTest extends IntegrationBaseTest {
+    
+    @Test
+    public void insertAfter1Test() throws XMLStreamException {
+        String content = "<a><b/><c/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER);
+        expression.getContent().add("/a/b");
+        Element addedElement = DOMUtils.createDocument().createElement("d");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element child0 = (Element) rootEl.getChildNodes().item(0);
+        Element child1 = (Element) rootEl.getChildNodes().item(1);
+        Element child2 = (Element) rootEl.getChildNodes().item(2);
+        Assert.assertEquals("a", rootEl.getNodeName());
+        Assert.assertEquals("b", child0.getNodeName());
+        Assert.assertEquals("d", child1.getNodeName());
+        Assert.assertEquals("c", child2.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void insertAfter2Test() throws XMLStreamException {
+        String content = "<a><b/><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER);
+        expression.getContent().add("/a/b[last()]");
+        Element addedElement = DOMUtils.createDocument().createElement("c");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element child0 = (Element) rootEl.getChildNodes().item(0);
+        Element child1 = (Element) rootEl.getChildNodes().item(1);
+        Element child2 = (Element) rootEl.getChildNodes().item(2);
+        Assert.assertEquals("a", rootEl.getNodeName());
+        Assert.assertEquals("b", child0.getNodeName());
+        Assert.assertEquals("b", child1.getNodeName());
+        Assert.assertEquals("c", child2.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void insertAfterEmptyDocTest() {
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("a");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void insertAfterRootTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void insertAfterAttrTest() throws XMLStreamException {
+        String content = "<a foo=\"1\"/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_AFTER);
+        expression.getContent().add("/a/@foo");
+        Element addedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertBeforeTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertBeforeTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertBeforeTest.java
new file mode 100644
index 0000000..4ff59c9
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutInsertBeforeTest.java
@@ -0,0 +1,194 @@
+/**
+ * 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.cxf.ws.transfer.integration;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.Fragment;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentPutInsertBeforeTest extends IntegrationBaseTest {
+    
+    @Test
+    public void insertBefore1Test() throws XMLStreamException {
+        String content = "<a><b/><c/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE);
+        expression.getContent().add("/a/b");
+        Element addedElement = DOMUtils.createDocument().createElement("d");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element child0 = (Element) rootEl.getChildNodes().item(0);
+        Element child1 = (Element) rootEl.getChildNodes().item(1);
+        Element child2 = (Element) rootEl.getChildNodes().item(2);
+        Assert.assertEquals("a", rootEl.getNodeName());
+        Assert.assertEquals("d", child0.getNodeName());
+        Assert.assertEquals("b", child1.getNodeName());
+        Assert.assertEquals("c", child2.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void insertBefore2Test() throws XMLStreamException {
+        String content = "<a><b/><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE);
+        expression.getContent().add("/a/b[1]");
+        Element addedElement = DOMUtils.createDocument().createElement("c");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element child0 = (Element) rootEl.getChildNodes().item(0);
+        Element child1 = (Element) rootEl.getChildNodes().item(1);
+        Element child2 = (Element) rootEl.getChildNodes().item(2);
+        Assert.assertEquals("a", rootEl.getNodeName());
+        Assert.assertEquals("c", child0.getNodeName());
+        Assert.assertEquals("b", child1.getNodeName());
+        Assert.assertEquals("b", child2.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void insertBeforeEmptyDocTest() {
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("a");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void insertBeforeRootTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE);
+        expression.getContent().add("/");
+        Element addedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void insertBeforeAttrTest() throws XMLStreamException {
+        String content = "<a foo=\"1\"/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_INSERT_BEFORE);
+        expression.getContent().add("/a/@f");
+        Element addedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(addedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        client.put(request);
+        
+        resource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutRemoveTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutRemoveTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutRemoveTest.java
new file mode 100644
index 0000000..2523011
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutRemoveTest.java
@@ -0,0 +1,113 @@
+/**
+ * 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.cxf.ws.transfer.integration;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.Fragment;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentPutRemoveTest extends IntegrationBaseTest {
+    
+    @Test
+    public void removeAttrTest() throws XMLStreamException {
+        String content = "<a foo=\"1\"/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_REMOVE);
+        expression.getContent().add("/a/@foo");
+        fragment.setExpression(expression);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertNull(rootEl.getAttributeNode("foo"));
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void removeElementTest() throws XMLStreamException {
+        String content = "<a><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_REMOVE);
+        expression.getContent().add("/a/b");
+        fragment.setExpression(expression);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals(0, rootEl.getChildNodes().getLength());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void removeElement2Test() throws XMLStreamException {
+        String content = "<a><b/><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.setMode(FragmentDialectConstants.FRAGMENT_MODE_REMOVE);
+        expression.getContent().add("/a/b[1]");
+        fragment.setExpression(expression);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals(1, rootEl.getChildNodes().getLength());
+        
+        resource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutReplaceTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutReplaceTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutReplaceTest.java
new file mode 100644
index 0000000..b2b8072
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/FragmentPutReplaceTest.java
@@ -0,0 +1,419 @@
+/**
+ * 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.cxf.ws.transfer.integration;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.dialect.fragment.Fragment;
+import org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialectConstants;
+import org.apache.cxf.ws.transfer.dialect.fragment.ValueType;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FragmentPutReplaceTest extends IntegrationBaseTest {
+    
+    @Test
+    public void replaceElementTest() throws XMLStreamException {
+        String content = "<root><a>Text</a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        replacedElement.setTextContent("Better text");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("b", rootEl.getChildNodes().item(0).getNodeName());
+        Assert.assertEquals("Better text", rootEl.getChildNodes().item(0).getTextContent());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceElement2Test() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("b", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceTextContentTest() throws XMLStreamException {
+        String content = "<root><a>Text</a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        //ObjectFactory objectFactory = new ObjectFactory();
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a/text()");
+        ValueType value = new ValueType();
+        value.getContent().add("Better text");
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getChildNodes().item(0).getNodeName());
+        Assert.assertEquals("Better text", rootEl.getChildNodes().item(0).getTextContent());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceAttributeTest() throws XMLStreamException {
+        String content = "<root><a foo=\"1\">Text</a></root>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/root/a/@foo");
+        Element replacedAttr = DOMUtils.createDocument().createElementNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME
+        );
+        replacedAttr.setAttributeNS(
+                FragmentDialectConstants.FRAGMENT_2011_03_IRI,
+                FragmentDialectConstants.FRAGMENT_ATTR_NODE_NAME_ATTR,
+                "bar"
+        );
+        replacedAttr.setTextContent("2");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedAttr);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Element aEl = (Element) rootEl.getChildNodes().item(0);
+        Assert.assertNotNull(aEl);
+        String attribute = aEl.getAttribute("bar");
+        Assert.assertEquals("2", attribute);
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceEmptyDocumentTest() {
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/");
+        Element replacedElement = DOMUtils.createDocument().createElement("a");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceDocumentTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("b", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceDocument2Test() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/*");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("b", rootEl.getNodeName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceOneElementTest() throws XMLStreamException {
+        String content = "<a><b/><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a/b[1]");
+        Element replacedElement = DOMUtils.createDocument().createElement("c");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("c", ((Element)rootEl.getChildNodes().item(0)).getLocalName());
+        Assert.assertEquals("b", ((Element)rootEl.getChildNodes().item(1)).getLocalName());
+        
+        resource.destroy();
+    }
+    
+    @Test
+    public void replaceAllElementsTest() throws XMLStreamException {
+        String content = "<a><b/><b/></a>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+        
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a/b");
+        Element replacedElement = DOMUtils.createDocument().createElement("c");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+        
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals(1, rootEl.getChildNodes().getLength());
+        Assert.assertEquals("c", ((Element)rootEl.getChildNodes().item(0)).getLocalName());
+        
+        resource.destroy();
+    }
+
+    @Test
+    public  void replaceNonExistingElementTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a/b");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals(1, rootEl.getChildNodes().getLength());
+        Assert.assertEquals("b", ((Element)rootEl.getChildNodes().item(0)).getLocalName());
+
+        resource.destroy();
+    }
+
+    @Test
+    public  void replaceNonExistingRootTest() {
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a");
+        Element replacedElement = DOMUtils.createDocument().createElement("a");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+
+        PutResponse response = client.put(request);
+        Element rootEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("a", rootEl.getLocalName());
+
+        resource.destroy();
+    }
+
+    @Test(expected = SOAPFaultException.class)
+    public  void replaceNonExistingElementFailTest() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("//b");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+
+        client.put(request);
+
+        resource.destroy();
+    }
+
+    @Test(expected = SOAPFaultException.class)
+    public  void replaceNonExistingElementFail2Test() throws XMLStreamException {
+        String content = "<a/>";
+        ResourceManager resourceManager = new MemoryResourceManager();
+        ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
+        Server resource = createLocalResource(resourceManager);
+        Resource client = createClient(refParams);
+
+        Put request = new Put();
+        request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
+        Fragment fragment = new Fragment();
+        ExpressionType expression = new ExpressionType();
+        expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
+        expression.getContent().add("/a/[local-name() = 'b'");
+        Element replacedElement = DOMUtils.createDocument().createElement("b");
+        ValueType value = new ValueType();
+        value.getContent().add(replacedElement);
+        fragment.setExpression(expression);
+        fragment.setValue(value);
+        request.getAny().add(fragment);
+
+        client.put(request);
+
+        resource.destroy();
+    }
+}