diff --git a/samples/pox/client/curl/client.sh b/samples/pox/client/curl/client.sh
new file mode 100755
index 00000000..1abc9004
--- /dev/null
+++ b/samples/pox/client/curl/client.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+curl --header "Content-type: application/xml" -v --data @contactsRequest.xml http://localhost:8080/pox/
diff --git a/samples/pox/client/curl/contactsRequest.xml b/samples/pox/client/curl/contactsRequest.xml
new file mode 100644
index 00000000..ad5fdc4f
--- /dev/null
+++ b/samples/pox/client/curl/contactsRequest.xml
@@ -0,0 +1,11 @@
+
+
+
+ John Doe
+ 626-555-3456
+
+
+ Jane Doe
+ 626-555-6543
+
+
\ No newline at end of file
diff --git a/samples/pox/client/spring-ws/build.xml b/samples/pox/client/spring-ws/build.xml
new file mode 100644
index 00000000..f1fa3e27
--- /dev/null
+++ b/samples/pox/client/spring-ws/build.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/pox/client/spring-ws/src/log4j.properties b/samples/pox/client/spring-ws/src/log4j.properties
new file mode 100644
index 00000000..0f73a758
--- /dev/null
+++ b/samples/pox/client/spring-ws/src/log4j.properties
@@ -0,0 +1,7 @@
+log4j.rootLogger=WARN, stdout
+log4j.logger.org.springframework.ws=DEBUG
+log4j.logger.org.springframework.xml=DEBUG
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
\ No newline at end of file
diff --git a/samples/pox/client/spring-ws/src/org/springframework/ws/samples/pox/client/sws/ContactsClient.java b/samples/pox/client/spring-ws/src/org/springframework/ws/samples/pox/client/sws/ContactsClient.java
new file mode 100644
index 00000000..a9d7972f
--- /dev/null
+++ b/samples/pox/client/spring-ws/src/org/springframework/ws/samples/pox/client/sws/ContactsClient.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2007 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.ws.samples.pox.client.sws;
+
+import java.io.IOException;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.core.io.Resource;
+import org.springframework.ws.WebServiceMessageFactory;
+import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
+import org.springframework.xml.transform.ResourceSource;
+import org.springframework.xml.transform.StringResult;
+import org.springframework.xml.xpath.XPathExpression;
+
+public class ContactsClient extends WebServiceGatewaySupport {
+
+ private Resource request;
+
+ private XPathExpression expression;
+
+ public ContactsClient(WebServiceMessageFactory messageFactory) {
+ super(messageFactory);
+ }
+
+ public void setRequest(Resource request) {
+ this.request = request;
+ }
+
+ public void setExpression(XPathExpression expression) {
+ this.expression = expression;
+ }
+
+ public void contacts() throws IOException {
+ Source requestSource = new ResourceSource(request);
+ DOMResult result = new DOMResult();
+ getWebServiceTemplate().sendSourceAndReceiveToResult(requestSource, result);
+ int contactCount = (int) expression.evaluateAsNumber(result.getNode());
+ System.out.println("contactCount = " + contactCount);
+ }
+
+ public static void main(String[] args) throws IOException {
+ ApplicationContext applicationContext =
+ new ClassPathXmlApplicationContext("applicationContext.xml", ContactsClient.class);
+ ContactsClient contactsClient = (ContactsClient) applicationContext.getBean("contactsClient");
+ contactsClient.contacts();
+ }
+}
diff --git a/samples/pox/client/spring-ws/src/org/springframework/ws/samples/pox/client/sws/applicationContext.xml b/samples/pox/client/spring-ws/src/org/springframework/ws/samples/pox/client/sws/applicationContext.xml
new file mode 100644
index 00000000..b76d5437
--- /dev/null
+++ b/samples/pox/client/spring-ws/src/org/springframework/ws/samples/pox/client/sws/applicationContext.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ http://www.springframework.org/spring-ws/samples/pox
+
+
+
+
+
+
diff --git a/samples/pox/client/spring-ws/src/org/springframework/ws/samples/pox/client/sws/contactsRequest.xml b/samples/pox/client/spring-ws/src/org/springframework/ws/samples/pox/client/sws/contactsRequest.xml
new file mode 100644
index 00000000..ad5fdc4f
--- /dev/null
+++ b/samples/pox/client/spring-ws/src/org/springframework/ws/samples/pox/client/sws/contactsRequest.xml
@@ -0,0 +1,11 @@
+
+
+
+ John Doe
+ 626-555-3456
+
+
+ Jane Doe
+ 626-555-6543
+
+
\ No newline at end of file
diff --git a/samples/pox/pom.xml b/samples/pox/pom.xml
new file mode 100644
index 00000000..3b9e69f7
--- /dev/null
+++ b/samples/pox/pom.xml
@@ -0,0 +1,50 @@
+
+
+ spring-ws-samples
+ org.springframework.ws
+ 1.5.0-rc1-SNAPSHOT
+
+ 4.0.0
+ pox
+ war
+ Spring WS POX Sample
+ A Spring-WS sample that uses Plain Old XML, rather than SOAP.
+
+
+ jdk14-jdk15
+
+ !1.6
+
+
+
+ stax
+ stax-api
+
+
+
+
+
+
+
+ maven-javadoc-plugin
+
+ ${basedir}/../../src/main/javadoc/javadoc.css
+
+
+
+
+
+
+
+ org.springframework.ws
+ spring-ws-core
+
+
+
+ easymock
+ easymock
+ 1.2_Java1.3
+ test
+
+
+
diff --git a/samples/pox/readme.txt b/samples/pox/readme.txt
new file mode 100644
index 00000000..3a69fa58
--- /dev/null
+++ b/samples/pox/readme.txt
@@ -0,0 +1,13 @@
+=========================================================
+== Spring Web Service Plain Old XML sample application ==
+=========================================================
+
+
+1. INTRODUCTION
+
+This sample shows a service that uses Plain Old XML rather than SOAP. Incoming
+messages are handled via SAX, and a response is created using DOM.
+
+2. INSTALLATION
+
+Simply run "mvn package" and deploy the war file generated in target
diff --git a/samples/pox/src/main/java/org/springframework/ws/samples/pox/ws/ContactCountEndpoint.java b/samples/pox/src/main/java/org/springframework/ws/samples/pox/ws/ContactCountEndpoint.java
new file mode 100644
index 00000000..5498f3ab
--- /dev/null
+++ b/samples/pox/src/main/java/org/springframework/ws/samples/pox/ws/ContactCountEndpoint.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.ws.samples.pox.ws;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import org.springframework.ws.server.endpoint.AbstractSaxPayloadEndpoint;
+
+public class ContactCountEndpoint extends AbstractSaxPayloadEndpoint {
+
+ private static final String NAMESPACE_URI = "http://www.springframework.org/spring-ws/samples/pox";
+
+ private static final String CONTANT_NAME = "Contact";
+
+ private static final String CONTANT_COUNT_NAME = "ContactCount";
+
+ private DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+
+ public ContactCountEndpoint() {
+ documentBuilderFactory.setNamespaceAware(true);
+ }
+
+ protected ContentHandler createContentHandler() throws Exception {
+ return new ContactCounter();
+ }
+
+ protected Source getResponse(ContentHandler contentHandler) throws Exception {
+ ContactCounter counter = (ContactCounter) contentHandler;
+
+ DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+ Document response = documentBuilder.newDocument();
+ Element contactCountElement = response.createElementNS(NAMESPACE_URI, CONTANT_COUNT_NAME);
+ response.appendChild(contactCountElement);
+ contactCountElement.setTextContent(Integer.toString(counter.contactCount));
+
+ return new DOMSource(response);
+ }
+
+ private static class ContactCounter extends DefaultHandler {
+
+ private int contactCount = 0;
+
+ public void startElement(String uri, String localName, String qName, Attributes attributes)
+ throws SAXException {
+ if (NAMESPACE_URI.equals(uri) && CONTANT_NAME.equals(localName)) {
+ contactCount++;
+ }
+ }
+
+
+ }
+}
diff --git a/samples/pox/src/main/resources/log4j.properties b/samples/pox/src/main/resources/log4j.properties
new file mode 100644
index 00000000..0f73a758
--- /dev/null
+++ b/samples/pox/src/main/resources/log4j.properties
@@ -0,0 +1,7 @@
+log4j.rootLogger=WARN, stdout
+log4j.logger.org.springframework.ws=DEBUG
+log4j.logger.org.springframework.xml=DEBUG
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
\ No newline at end of file
diff --git a/samples/pox/src/main/webapp/WEB-INF/contacts.xsd b/samples/pox/src/main/webapp/WEB-INF/contacts.xsd
new file mode 100644
index 00000000..857167b4
--- /dev/null
+++ b/samples/pox/src/main/webapp/WEB-INF/contacts.xsd
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ Defines a contact-list, with names and phone numbers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/pox/src/main/webapp/WEB-INF/spring-ws-servlet.xml b/samples/pox/src/main/webapp/WEB-INF/spring-ws-servlet.xml
new file mode 100755
index 00000000..9499118d
--- /dev/null
+++ b/samples/pox/src/main/webapp/WEB-INF/spring-ws-servlet.xml
@@ -0,0 +1,35 @@
+
+
+
+
+ This web application context contains Spring-WS beans. The beans defined in this context are automatically
+ detected by Spring-WS, similar to the way Controllers are picked up in Spring Web MVC.
+
+
+
+
+ This endpoint mapping uses the qualified name of the payload (body contents) to determine the endpoint for
+ an incoming message. Every message is passed to the default endpoint. Additionally, messages are logged
+ using the logging interceptor.
+
+
+
+
+
+
+
+ This interceptor validates both incoming and outgoing message contents according to the 'contacts.xsd' XML
+ Schema file.
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/pox/src/main/webapp/WEB-INF/web.xml b/samples/pox/src/main/webapp/WEB-INF/web.xml
new file mode 100755
index 00000000..2cd18033
--- /dev/null
+++ b/samples/pox/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ POX WebService
+
+ A Spring-WS sample that uses Plain Old XML, rather than SOAP.
+
+
+
+ spring-ws
+ org.springframework.ws.transport.http.MessageDispatcherServlet
+
+
+
+
+ spring-ws
+ /*
+
+
+
diff --git a/samples/pox/src/test/java/org/springframework/ws/samples/pox/ws/ContactCountEndpointTest.java b/samples/pox/src/test/java/org/springframework/ws/samples/pox/ws/ContactCountEndpointTest.java
new file mode 100644
index 00000000..78989e42
--- /dev/null
+++ b/samples/pox/src/test/java/org/springframework/ws/samples/pox/ws/ContactCountEndpointTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright ${YEAR} the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.ws.samples.pox.ws;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.stream.StreamResult;
+
+import org.springframework.ws.samples.pox.ws.ContactCountEndpoint;
+import org.springframework.xml.sax.SaxUtils;
+import org.springframework.core.io.ClassPathResource;
+
+import org.custommonkey.xmlunit.XMLTestCase;
+import org.w3c.dom.Document;
+
+public class ContactCountEndpointTest extends XMLTestCase {
+
+ private ContactCountEndpoint endpoint;
+
+ private Transformer transformer;
+
+ private DocumentBuilder documentBuilder;
+
+ protected void setUp() throws Exception {
+ endpoint = new ContactCountEndpoint();
+ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ documentBuilderFactory.setNamespaceAware(true);
+ documentBuilder = documentBuilderFactory.newDocumentBuilder();
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ transformer = transformerFactory.newTransformer();
+ }
+
+ public void testInvoke() throws Exception {
+ Document request = documentBuilder
+ .parse(SaxUtils.createInputSource(new ClassPathResource("contactsRequest.xml", getClass())));
+ Document expected = documentBuilder
+ .parse(SaxUtils.createInputSource(new ClassPathResource("contactCountResponse.xml", getClass())));
+
+ Source source = endpoint.invoke(new DOMSource(request));
+ DOMResult result = new DOMResult();
+ transformer.transform(source, result);
+ assertXMLEqual("Invalid resonse", expected, (Document) result.getNode());
+ }
+}
\ No newline at end of file
diff --git a/samples/pox/src/test/resources/org/springframework/ws/samples/pox/ws/contactCountResponse.xml b/samples/pox/src/test/resources/org/springframework/ws/samples/pox/ws/contactCountResponse.xml
new file mode 100644
index 00000000..524d381c
--- /dev/null
+++ b/samples/pox/src/test/resources/org/springframework/ws/samples/pox/ws/contactCountResponse.xml
@@ -0,0 +1,2 @@
+
+2
diff --git a/samples/pox/src/test/resources/org/springframework/ws/samples/pox/ws/contactsRequest.xml b/samples/pox/src/test/resources/org/springframework/ws/samples/pox/ws/contactsRequest.xml
new file mode 100644
index 00000000..ad5fdc4f
--- /dev/null
+++ b/samples/pox/src/test/resources/org/springframework/ws/samples/pox/ws/contactsRequest.xml
@@ -0,0 +1,11 @@
+
+
+
+ John Doe
+ 626-555-3456
+
+
+ Jane Doe
+ 626-555-6543
+
+
\ No newline at end of file