ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1607986 - in /webservices/axiom/trunk: ./ axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/ axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ testsuites/spring-ws-testsuite/ testsuites/spring-ws-testsuite/src/main...
Date Sat, 05 Jul 2014 09:31:19 GMT
Author: veithen
Date: Sat Jul  5 09:31:18 2014
New Revision: 1607986

URL: http://svn.apache.org/r1607986
Log:
AXIOM-447 - Iteration 9: Add a simple WSS4J scenario and make it work with DOOM.

Added:
    webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/
    webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/EchoEndpoint.java
  (with props)
    webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/SecureEchoTest.java
  (with props)
    webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/
    webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/client.xml
  (with props)
    webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/server.xml
  (with props)
Modified:
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/LLOMSpringWSTest.java
    webservices/axiom/trunk/pom.xml
    webservices/axiom/trunk/testsuites/spring-ws-testsuite/pom.xml
    webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SpringWSTestSuiteBuilder.java

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderImpl.java?rev=1607986&r1=1607985&r2=1607986&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderImpl.java
(original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderImpl.java
Sat Jul  5 09:31:18 2014
@@ -25,6 +25,7 @@ import java.util.List;
 import javax.xml.namespace.QName;
 import javax.xml.transform.Result;
 
+import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.RolePlayer;
 import org.apache.axiom.soap.SOAPHeader;
 import org.springframework.ws.soap.SoapHeader;
@@ -44,9 +45,11 @@ abstract class SoapHeaderImpl extends So
         return new SoapHeaderElementImpl(getMessage(), axiomNode.addHeaderBlock(name));
     }
 
-    public void removeHeaderElement(QName name) throws SoapHeaderException {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+    public final void removeHeaderElement(QName name) throws SoapHeaderException {
+        OMElement element = axiomNode.getFirstChildWithName(name);
+        if (element != null) {
+            element.detach();
+        }
     }
 
     public Iterator<SoapHeaderElement> examineMustUnderstandHeaderElements(String actorOrRole)
throws SoapHeaderException {

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java?rev=1607986&r1=1607985&r2=1607986&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java
(original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java
Sat Jul  5 09:31:18 2014
@@ -51,7 +51,7 @@ import org.w3c.dom.Document;
 final class SoapMessageImpl extends AbstractSoapMessage implements AxiomWebServiceMessage
{
     private static final Log log = LogFactory.getLog(SoapMessageImpl.class);
     
-    private final SOAPMessage axiomMessage;
+    private SOAPMessage axiomMessage;
     private final SourceExtractionStrategyStack extractionStrategyStack = new SourceExtractionStrategyStack();
     private SoapEnvelopeImpl envelope;
     
@@ -81,13 +81,21 @@ final class SoapMessageImpl extends Abst
     }
 
     public Document getDocument() {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+        if (axiomMessage instanceof Document) {
+            return (Document)axiomMessage;
+        } else {
+            // TODO Auto-generated method stub
+            throw new UnsupportedOperationException();
+        }
     }
 
     public void setDocument(Document document) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+        if (document instanceof SOAPMessage) {
+            axiomMessage = (SOAPMessage)document;
+        } else {
+            // TODO Auto-generated method stub
+            throw new UnsupportedOperationException();
+        }
     }
 
     public boolean isXopPackage() {

Modified: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/LLOMSpringWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/LLOMSpringWSTest.java?rev=1607986&r1=1607985&r2=1607986&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/LLOMSpringWSTest.java
(original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/LLOMSpringWSTest.java
Sat Jul  5 09:31:18 2014
@@ -22,6 +22,7 @@ import org.apache.axiom.om.OMAbstractFac
 import org.apache.axiom.ts.springws.MessageFactoryConfigurator;
 import org.apache.axiom.ts.springws.SpringWSTestSuiteBuilder;
 import org.apache.axiom.ts.springws.scenario.broker.BrokerScenarioTest;
+import org.apache.axiom.ts.springws.scenario.secureecho.SecureEchoTest;
 import org.apache.axiom.ts.springws.scenario.validation.ValidationTest;
 
 import junit.framework.TestCase;
@@ -33,6 +34,7 @@ public class LLOMSpringWSTest extends Te
         
         builder.exclude(BrokerScenarioTest.class);
         builder.exclude(ValidationTest.class);
+        builder.exclude(SecureEchoTest.class);
         
         return builder.build();
     }

Modified: webservices/axiom/trunk/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/pom.xml?rev=1607986&r1=1607985&r2=1607986&view=diff
==============================================================================
--- webservices/axiom/trunk/pom.xml (original)
+++ webservices/axiom/trunk/pom.xml Sat Jul  5 09:31:18 2014
@@ -366,6 +366,11 @@
                 <artifactId>spring-ws-core</artifactId>
                 <version>2.2.0.RELEASE</version>
             </dependency>
+            <dependency>
+                <groupId>org.springframework.ws</groupId>
+                <artifactId>spring-ws-security</artifactId>
+                <version>2.2.0.RELEASE</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     <properties>

Modified: webservices/axiom/trunk/testsuites/spring-ws-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/spring-ws-testsuite/pom.xml?rev=1607986&r1=1607985&r2=1607986&view=diff
==============================================================================
--- webservices/axiom/trunk/testsuites/spring-ws-testsuite/pom.xml (original)
+++ webservices/axiom/trunk/testsuites/spring-ws-testsuite/pom.xml Sat Jul  5 09:31:18 2014
@@ -89,6 +89,15 @@
             <version>1.2</version>
         </dependency>
         <dependency>
+            <groupId>org.springframework.ws</groupId>
+            <artifactId>spring-ws-security</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ws.security</groupId>
+            <artifactId>wss4j</artifactId>
+            <version>1.6.15</version>
+        </dependency>
+        <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
             <scope>test</scope>

Modified: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SpringWSTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SpringWSTestSuiteBuilder.java?rev=1607986&r1=1607985&r2=1607986&view=diff
==============================================================================
--- webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SpringWSTestSuiteBuilder.java
(original)
+++ webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SpringWSTestSuiteBuilder.java
Sat Jul  5 09:31:18 2014
@@ -25,6 +25,7 @@ import org.apache.axiom.ts.springws.scen
 import org.apache.axiom.ts.springws.scenario.castor.CastorTest;
 import org.apache.axiom.ts.springws.scenario.jaxb2.JAXB2Test;
 import org.apache.axiom.ts.springws.scenario.jdom.ClientServerTest;
+import org.apache.axiom.ts.springws.scenario.secureecho.SecureEchoTest;
 import org.apache.axiom.ts.springws.scenario.validation.ValidationTest;
 import org.apache.axiom.ts.springws.scenario.wsadom.WSAddressingDOMTest;
 import org.apache.axiom.ts.springws.soap.messagefactory.TestCreateWebServiceMessage;
@@ -64,5 +65,6 @@ public class SpringWSTestSuiteBuilder ex
         addTest(new CastorTest(config, spec));
         addTest(new BrokerScenarioTest(config, spec));
         addTest(new ValidationTest(config, spec));
+        addTest(new SecureEchoTest(config, spec));
     }
 }

Added: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/EchoEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/EchoEndpoint.java?rev=1607986&view=auto
==============================================================================
--- webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/EchoEndpoint.java
(added)
+++ webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/EchoEndpoint.java
Sat Jul  5 09:31:18 2014
@@ -0,0 +1,34 @@
+/*
+ * 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.axiom.ts.springws.scenario.secureecho;
+
+import org.springframework.ws.server.endpoint.annotation.Endpoint;
+import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
+import org.springframework.ws.server.endpoint.annotation.RequestPayload;
+import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
+import org.w3c.dom.Element;
+
+@Endpoint
+public class EchoEndpoint {
+    @PayloadRoot(namespace="urn:test", localPart="Echo")
+    @ResponsePayload
+    public Element echo(@RequestPayload Element request) {
+        return request;
+    }
+}
\ No newline at end of file

Propchange: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/EchoEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/SecureEchoTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/SecureEchoTest.java?rev=1607986&view=auto
==============================================================================
--- webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/SecureEchoTest.java
(added)
+++ webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/SecureEchoTest.java
Sat Jul  5 09:31:18 2014
@@ -0,0 +1,52 @@
+/*
+ * 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.axiom.ts.springws.scenario.secureecho;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.springws.scenario.ScenarioConfig;
+import org.apache.axiom.ts.springws.scenario.ScenarioTestCase;
+import org.springframework.ws.client.core.WebServiceTemplate;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class SecureEchoTest extends ScenarioTestCase {
+    public SecureEchoTest(ScenarioConfig config, SOAPSpec spec) {
+        super(config, spec);
+    }
+    
+    @Override
+    protected void runTest() throws Throwable {
+        DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+        Document requestDocument = documentBuilder.newDocument();
+        Element request = requestDocument.createElementNS("urn:test", "p:Echo");
+        request.setTextContent("Hello");
+        Document responseDocument = documentBuilder.newDocument();
+        context.getBean(WebServiceTemplate.class).sendSourceAndReceiveToResult(
+                new DOMSource(request), new DOMResult(responseDocument));
+        Element response = responseDocument.getDocumentElement();
+        assertEquals("urn:test", response.getNamespaceURI());
+        assertEquals("Echo", response.getLocalName());
+        assertEquals("Hello", response.getTextContent());
+    }
+}

Propchange: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/scenario/secureecho/SecureEchoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/client.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/client.xml?rev=1607986&view=auto
==============================================================================
--- webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/client.xml
(added)
+++ webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/client.xml
Sat Jul  5 09:31:18 2014
@@ -0,0 +1,34 @@
+<?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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
+    <bean class="org.springframework.ws.client.core.WebServiceTemplate">
+        <constructor-arg ref="messageFactory"/>
+        <property name="defaultUri" value="http://localhost:${port}/"/>
+        <property name="interceptors">
+            <bean class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
+                <property name="securementActions" value="UsernameToken"/>
+                <property name="securementUsername" value="user1"/>
+                <property name="securementPassword" value="123456"/>
+            </bean>
+        </property>
+    </bean>
+</beans>

Propchange: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/client.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/server.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/server.xml?rev=1607986&view=auto
==============================================================================
--- webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/server.xml
(added)
+++ webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/server.xml
Sat Jul  5 09:31:18 2014
@@ -0,0 +1,44 @@
+<?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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:sws="http://www.springframework.org/schema/web-services"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
+         http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd">
+    <context:component-scan base-package="org.apache.axiom.ts.springws.scenario.secureecho"/>
+    <sws:annotation-driven/>
+    <sws:interceptors>
+        <bean class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
+            <property name="validationActions" value="UsernameToken"/>
+            <property name="validationCallbackHandler">
+                <bean class="org.springframework.ws.soap.security.wss4j.callback.SimplePasswordValidationCallbackHandler">
+                    <property name="users">
+                        <props>
+                            <prop key="user1">123456</prop>
+                        </props>
+                    </property>
+                </bean>
+            </property>
+        </bean>
+    </sws:interceptors>
+</beans>

Propchange: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/resources/org/apache/axiom/ts/springws/scenario/secureecho/server.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message