Author: alessio.soldano(a)jboss.com
Date: 2009-05-27 06:09:38 -0400 (Wed, 27 May 2009)
New Revision: 10120
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingStatefulTestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpoint.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpointImpl.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/jaxws-handlers.xml
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/META-INF/
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/META-INF/wsdl/
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/META-INF/wsdl/TestService.wsdl
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/WEB-INF/
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/WEB-INF/web.xml
Modified:
framework/trunk/testsuite/test/ant-import/build-samples-jaxws.xml
Log:
[JBWS-2657] Adding testcase
Modified: framework/trunk/testsuite/test/ant-import/build-samples-jaxws.xml
===================================================================
--- framework/trunk/testsuite/test/ant-import/build-samples-jaxws.xml 2009-05-27 09:53:36
UTC (rev 10119)
+++ framework/trunk/testsuite/test/ant-import/build-samples-jaxws.xml 2009-05-27 10:09:38
UTC (rev 10120)
@@ -18,6 +18,16 @@
<mkdir dir="${tests.output.dir}/test-libs"/>
+ <!-- jaxws-samples-addressing -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-samples-wsaddressing.war"
webxml="${tests.output.dir}/test-resources/jaxws/samples/addressing/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpointImpl.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/addressing/jaxws-handlers.xml"/>
+ </classes>
+ </war>
+
<!-- jaxws-samples-asynchronous -->
<war
warfile="${tests.output.dir}/test-libs/jaxws-samples-asynchronous.war"
webxml="${tests.output.dir}/test-resources/jaxws/samples/asynchronous/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java 2009-05-27
10:09:38 UTC (rev 10120)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.addressing;
+
+import java.io.IOException;
+import java.rmi.RemoteException;
+import java.util.Map;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.addressing.MAP;
+import org.jboss.wsf.common.addressing.MAPBuilder;
+import org.jboss.wsf.common.addressing.MAPBuilderFactory;
+import org.jboss.wsf.common.addressing.MAPConstants;
+import org.jboss.wsf.common.addressing.MAPEndpoint;
+import org.jboss.wsf.common.utils.UUIDGenerator;
+import org.w3c.dom.Element;
+
+/**
+ * This is a wrapper around the StatefulEndpoint port, setting / handling client IDs
+ * using WS-Addressing (common JSR-261 API).
+ *
+ * The work performed by this class cannot always be done simply using
+ * handlers on client side. That's because (for instance) CXF's
+ * ws-addressing interceptors run before user provided handlers
+ * when dealing with outbound client messages.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 27-May-2009
+ *
+ */
+public class AddressingPort implements StatefulEndpoint
+{
+ private static Logger log = Logger.getLogger(AddressingPort.class);
+ private static final QName IDQN = StatefulEndpointImpl.IDQN;
+ private StatefulEndpoint port;
+ private static int maxClientId;
+ private String clientID;
+
+ public AddressingPort(StatefulEndpoint port)
+ {
+ this.port = port;
+ }
+
+
+ public void addItem(String item) throws RemoteException
+ {
+ setClientID();
+ port.addItem(item);
+ readClientID();
+ }
+
+ public void checkout() throws RemoteException
+ {
+ setClientID();
+ port.checkout();
+ readClientID();
+ }
+
+ public String getItems() throws RemoteException
+ {
+ setClientID();
+ String result = port.getItems();
+ readClientID();
+ return result;
+ }
+
+ /**
+ * This installs the ID for this client in the outbound messages
+ */
+ private void setClientID()
+ {
+ BindingProvider bindingProvider = (BindingProvider)port;
+ Map<String, Object> msgContext = bindingProvider.getRequestContext();
+ MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
+ MAPConstants ADDR = builder.newConstants();
+ MAP outProps = builder.newMap();
+ outProps.setTo("uri:jaxrpc-samples-wsaddressing/TestService");
+ outProps.setAction("http://org.jboss.ws/addressing/stateful/action");
+ MAPEndpoint replyTo = builder.newEndpoint(ADDR.getAnonymousURI());
+ outProps.setReplyTo(replyTo);
+ outProps.setMessageID("urn:uuid:" +
UUIDGenerator.generateRandomUUIDString());
+ // Assign a new clientid
+ if (clientID == null)
+ {
+ clientID = "clientid-" + (++maxClientId);
+ log.info("New clientid: " + clientID);
+ }
+ try
+ {
+ replyTo.addReferenceParameter(DOMUtils.parse(getClientIdElement(clientID)));
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ outProps.installOutboundMapOnClientSide(msgContext, outProps);
+ }
+
+ /**
+ * This verifies the client ID is available in inbound messages
+ */
+ @SuppressWarnings("unchecked")
+ private void readClientID()
+ {
+ BindingProvider bindingProvider = (BindingProvider)port;
+ Map<String, Object> msgContext = bindingProvider.getResponseContext();
+ MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
+ MAP addrProps = builder.inboundMap(msgContext);
+ if (addrProps == null)
+ throw new IllegalStateException("Cannot obtain
AddressingProperties");
+ for (Object obj : addrProps.getReferenceParameters())
+ {
+ if (obj instanceof Element) //Native always uses Element for ref params
+ {
+ Element el = (Element)obj;
+ QName qname = DOMUtils.getElementQName(el);
+ if (qname.equals(IDQN))
+ {
+ clientID = DOMUtils.getTextContent(el);
+ }
+ }
+ else if (obj instanceof JAXBElement) //CXF also uses JAXBElement
+ {
+ JAXBElement<String> el = (JAXBElement<String>)obj;
+ if (IDQN.equals(el.getName()))
+ {
+ clientID = el.getValue();
+ }
+ }
+ }
+ if (clientID == null)
+ throw new IllegalStateException("Cannot obtain clientid");
+ }
+
+ private static String getClientIdElement(String clientid)
+ {
+ String qualname = IDQN.getPrefix() + ":" + IDQN.getLocalPart();
+ StringBuffer buffer = new StringBuffer("<" + qualname);
+ buffer.append(" xmlns:" + IDQN.getPrefix() + "='" +
IDQN.getNamespaceURI() + "'");
+ buffer.append(">" + clientid + "</" + qualname +
">");
+ return buffer.toString();
+ }
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingStatefulTestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingStatefulTestCase.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingStatefulTestCase.java 2009-05-27
10:09:38 UTC (rev 10120)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.addressing;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.AddressingFeature;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Test stateful endpoint using ws-addressing
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
+ * @since 24-Nov-2005
+ */
+public class AddressingStatefulTestCase extends JBossWSTest
+{
+ private static AddressingPort port1;
+ private static AddressingPort port2;
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(AddressingStatefulTestCase.class,
"jaxws-samples-wsaddressing.war");
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ if (port1 == null || port2 == null)
+ {
+ URL wsdlURL = new URL(" http://" + getServerHost() +
":8080/jaxws-samples-wsaddressing/TestService?wsdl");
+ QName serviceName = new
QName("http://org.jboss.ws/samples/wsaddressing", "TestService");
+
+ Service service1 = Service.create(wsdlURL, serviceName);
+ port1 = new AddressingPort(service1.getPort(StatefulEndpoint.class, new
AddressingFeature(true, true)));
+
+ Service service2 = Service.create(wsdlURL, serviceName);
+ port2 = new AddressingPort(service2.getPort(StatefulEndpoint.class, new
AddressingFeature(true, true)));
+ }
+ }
+
+ public void testAddItem() throws Exception
+ {
+ port1.addItem("Ice Cream");
+ port1.addItem("Ferrari");
+
+ port2.addItem("Mars Bar");
+ port2.addItem("Porsche");
+ }
+
+ public void testGetItems() throws Exception
+ {
+ String items1 = port1.getItems();
+ assertEquals("[Ice Cream, Ferrari]", items1);
+
+ String items2 = port2.getItems();
+ assertEquals("[Mars Bar, Porsche]", items2);
+ }
+
+ public void testCheckout() throws Exception
+ {
+ port1.checkout();
+ assertEquals("[]", port1.getItems());
+
+ port2.checkout();
+ assertEquals("[]", port2.getItems());
+ }
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingStatefulTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java 2009-05-27
10:09:38 UTC (rev 10120)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.addressing;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.addressing.MAP;
+import org.jboss.wsf.common.addressing.MAPBuilder;
+import org.jboss.wsf.common.addressing.MAPBuilderFactory;
+import org.jboss.wsf.common.addressing.MAPEndpoint;
+import org.jboss.wsf.common.handler.GenericSOAPHandler;
+import org.w3c.dom.Element;
+
+/**
+ * A server side handler for the ws-addressing
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 24-Nov-2005
+ */
+public class ServerHandler extends GenericSOAPHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(ServerHandler.class);
+
+ private static final QName IDQN = StatefulEndpointImpl.IDQN;
+
+ @Override
+ public boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleRequest");
+
+ MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
+ MAP addrProps = builder.inboundMap(msgContext);
+
+ if (addrProps == null)
+ throw new IllegalStateException("Cannot obtain
AddressingProperties");
+
+ String clientid = null;
+ MAPEndpoint replyTo = addrProps.getReplyTo();
+ for (Object obj :replyTo.getReferenceParameters())
+ {
+ if (obj instanceof Element)
+ {
+ Element el = (Element)obj;
+ QName qname = DOMUtils.getElementQName(el);
+ if (qname.equals(IDQN))
+ {
+ clientid = DOMUtils.getTextContent(el);
+ }
+ }
+ else
+ {
+ log.warn("Unsupported reference parameter found: " + obj);
+ }
+ }
+
+ if (clientid == null)
+ throw new IllegalStateException("Cannot obtain client id");
+
+ // put the clientid in the message context
+ msgContext.put("clientid", clientid);
+ msgContext.setScope("clientid", Scope.APPLICATION);
+ return true;
+ }
+
+ @Override
+ public boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleResponse");
+
+ MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
+ MAP inProps = builder.inboundMap(msgContext);
+ MAP outProps = builder.newMap();
+ outProps.initializeAsDestination(inProps.getReplyTo());
+
outProps.setAction("http://org.jboss.ws/addressing/stateful/actionReply");
+
+ outProps.installOutboundMapOnServerSide(msgContext, outProps);
+ msgContext.setScope(builder.newConstants().getServerAddressingPropertiesOutbound(),
Scope.APPLICATION);
+
+ return true;
+ }
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpoint.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpoint.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpoint.java 2009-05-27
10:09:38 UTC (rev 10120)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.addressing;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * WS-Addressing stateful service endpoint interface
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ *
+ * @since 24-Nov-2005
+ */
+@WebService(name = "StatefulEndpoint", targetNamespace =
"http://org.jboss.ws/samples/wsaddressing", serviceName =
"TestService")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface StatefulEndpoint extends Remote
+{
+ @WebMethod
+ public void addItem(String item) throws RemoteException;
+
+ @WebMethod
+ public void checkout() throws RemoteException;
+
+ @WebMethod
+ public String getItems() throws RemoteException;
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpointImpl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpointImpl.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpointImpl.java 2009-05-27
10:09:38 UTC (rev 10120)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.addressing;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.jws.HandlerChain;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.soap.Addressing;
+
+import org.jboss.logging.Logger;
+
+/**
+ * WS-Addressing stateful service endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 24-Nov-2005
+ */
+@WebService(name = "StatefulEndpoint", targetNamespace =
"http://org.jboss.ws/samples/wsaddressing", serviceName =
"TestService")
+@Addressing
+@HandlerChain(file = "jaxws-handlers.xml")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public class StatefulEndpointImpl implements StatefulEndpoint
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(StatefulEndpointImpl.class);
+
+ public static final QName IDQN = new QName("http://somens",
"clientid", "ns1");
+
+ // The state map for all clients
+ private static Map<String, List<String>> clientStateMap = new
HashMap<String, List<String>>();
+
+ private String clientid;
+ private static List<String> items;
+ private WebServiceContext context;
+
+ @Resource
+ public void setContext(WebServiceContext context)
+ {
+ log.info("injecting: " + context);
+ this.context = context;
+ }
+
+ @WebMethod
+ public void addItem(String item)
+ {
+ initSessionState();
+ log.info("addItem [clientid=" + clientid + "]: " + item);
+ items.add(item);
+ }
+
+ @WebMethod
+ public void checkout()
+ {
+ initSessionState();
+ log.info("checkout [clientid=" + clientid + "]");
+ clientStateMap.remove(clientid);
+ }
+
+ @WebMethod
+ public String getItems()
+ {
+ initSessionState();
+ log.info("getItems [clientid=" + clientid + "]: " + items);
+ return items.toString();
+ }
+
+ private void initSessionState()
+ {
+ MessageContext msgContext = context.getMessageContext();
+ clientid = (String)msgContext.get("clientid");
+ if (clientid == null)
+ throw new IllegalStateException("Cannot obtain clientid");
+
+ // Get the client's items
+ items = clientStateMap.get(clientid);
+ if (items == null)
+ {
+ items = new ArrayList<String>();
+ clientStateMap.put(clientid, items);
+ }
+ }
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/StatefulEndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/jaxws-handlers.xml
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/jaxws-handlers.xml
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/jaxws-handlers.xml 2009-05-27
10:09:38 UTC (rev 10120)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<handler-chains
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
javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+ <handler>
+ <handler-name>Application Server Handler</handler-name>
+
<handler-class>org.jboss.test.ws.jaxws.samples.addressing.ServerHandler</handler-class>
+ </handler>
+ </handler-chain>
+</handler-chains>
\ No newline at end of file
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/addressing/jaxws-handlers.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/META-INF/wsdl/TestService.wsdl
===================================================================
---
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/META-INF/wsdl/TestService.wsdl
(rev 0)
+++
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/META-INF/wsdl/TestService.wsdl 2009-05-27
10:09:38 UTC (rev 10120)
@@ -0,0 +1,62 @@
+<definitions name='TestService'
targetNamespace='http://org.jboss.ws/samples/wsaddressing'
xmlns='http://schemas.xmlsoap.org/wsdl/'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:tns='http://org.jboss.ws/samples/wsaddressing'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types></types>
+ <message name='StatefulEndpoint_addItem'>
+ <part name='String_1' type='xsd:string'/>
+ </message>
+ <message name='StatefulEndpoint_getItemsResponse'>
+ <part name='result' type='xsd:string'/>
+ </message>
+ <message name='StatefulEndpoint_checkout'></message>
+ <message name='StatefulEndpoint_getItems'></message>
+ <message name='StatefulEndpoint_addItemResponse'></message>
+ <message name='StatefulEndpoint_checkoutResponse'></message>
+ <portType name='StatefulEndpoint'>
+ <operation name='addItem' parameterOrder='String_1'>
+ <input message='tns:StatefulEndpoint_addItem'/>
+ <output message='tns:StatefulEndpoint_addItemResponse'/>
+ </operation>
+ <operation name='checkout'>
+ <input message='tns:StatefulEndpoint_checkout'/>
+ <output message='tns:StatefulEndpoint_checkoutResponse'/>
+ </operation>
+ <operation name='getItems'>
+ <input message='tns:StatefulEndpoint_getItems'/>
+ <output message='tns:StatefulEndpoint_getItemsResponse'/>
+ </operation>
+ </portType>
+ <binding name='StatefulEndpointBinding'
type='tns:StatefulEndpoint'>
+ <soap:binding style='rpc'
transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='addItem'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body namespace='http://org.jboss.ws/samples/wsaddressing'
use='literal'/>
+ </input>
+ <output>
+ <soap:body namespace='http://org.jboss.ws/samples/wsaddressing'
use='literal'/>
+ </output>
+ </operation>
+ <operation name='checkout'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body namespace='http://org.jboss.ws/samples/wsaddressing'
use='literal'/>
+ </input>
+ <output>
+ <soap:body namespace='http://org.jboss.ws/samples/wsaddressing'
use='literal'/>
+ </output>
+ </operation>
+ <operation name='getItems'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body namespace='http://org.jboss.ws/samples/wsaddressing'
use='literal'/>
+ </input>
+ <output>
+ <soap:body namespace='http://org.jboss.ws/samples/wsaddressing'
use='literal'/>
+ </output>
+ </operation>
+ </binding>
+ <service name='TestService'>
+ <port binding='tns:StatefulEndpointBinding'
name='StatefulEndpointPort'>
+ <soap:address
location='http://@jboss.bind.address@:8080/jaxws-samples-wsaddressing/TestService'/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file
Property changes on:
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/META-INF/wsdl/TestService.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: framework/trunk/testsuite/test/resources/jaxws/samples/addressing/WEB-INF/web.xml
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/samples/addressing/WEB-INF/web.xml
(rev 0)
+++
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/WEB-INF/web.xml 2009-05-27
10:09:38 UTC (rev 10120)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
+
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_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>TestService</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.samples.addressing.StatefulEndpointImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
Property changes on:
framework/trunk/testsuite/test/resources/jaxws/samples/addressing/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF