[jboss-svn-commits] JBL Code SVN: r26220 - in labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing: src_as5 and 9 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Apr 23 05:43:02 EDT 2009


Author: beve
Date: 2009-04-23 05:43:02 -0400 (Thu, 23 Apr 2009)
New Revision: 26220

Added:
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/ServerHandler.java
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/StatefulEndpoint.java
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/StatefulEndpointImpl.java
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/client/
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/client/ClientHandler.java
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/client/WSAClient.java
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/jaxws-handlers.xml
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/war/resources/WEB-INF/jboss-web.xml
Modified:
   labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/build.xml
Log:
Change required for AS 5


Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/build.xml	2009-04-23 09:42:30 UTC (rev 26219)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/build.xml	2009-04-23 09:43:02 UTC (rev 26220)
@@ -8,8 +8,17 @@
 	<!-- Import the base Ant build script... -->
 	<import file="../conf/base-build.xml"/>
 
-    <target name="quickstart-specific-checks" depends="assert-ws-available,assert-jbossremoting-version"/>
+    <target name="quickstart-specific-checks" depends="assert-ws-available,assert-jbossremoting-version, check-src-dir"/>
 
+	<target name="check-src-dir">
+        <condition property="quickstart.src.dir" value="src_as5" else="src">
+            <and>
+                <available classname="org.jboss.wsf.common.handler.GenericSOAPHandler" classpathref="compile-classpath"/>
+            </and>
+        </condition>
+        <echo message="Set src dir to : ${quickstart.src.dir}"/>
+    </target>
+
     <target name="quickstart-specific-dependencies">
         <path id="quickstart-dependencies-classpath">
             <fileset dir="${org.jboss.esb.server.home}/client" includes="jbossws-client.jar,jboss-remoting.jar" />
@@ -23,6 +32,9 @@
         <!-- Build the webservice... -->
         <war warfile="build/${ant.project.name}.war"
              webxml="${basedir}/war/resources/WEB-INF/web.xml">
+			<webinf dir="${basedir}/war/resources/WEB-INF">
+                <include name="jboss-web.xml"/>
+            </webinf>
             <fileset dir="${basedir}/war/view">
                 <include name="**/*"/>
             </fileset>

Added: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/ServerHandler.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/ServerHandler.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/ServerHandler.java	2009-04-23 09:43:02 UTC (rev 26220)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.soa.esb.samples.quickstart.webservicewsa;
+
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.EndpointReference;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.addressing.ReferenceParameters;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.xml.DOMUtils;
+import org.jboss.wsf.common.handler.GenericSOAPHandler;
+
+/**
+ * A server side handler for the ws-addressing
+ *
+ * @author Thomas.Diesler at 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");
+
+      AddressingProperties addrProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+      if (addrProps == null)
+         throw new IllegalStateException("Cannot obtain AddressingProperties");
+
+      String clientid = null;
+      EndpointReference replyTo = addrProps.getReplyTo();
+      ReferenceParameters refParams = replyTo!=null ? replyTo.getReferenceParameters() : null;
+      if (refParams != null)
+      {
+         for (Object obj : refParams.getElements())
+         {
+            SOAPElement el = (SOAPElement)obj;
+            QName qname = DOMUtils.getElementQName(el);
+            if (qname.equals(IDQN))
+            {
+               clientid = DOMUtils.getTextContent(el);
+            }
+         }
+      }
+
+      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");
+
+      try
+      {
+         AddressingProperties inProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+         AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+
+         builder.newAddressingConstants();
+         AddressingProperties outProps = builder.newAddressingProperties();
+         outProps.initializeAsReply(inProps, false);
+         outProps.setAction(builder.newURI("http://org.jboss.ws/addressing/stateful/actionReply"));
+
+         msgContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
+         msgContext.setScope(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION);
+      }
+      catch (URISyntaxException ex)
+      {
+         throw new IllegalStateException("Cannot handle response", ex);
+      }
+
+      return true;
+   }
+}

Added: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/StatefulEndpoint.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/StatefulEndpoint.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/StatefulEndpoint.java	2009-04-23 09:43:02 UTC (rev 26220)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.soa.esb.samples.quickstart.webservicewsa;
+
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.ws.annotation.EndpointConfig;
+
+/**
+ * WS-Addressing stateful service endpoint interface
+ *
+ * @author Thomas.Diesler at jboss.org
+ *
+ * @since 24-Nov-2005
+ */
+ at WebService(name = "WsaEndpoint", targetNamespace = "http://webservice.webservicewsa.quickstart.samples.esb.soa.jboss.org/", serviceName = "WsaService")
+ at 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;
+}

Added: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/StatefulEndpointImpl.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/StatefulEndpointImpl.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/StatefulEndpointImpl.java	2009-04-23 09:43:02 UTC (rev 26220)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.soa.esb.samples.quickstart.webservicewsa;
+
+
+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 org.jboss.logging.Logger;
+import org.jboss.ws.annotation.EndpointConfig;
+
+/**
+ * WS-Addressing stateful service endpoint
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 24-Nov-2005
+ */
+ at WebService(name = "WsaEndpoint", targetNamespace = "http://webservice.webservicewsa.quickstart.samples.esb.soa.jboss.org/", serviceName = "WsaService")
+ at EndpointConfig(configName = "Standard WSAddressing Endpoint")
+ at HandlerChain(file = "jaxws-handlers.xml")
+ at 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);
+      }
+   }
+}

Added: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/client/ClientHandler.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/client/ClientHandler.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/client/ClientHandler.java	2009-04-23 09:43:02 UTC (rev 26220)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.soa.esb.samples.quickstart.webservicewsa.client;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.AddressingConstants;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.EndpointReference;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.addressing.ReferenceParameters;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.xml.DOMUtils;
+import org.jboss.wsf.common.handler.GenericSOAPHandler;
+import org.jboss.wsf.common.utils.UUIDGenerator;
+import org.jboss.soa.esb.samples.quickstart.webservicewsa.StatefulEndpointImpl;
+
+/**
+ * A client side handler for the ws-addressing
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 24-Nov-2005
+ */
+public class ClientHandler extends GenericSOAPHandler
+{
+   // Provide logging
+   private static Logger log = Logger.getLogger(ClientHandler.class);
+
+   private static final QName IDQN = StatefulEndpointImpl.IDQN;
+
+   private static int maxClientId;
+   private String clientid;
+
+   @Override
+   public boolean handleOutbound(MessageContext msgContext)
+   {
+      try
+      {
+         AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+         AddressingConstants ADDR = builder.newAddressingConstants();
+
+         AddressingProperties outProps = builder.newAddressingProperties();
+         outProps.setTo(builder.newURI("uri:jaxrpc-samples-wsaddressing/TestService"));
+         outProps.setAction(builder.newURI("http://org.jboss.ws/addressing/stateful/action"));
+
+         EndpointReference replyTo = builder.newEndpointReference(new URI(ADDR.getAnonymousURI()));
+         outProps.setReplyTo(replyTo);
+         outProps.setMessageID(builder.newURI("urn:uuid:"+ UUIDGenerator.generateRandomUUIDString()));
+
+         // Assign a new clientid
+         if (clientid == null)
+         {
+            clientid = "clientid-" + (++maxClientId);
+            log.info("New clientid: " + clientid);
+         }
+
+         ReferenceParameters refParams = replyTo.getReferenceParameters();
+         refParams.addElement(getClientIdElement(clientid));
+
+         msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
+         msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION);
+      }
+      catch (URISyntaxException ex)
+      {
+         throw new IllegalStateException("Cannot handle request", ex);
+      }
+
+      return true;
+   }
+
+   @Override
+   public boolean handleInbound(MessageContext msgContext)
+   {
+      AddressingProperties addrProps = (AddressingProperties)msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND);
+      if (addrProps == null)
+         throw new IllegalStateException("Cannot obtain AddressingProperties");
+
+      ReferenceParameters refParams = addrProps.getReferenceParameters();
+      for (Object obj : refParams.getElements())
+      {
+         SOAPHeaderElement el = (SOAPHeaderElement)obj;
+         QName qname = DOMUtils.getElementQName(el);
+         if (qname.equals(IDQN))
+         {
+            clientid = DOMUtils.getTextContent(el);
+         }
+      }
+
+      if (clientid == null)
+         throw new IllegalStateException("Cannot obtain clientid");
+
+      return true;
+   }
+
+   private 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();
+   }
+}

Added: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/client/WSAClient.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/client/WSAClient.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/client/WSAClient.java	2009-04-23 09:43:02 UTC (rev 26220)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.webservicewsa.client;
+
+import org.jboss.soa.esb.samples.quickstart.webservicewsa.StatefulEndpoint;
+import org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.soap.SOAPBinding;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+import java.rmi.RemoteException;
+
+/**
+ * WSA Client.
+ * <p/>
+ * The basis of this code was lifted from JBossWS test code.  Thanks guys :-)
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class WSAClient {
+
+    public static void main(String[] args) throws MalformedURLException, RemoteException {
+        StatefulEndpoint endpointPort1 = getEndpointPort();
+        StatefulEndpoint endpointPort2 = getEndpointPort();
+
+        endpointPort1.addItem("Ice Cream");
+        endpointPort1.addItem("Chocolate");
+
+        endpointPort2.addItem("Water");
+        endpointPort2.addItem("Bread");
+
+        System.out.println("\nT1. endpointPort1 basket: " + endpointPort1.getItems());
+        System.out.println("T1. endpointPort2 basket: " + endpointPort2.getItems());
+
+        System.out.println("\nT2. endpointPort1 checks out...");
+        endpointPort1.checkout();
+
+        System.out.println("\nT3. endpointPort1 basket: " + endpointPort1.getItems());
+        System.out.println("T3. endpointPort2 basket: " + endpointPort2.getItems());
+
+        System.out.println("\nT4. endpointPort2 checks out...");
+        endpointPort2.checkout();
+
+        System.out.println("\nT5. endpointPort1 basket: " + endpointPort1.getItems());
+        System.out.println("T5. endpointPort2 basket: " + endpointPort2.getItems());
+    }
+
+    private static StatefulEndpoint getEndpointPort() throws MalformedURLException {
+        StatefulEndpoint endpoint;
+        QName serviceName = new QName("http://webservice.webservicewsa.quickstart.samples.esb.soa.jboss.org/", "WsaService");
+        URL wsdlURL = new URL("http://localhost:8080/contract/contract.jsp?serviceCat=MyServiceCategory&serviceName=MyWsaService&protocol=http");
+
+        Service service = Service.create(wsdlURL, serviceName);
+        endpoint = service.getPort(StatefulEndpoint.class);
+
+        SOAPBinding binding = (SOAPBinding)((BindingProvider)endpoint).getBinding();
+        List<Handler> handlerChain = new ArrayList<Handler>();
+
+        handlerChain.addAll(binding.getHandlerChain());
+        handlerChain.add(new ClientHandler());
+        handlerChain.add(new WSAddressingClientHandler());
+        binding.setHandlerChain(handlerChain);
+
+        return endpoint;
+    }
+}

Added: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/jaxws-handlers.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/jaxws-handlers.xml	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/src_as5/org/jboss/soa/esb/samples/quickstart/webservicewsa/jaxws-handlers.xml	2009-04-23 09:43:02 UTC (rev 26220)
@@ -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.soa.esb.samples.quickstart.webservicewsa.ServerHandler</handler-class>
+    </handler>
+  </handler-chain>
+</handler-chains>
\ No newline at end of file

Added: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/war/resources/WEB-INF/jboss-web.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/war/resources/WEB-INF/jboss-web.xml	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/webservice_wsaddressing/war/resources/WEB-INF/jboss-web.xml	2009-04-23 09:43:02 UTC (rev 26220)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-web>
+	<context-root>/Quickstart_webservice_wsaddressing</context-root>
+</jboss-web>
+




More information about the jboss-svn-commits mailing list