You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2008/09/23 18:09:39 UTC
svn commit: r698215 [2/2] - in
/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests: ./
wsa-common/ wsa-common/src/ wsa-common/src/main/ wsa-common/src/main/java/
wsa-common/src/main/java/org/ wsa-common/src/main/java/org/apache/ wsa-...
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/CalculatorBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/CalculatorBean.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/CalculatorBean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java Tue Sep 23 09:09:37 2008
@@ -0,0 +1,105 @@
+/**
+ * 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.geronimo.jaxws.test;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.xml.namespace.QName;
+import javax.xml.soap.Node;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import junit.framework.Assert;
+
+import org.w3c.dom.Element;
+
+public class CalculatorHandler implements SOAPHandler<SOAPMessageContext> {
+
+ @PostConstruct
+ public void init() {
+ System.out.println(this + " PostConstruct");
+ }
+
+ @PreDestroy
+ public void destroy() {
+ System.out.println(this + " PreDestroy");
+ }
+
+ public boolean handleMessage(SOAPMessageContext ctx) {
+ System.out.println(this + " handleMessage()");
+ boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ if (!outbound) {
+ SOAPMessage message = ctx.getMessage();
+ try {
+ SOAPBody body = message.getSOAPBody();
+ SOAPElement responseElem = CalculatorHandler.findElement(body, "multiply");
+ if (responseElem != null) {
+ CalculatorHandler.verifyReferenceParameter(ctx);
+ }
+ } catch (SOAPException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static SOAPElement findElement(SOAPElement rootElement, String name) {
+ Iterator iter = rootElement.getChildElements();
+ while(iter.hasNext()) {
+ Node node = (Node)iter.next();
+ if (node instanceof SOAPElement && node.getLocalName().equals(name)) {
+ return (SOAPElement)node;
+ }
+ }
+ return null;
+ }
+
+ public static void verifyReferenceParameter(MessageContext ctx) {
+ List<Element> rp = (List<Element>)ctx.get(MessageContext.REFERENCE_PARAMETERS);
+ Assert.assertNotNull(rp);
+ Assert.assertFalse(rp.isEmpty());
+ Assert.assertEquals("BarKey3", rp.get(0).getLocalName());
+ Assert.assertEquals("FooBar", rp.get(0).getFirstChild().getNodeValue());
+ }
+
+ public boolean handleFault(SOAPMessageContext smc) {
+ System.out.println(this + " handleFault()");
+ return true;
+ }
+
+ public void close(MessageContext messageContext) {
+ System.out.println(this + " close()");
+ }
+
+ public Set<QName> getHeaders(){
+ return null;
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml Tue Sep 23 09:09:37 2008
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
+ <jws:handler-chain>
+ <jws:handler>
+ <jws:handler-name>Handler</jws:handler-name>
+ <jws:handler-class>org.apache.geronimo.jaxws.test.CalculatorHandler</jws:handler-class>
+ </jws:handler>
+ </jws:handler-chain>
+</jws:handler-chains>
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/ejb-jar.xml?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/ejb-jar.xml (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/ejb-jar.xml Tue Sep 23 09:09:37 2008
@@ -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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+ <display-name>JJAX-WS WS-Addressing Test</display-name>
+
+ <enterprise-beans>
+ <session>
+ <display-name>CalculatorBeann</display-name>
+ <ejb-name>CalculatorBeann</ejb-name>
+ <ejb-class>org.apache.geronimo.jaxws.test.CalculatorBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+
+</ejb-jar>
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/openejb-jar.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/openejb-jar.xml?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/openejb-jar.xml (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/openejb-jar.xml Tue Sep 23 09:09:37 2008
@@ -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.
+-->
+<openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
+ xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1"
+ xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
+ xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
+
+ <environment>
+ <moduleId>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>${pom.artifactId}</artifactId>
+ <version>1.0</version>
+ <type>jar</type>
+ </moduleId>
+ </environment>
+
+</openejb-jar>
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/openejb-jar.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/openejb-jar.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-ejb/src/main/resources/META-INF/openejb-jar.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/pom.xml?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/pom.xml (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/pom.xml Tue Sep 23 09:09:37 2008
@@ -0,0 +1,66 @@
+<?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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.geronimo.testsuite</groupId>
+ <artifactId>jaxws-wsa-tests</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>wsa-war</artifactId>
+ <name>Geronimo TestSuite :: WebServices TestSuite :: JAX-WS WS-A WAR</name>
+ <packaging>war</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.testsuite</groupId>
+ <artifactId>wsa-common</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java Tue Sep 23 09:09:37 2008
@@ -0,0 +1,105 @@
+/**
+ * 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.geronimo.jaxws.test;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.xml.namespace.QName;
+import javax.xml.soap.Node;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import junit.framework.Assert;
+
+import org.w3c.dom.Element;
+
+public class CalculatorHandler implements SOAPHandler<SOAPMessageContext> {
+
+ @PostConstruct
+ public void init() {
+ System.out.println(this + " PostConstruct");
+ }
+
+ @PreDestroy
+ public void destroy() {
+ System.out.println(this + " PreDestroy");
+ }
+
+ public boolean handleMessage(SOAPMessageContext ctx) {
+ System.out.println(this + " handleMessage()");
+ boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ if (!outbound) {
+ SOAPMessage message = ctx.getMessage();
+ try {
+ SOAPBody body = message.getSOAPBody();
+ SOAPElement responseElem = CalculatorHandler.findElement(body, "multiply");
+ if (responseElem != null) {
+ CalculatorHandler.verifyReferenceParameter(ctx);
+ }
+ } catch (SOAPException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static SOAPElement findElement(SOAPElement rootElement, String name) {
+ Iterator iter = rootElement.getChildElements();
+ while(iter.hasNext()) {
+ Node node = (Node)iter.next();
+ if (node instanceof SOAPElement && node.getLocalName().equals(name)) {
+ return (SOAPElement)node;
+ }
+ }
+ return null;
+ }
+
+ public static void verifyReferenceParameter(MessageContext ctx) {
+ List<Element> rp = (List<Element>)ctx.get(MessageContext.REFERENCE_PARAMETERS);
+ Assert.assertNotNull(rp);
+ Assert.assertFalse(rp.isEmpty());
+ Assert.assertEquals("BarKey3", rp.get(0).getLocalName());
+ Assert.assertEquals("FooBar", rp.get(0).getFirstChild().getNodeValue());
+ }
+
+ public boolean handleFault(SOAPMessageContext smc) {
+ System.out.println(this + " handleFault()");
+ return true;
+ }
+
+ public void close(MessageContext messageContext) {
+ System.out.println(this + " close()");
+ }
+
+ public Set<QName> getHeaders(){
+ return null;
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorImpl.java?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorImpl.java (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorImpl.java Tue Sep 23 09:09:37 2008
@@ -0,0 +1,66 @@
+/**
+ * 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.geronimo.jaxws.test;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.soap.Addressing;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+@WebService(serviceName = "CalculatorService",
+ portName = "CalculatorPort",
+ name = "Calculator",
+ targetNamespace = "http://geronimo.apache.org/calculator")
+@Addressing(enabled = true, required = true)
+@HandlerChain(file="handlers.xml")
+public class CalculatorImpl {
+
+ @Resource
+ private WebServiceContext context;
+
+ public W3CEndpointReference getEPR() {
+ return (W3CEndpointReference)context.getEndpointReference();
+ }
+
+ public int add(int n1, int n2) {
+ return n1 + n2;
+ }
+
+ public int multiply(int n1, int n2) {
+ MessageContext ctx = context.getMessageContext();
+ CalculatorHandler.verifyReferenceParameter(ctx);
+ return n1 * n2;
+ }
+
+ @PostConstruct
+ private void myInit() {
+ System.out.println(this + " PostConstruct");
+ }
+
+ @PreDestroy()
+ private void myDestroy() {
+ System.out.println(this + " PreDestroy");
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/CalculatorImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml Tue Sep 23 09:09:37 2008
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
+ <jws:handler-chain>
+ <jws:handler>
+ <jws:handler-name>Handler</jws:handler-name>
+ <jws:handler-class>org.apache.geronimo.jaxws.test.CalculatorHandler</jws:handler-class>
+ </jws:handler>
+ </jws:handler-chain>
+</jws:handler-chains>
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/test/handlers.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServlet.java?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServlet.java (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServlet.java Tue Sep 23 09:09:37 2008
@@ -0,0 +1,297 @@
+/**
+ * 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.geronimo.jaxws.wsa;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.text.MessageFormat;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.soap.MTOMFeature;
+import javax.xml.ws.soap.SOAPFaultException;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+
+import junit.framework.Assert;
+
+import org.apache.geronimo.calculator.Calculator;
+import org.w3c.dom.Document;
+
+public abstract class TestServlet extends HttpServlet {
+
+ private static final QName PORT =
+ new QName("http://geronimo.apache.org/calculator", "CalculatorPort");
+
+ private static final QName SERVICE =
+ new QName("http://geronimo.apache.org/calculator", "CalculatorService");
+
+ private static final String BASE_ACTION =
+ "http://geronimo.apache.org/calculator/Calculator";
+
+ private static final String MULTIPLY_REQUEST_ACTION =
+ "http://geronimo.apache.org/calculator/Calculator/multiply";
+
+ private static final String REQUEST_ACTION =
+ "http://geronimo.apache.org/calculator/Calculator/add";
+
+ public static final String MSG1 =
+ "<?xml version=\"1.0\"?><S:Envelope " +
+ "xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+ "<S:Body>\n" +
+ "<p:add xmlns:p=\"http://geronimo.apache.org/calculator\">\n" +
+ " <arg0>10</arg0>\n" +
+ " <arg1>10</arg1>\n" +
+ "</p:add>\n" +
+ "</S:Body></S:Envelope>";
+
+ public static final String MSG2 =
+ "<?xml version=\"1.0\"?><S:Envelope " +
+ "xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
+ "xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">" +
+ "<S:Header>" +
+ "<wsa:To>{0}</wsa:To>\n" +
+ "<wsa:Action>{1}</wsa:Action>\n" +
+ "</S:Header>\n" +
+ "<S:Body>\n" +
+ "<p:add xmlns:p=\"http://geronimo.apache.org/calculator\">\n" +
+ " <arg0>{2}</arg0>\n" +
+ " <arg1>{2}</arg1>\n" +
+ "</p:add>\n" +
+ "</S:Body></S:Envelope>";
+
+ public static final String REF_PARAM =
+ "<foo3:BarKey3 xmlns:wsa=\"http://www.w3.org/2005/08/addressing\" wsa:IsReferenceParameter=\"1\" xmlns:foo3=\"http://geronimo.apache.org/calculator\">FooBar</foo3:BarKey3>\n";
+
+ public static final String MSG3 =
+ "<S:Envelope " +
+ "xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
+ "xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">" +
+ "<S:Header>\n" +
+ "<wsa:To>{0}</wsa:To>\n" +
+ "<wsa:Action>{1}</wsa:Action>\n" +
+ "<wsa:ReplyTo>\n" +
+ " <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>\n" +
+ " <wsa:ReferenceParameters>\n" +
+ " <foo1:BarKey1 xmlns:foo1=\"http://geronimo.apache.org/calculator\">FooBarReply</foo1:BarKey1>\n" +
+ " </wsa:ReferenceParameters>" +
+ "</wsa:ReplyTo>\n" +
+ "<wsa:FaultTo>\n" +
+ " <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>\n" +
+ " <wsa:ReferenceParameters>\n" +
+ " <foo2:BarKey2 xmlns:foo2=\"http://geronimo.apache.org/calculator\">FooBarFault</foo2:BarKey2>\n" +
+ " </wsa:ReferenceParameters>" +
+ "</wsa:FaultTo>\n" +
+ REF_PARAM +
+ "</S:Header>\n" +
+ "<S:Body>\n" +
+ "<p:multiply xmlns:p=\"http://geronimo.apache.org/calculator\">\n" +
+ " <arg0>{2}</arg0>\n" +
+ " <arg1>{2}</arg1>\n" +
+ "</p:multiply>\n" +
+ "</S:Body></S:Envelope>";
+
+ protected String address;
+
+ protected Service service;
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ String testName = request.getParameter("test");
+
+ System.out.println(testName);
+
+ if (testName == null || !testName.startsWith("test")) {
+ throw new ServletException("Invalid test name");
+ }
+
+ Method testMethod = null;
+ try {
+ testMethod = getClass().getMethod(testName, new Class [] {});
+ } catch (Exception e1) {
+ throw new ServletException("No such test: " + testName);
+ }
+
+ try {
+ testMethod.invoke(this, (Object[])null);
+ } catch (IllegalArgumentException e) {
+ throw new ServletException("Error invoking test: " + e.getMessage());
+ } catch (IllegalAccessException e) {
+ throw new ServletException("Error invoking test: " + e.getMessage());
+ } catch (InvocationTargetException e) {
+ Throwable root = e.getTargetException();
+ ServletException ex = new ServletException("Test '" + testName + "' failed");
+ ex.initCause(root);
+ throw ex;
+ }
+
+ response.setContentType("text/plain");
+ response.getWriter().println("Test '" + testName + "' passed");
+ }
+
+ public void testReferencePropertiesDispatch() throws Exception {
+ Dispatch<SOAPMessage> dispatch = null;
+ SOAPMessage request = null;
+ SOAPMessage response = null;
+
+ // test request and ReplyTo reference properties using Dispatch API
+ dispatch = service.createDispatch(PORT, SOAPMessage.class, Service.Mode.MESSAGE);
+ request = TestUtils.createMessage(MessageFormat.format(MSG3, address, MULTIPLY_REQUEST_ACTION, 5));
+ response = dispatch.invoke(request);
+ testMultiplyResponse(response, 25, false);
+ TestUtils.testReferenceProperties(response, "BarKey1", "FooBarReply");
+ }
+
+ public void testReferenceProperties() throws Exception {
+ // test request reference properties
+ W3CEndpointReferenceBuilder builder = createERPBuilder();
+ Document refParam = TestUtils.createDocument(REF_PARAM);
+ builder.referenceParameter(refParam.getDocumentElement());
+ EndpointReference epr = builder.build();
+
+ Calculator calc = service.getPort(epr, Calculator.class, new AddressingFeature());
+ Assert.assertEquals(36, calc.multiply(6, 6));
+ }
+
+ public void testDispatch() throws Exception {
+ Dispatch<SOAPMessage> dispatch = null;
+ SOAPMessage request = null;
+ SOAPMessage response = null;
+
+ // make a call without Addressing support
+ dispatch = service.createDispatch(PORT, SOAPMessage.class, Service.Mode.MESSAGE);
+ request = TestUtils.createMessage(MSG1);
+ try {
+ response = dispatch.invoke(request);
+ throw new ServletException("Did not throw exception");
+ } catch (SOAPFaultException e) {
+ // that's what we expect
+ }
+
+ // make a call with Addressing support
+ dispatch = service.createDispatch(PORT, SOAPMessage.class, Service.Mode.MESSAGE);
+ request = TestUtils.createMessage(MessageFormat.format(MSG2, address, REQUEST_ACTION, 5));
+ response = dispatch.invoke(request);
+ testAddResponse(response, 10, false);
+
+ // make a call with Addressing support and MTOM
+ dispatch = service.createDispatch(PORT, SOAPMessage.class, Service.Mode.MESSAGE, new MTOMFeature());
+ request = TestUtils.createMessage(MessageFormat.format(MSG2, address, REQUEST_ACTION, 10));
+ response = dispatch.invoke(request);
+ testAddResponse(response, 20, true);
+
+ EndpointReference epr = null;
+
+ // make a call with Addressing support using EPR
+ epr = createEPR();
+
+ service.createDispatch(epr, SOAPMessage.class, Service.Mode.MESSAGE);
+ request = TestUtils.createMessage(MessageFormat.format(MSG2, address, REQUEST_ACTION, 15));
+ response = dispatch.invoke(request);
+ testAddResponse(response, 30, false);
+
+ // make a call with Addressing support using EPR and MTOM
+ epr = createEPR();
+
+ service.createDispatch(epr, SOAPMessage.class, Service.Mode.MESSAGE, new MTOMFeature());
+ request = TestUtils.createMessage(MessageFormat.format(MSG2, address, REQUEST_ACTION, 20));
+ response = dispatch.invoke(request);
+ testAddResponse(response, 40, true);
+ }
+
+ public void testPort() throws Exception {
+ Calculator calc = null;
+
+ // make a call without AddressingFeature disabled
+ calc = service.getPort(Calculator.class);
+ try {
+ calc.add(1, 1);
+ throw new ServletException("Did not throw exception");
+ } catch (SOAPFaultException e) {
+ // that's what we expect
+ }
+
+ // make a call with AddressingFeature enabled
+ calc = service.getPort(Calculator.class, new AddressingFeature());
+ Assert.assertEquals(4, calc.add(2, 2));
+
+ // make a call with AddressingFeature enabled and port
+ calc = service.getPort(PORT, Calculator.class, new AddressingFeature());
+ Assert.assertEquals(6, calc.add(3, 3));
+
+ EndpointReference epr = null;
+
+ // make a call using EPR from Binding
+ epr = ((BindingProvider)calc).getEndpointReference();
+
+ calc = service.getPort(epr, Calculator.class, new AddressingFeature());
+ Assert.assertEquals(8, calc.add(4, 4));
+
+ // make a call using EPR from Service
+ epr = calc.getEPR();
+
+ calc = service.getPort(epr, Calculator.class, new AddressingFeature());
+ Assert.assertEquals(10, calc.add(5, 5));
+
+ // make a call using created EPR
+ epr = createEPR();
+
+ calc = service.getPort(epr, Calculator.class, new AddressingFeature());
+ Assert.assertEquals(12, calc.add(6, 6));
+ }
+
+
+ private void testAddResponse(SOAPMessage message, int sum, boolean mtom) throws Exception {
+ TestUtils.testResponse(message, BASE_ACTION + "/addResponse", "addResponse", sum, mtom);
+ }
+
+ private void testMultiplyResponse(SOAPMessage message, int sum, boolean mtom) throws Exception {
+ TestUtils.testResponse(message, BASE_ACTION + "/multiplyResponse", "multiplyResponse", sum, mtom);
+ }
+
+ private W3CEndpointReferenceBuilder createERPBuilder() {
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ builder = builder.address(address);
+ builder = builder.serviceName(SERVICE);
+ builder = builder.endpointName(PORT);
+ return builder;
+ }
+
+ private EndpointReference createEPR() {
+ return createERPBuilder().build();
+ }
+
+ protected void updateAddress() {
+ Calculator calc = service.getPort(Calculator.class);
+ BindingProvider binding = (BindingProvider)calc;
+ this.address = (String)binding.getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+ System.out.println("Set address: " + this.address);
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletEJB.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletEJB.java?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletEJB.java (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletEJB.java Tue Sep 23 09:09:37 2008
@@ -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.geronimo.jaxws.wsa;
+
+import javax.annotation.PostConstruct;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceRef;
+
+public class TestServletEJB extends TestServlet {
+
+ @WebServiceRef(name = "services/ejb/Calculator")
+ private Service myService;
+
+ @PostConstruct
+ private void myInit() {
+ this.service = myService;
+ updateAddress();
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletEJB.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletEJB.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletEJB.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletWeb.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletWeb.java?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletWeb.java (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletWeb.java Tue Sep 23 09:09:37 2008
@@ -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.geronimo.jaxws.wsa;
+
+import javax.annotation.PostConstruct;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceRef;
+
+public class TestServletWeb extends TestServlet {
+
+ @WebServiceRef(name = "services/Calculator")
+ private Service myService;
+
+ @PostConstruct
+ private void myInit() {
+ this.service = myService;
+ updateAddress();
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletWeb.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletWeb.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestServletWeb.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestUtils.java?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestUtils.java (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestUtils.java Tue Sep 23 09:09:37 2008
@@ -0,0 +1,112 @@
+/**
+ * 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.geronimo.jaxws.wsa;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.Node;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.Assert;
+
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class TestUtils {
+
+ private static final QName IS_REFERENCE_PARAMETER =
+ new QName("http://www.w3.org/2005/08/addressing", "IsReferenceParameter");
+
+ public static SOAPElement findElement(SOAPElement rootElement, String name) {
+ Iterator iter = rootElement.getChildElements();
+ while(iter.hasNext()) {
+ Node node = (Node)iter.next();
+ if (node instanceof SOAPElement && node.getLocalName().equals(name)) {
+ return (SOAPElement)node;
+ }
+ }
+ return null;
+ }
+
+ public static SOAPMessage createMessage(String msg) throws SOAPException {
+ Source src = new StreamSource(new StringReader(msg));
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage message = factory.createMessage();
+ message.getSOAPPart().setContent(src);
+ message.saveChanges();
+ return message;
+ }
+
+ public static Document createDocument(String xml)
+ throws ParserConfigurationException, SAXException, IOException {
+ return createDocument(new InputSource(new StringReader(xml)));
+ }
+
+ public static Document createDocument(InputSource source)
+ throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setValidating(false);
+ DocumentBuilder builder = dbf.newDocumentBuilder();
+ return builder.parse(source);
+ }
+
+ public static void testResponse(SOAPMessage message, String responseAction, String responseElement, int result, boolean mtom)
+ throws SOAPException, IOException {
+ message.writeTo(System.out);
+
+ SOAPHeader header = message.getSOAPHeader();
+ SOAPElement action = TestUtils.findElement(header, "Action");
+ Assert.assertNotNull(action);
+ Assert.assertEquals(responseAction, action.getValue());
+
+ SOAPBody body = message.getSOAPBody();
+ SOAPElement responseElem = TestUtils.findElement(body, responseElement);
+ Assert.assertNotNull(responseElem);
+ SOAPElement returnElem = TestUtils.findElement(responseElem, "return");
+ Assert.assertNotNull(returnElem);
+ Assert.assertEquals(String.valueOf(result), returnElem.getValue());
+ }
+
+ public static void testReferenceProperties(SOAPMessage message, String name, String value)
+ throws SOAPException {
+ SOAPHeader header = message.getSOAPHeader();
+ SOAPElement propElement = TestUtils.findElement(header, name);
+ Assert.assertNotNull(propElement);
+ Assert.assertEquals(value, propElement.getValue());
+ String attrValue = propElement.getAttributeValue(IS_REFERENCE_PARAMETER);
+ Assert.assertTrue(attrValue,
+ "true".equalsIgnoreCase(attrValue) || "1".equalsIgnoreCase(attrValue));
+ }
+
+}
\ No newline at end of file
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/java/org/apache/geronimo/jaxws/wsa/TestUtils.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/geronimo-web.xml?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/geronimo-web.xml (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/geronimo-web.xml Tue Sep 23 09:09:37 2008
@@ -0,0 +1,52 @@
+<?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.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1">
+ <dep:environment>
+ <dep:moduleId>
+ <dep:groupId>${pom.groupId}</dep:groupId>
+ <dep:artifactId>${pom.artifactId}</dep:artifactId>
+ <dep:version>1.0</dep:version>
+ <dep:type>war</dep:type>
+ </dep:moduleId>
+ </dep:environment>
+
+ <context-root>/${pom.artifactId}</context-root>
+
+ <service-ref>
+ <service-ref-name>services/Calculator</service-ref-name>
+ <port>
+ <port-name>CalculatorPort</port-name>
+ <protocol>http</protocol>
+ <host>localhost</host>
+ <port>8080</port>
+ <uri>/wsa-war/calculator</uri>
+ </port>
+ </service-ref>
+
+ <service-ref>
+ <service-ref-name>services/ejb/Calculator</service-ref-name>
+ <port>
+ <port-name>CalculatorPort</port-name>
+ <protocol>http</protocol>
+ <host>localhost</host>
+ <port>8080</port>
+ <uri>/CalculatorService/Calculator</uri>
+ </port>
+ </service-ref>
+
+</web-app>
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/web.xml?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/web.xml (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/web.xml Tue Sep 23 09:09:37 2008
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright 2006 The Apache Software Foundation
+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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
+ version="2.5"
+ >
+
+ <display-name>JAX-WS WS-Addressing Test</display-name>
+
+ <servlet>
+ <display-name>CalculatorServlet</display-name>
+ <servlet-name>CalculatorServlet</servlet-name>
+ <servlet-class>org.apache.geronimo.jaxws.test.CalculatorImpl</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CalculatorServlet</servlet-name>
+ <url-pattern>/calculator</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <display-name>TestServletWeb</display-name>
+ <servlet-name>TestServletWeb</servlet-name>
+ <servlet-class>org.apache.geronimo.jaxws.wsa.TestServletWeb</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestServletWeb</servlet-name>
+ <url-pattern>/test-web</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <display-name>TestServletEJB</display-name>
+ <servlet-name>TestServletEJB</servlet-name>
+ <servlet-class>org.apache.geronimo.jaxws.wsa.TestServletEJB</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestServletEJB</servlet-name>
+ <url-pattern>/test-ejb</url-pattern>
+ </servlet-mapping>
+
+ <service-ref>
+ <service-ref-name>services/Calculator</service-ref-name>
+ <service-interface>javax.xml.ws.Service</service-interface>
+ <wsdl-file>WEB-INF/wsdl/calculator.wsdl</wsdl-file>
+ </service-ref>
+
+ <service-ref>
+ <service-ref-name>services/ejb/Calculator</service-ref-name>
+ <service-interface>javax.xml.ws.Service</service-interface>
+ <wsdl-file>WEB-INF/wsdl/calculator.wsdl</wsdl-file>
+ </service-ref>
+
+</web-app>
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/wsdl/calculator.wsdl
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/wsdl/calculator.wsdl?rev=698215&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/wsdl/calculator.wsdl (added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/wsdl/calculator.wsdl Tue Sep 23 09:09:37 2008
@@ -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.
+-->
+<wsdl:definitions name="CalculatorService" targetNamespace="http://geronimo.apache.org/calculator" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://geronimo.apache.org/calculator" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://geronimo.apache.org/calculator" xmlns:ns1="http://www.w3.org/2005/08/addressing" xmlns:tns="http://geronimo.apache.org/calculator" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+<xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2006/03/addressing/ws-addr.xsd" />
+<xs:element name="add" type="tns:add" />
+<xs:element name="addResponse" type="tns:addResponse" />
+<xs:element name="getEPR" type="tns:getEPR" />
+<xs:element name="getEPRResponse" type="tns:getEPRResponse" />
+<xs:element name="multiply" type="tns:multiply" />
+<xs:element name="multiplyResponse" type="tns:multiplyResponse" />
+<xs:complexType name="add">
+<xs:sequence>
+<xs:element name="arg0" type="xs:int" />
+<xs:element name="arg1" type="xs:int" />
+</xs:sequence>
+</xs:complexType>
+<xs:complexType name="addResponse">
+<xs:sequence>
+<xs:element name="return" type="xs:int" />
+</xs:sequence>
+</xs:complexType>
+<xs:complexType name="getEPR">
+<xs:sequence />
+</xs:complexType>
+<xs:complexType name="getEPRResponse">
+<xs:sequence>
+<xs:element minOccurs="0" name="return" type="ns1:EndpointReferenceType" />
+</xs:sequence>
+</xs:complexType>
+<xs:complexType name="multiply">
+<xs:sequence>
+<xs:element name="arg0" type="xs:int" />
+<xs:element name="arg1" type="xs:int" />
+</xs:sequence>
+</xs:complexType>
+<xs:complexType name="multiplyResponse">
+<xs:sequence>
+<xs:element name="return" type="xs:int" />
+</xs:sequence>
+</xs:complexType>
+</xs:schema>
+ </wsdl:types>
+ <wsdl:message name="multiply">
+ <wsdl:part element="tns:multiply" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getEPRResponse">
+ <wsdl:part element="tns:getEPRResponse" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="addResponse">
+ <wsdl:part element="tns:addResponse" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="multiplyResponse">
+ <wsdl:part element="tns:multiplyResponse" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="add">
+ <wsdl:part element="tns:add" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getEPR">
+ <wsdl:part element="tns:getEPR" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="Calculator">
+ <wsdl:operation name="add">
+ <wsdl:input message="tns:add" name="add">
+ </wsdl:input>
+ <wsdl:output message="tns:addResponse" name="addResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getEPR">
+ <wsdl:input message="tns:getEPR" name="getEPR">
+ </wsdl:input>
+ <wsdl:output message="tns:getEPRResponse" name="getEPRResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="multiply">
+ <wsdl:input message="tns:multiply" name="multiply">
+ </wsdl:input>
+ <wsdl:output message="tns:multiplyResponse" name="multiplyResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CalculatorServiceSoapBinding" type="tns:Calculator">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="add">
+ <soap:operation soapAction="" style="document" />
+ <wsdl:input name="add">
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="addResponse">
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getEPR">
+ <soap:operation soapAction="" style="document" />
+ <wsdl:input name="getEPR">
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="getEPRResponse">
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="multiply">
+ <soap:operation soapAction="" style="document" />
+ <wsdl:input name="multiply">
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="multiplyResponse">
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CalculatorService">
+ <wsdl:port binding="tns:CalculatorServiceSoapBinding" name="CalculatorPort">
+ <soap:address location="http://localhost:8080/wsa-war/calculator" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/wsdl/calculator.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/wsdl/calculator.wsdl
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-wsa-tests/wsa-war/src/main/webapp/WEB-INF/wsdl/calculator.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml