[jboss-svn-commits] JBL Code SVN: r25084 - in labs/jbossesb/trunk: product/etc/schemas/xml and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Feb 3 15:24:36 EST 2009


Author: kevin.conner at jboss.com
Date: 2009-02-03 15:24:36 -0500 (Tue, 03 Feb 2009)
New Revision: 25084

Added:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingContext.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingHandler.java
Modified:
   labs/jbossesb/trunk/product/docs/ProgrammersGuide.odt
   labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.1.0.xsd
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebserviceInfo.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java
   labs/jbossesb/trunk/qa/junit/resources/server/ebws/META-INF/jboss-esb.xml
   labs/jbossesb/trunk/qa/junit/resources/server/ebws/esb-jbm-service.xml
   labs/jbossesb/trunk/qa/junit/resources/server/ebws/esb-jbmq-service.xml
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUtil.java
Log:
Add support to EBWS for WS-A: JBESB-2025

Modified: labs/jbossesb/trunk/product/docs/ProgrammersGuide.odt
===================================================================
(Binary files differ)

Modified: labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.1.0.xsd
===================================================================
--- labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.1.0.xsd	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.1.0.xsd	2009-02-03 20:24:36 UTC (rev 25084)
@@ -371,6 +371,7 @@
                         <xsd:attribute name="faultXsd" type="xsd:string" />
                         <xsd:attribute name="webservice" type="xsd:boolean" default="true"/>
                         <xsd:attribute name="validate" type="xsd:boolean" default="false"/>
+                        <xsd:attribute name="addressing" type="xsd:boolean" default="false"/>
 		</xsd:complexType>
 	</xsd:element>
 	<xsd:element name="action">

Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingContext.java (from rev 23585, labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingContext.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingContext.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingContext.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.internal.soa.esb.webservice;
+
+import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
+
+
+/**
+ * This is the addressing context for the current thread.
+ * @author kevin
+ */
+public class AddressingContext
+{
+    private static final ThreadLocal<SOAPAddressingProperties> CONTEXT = new ThreadLocal<SOAPAddressingProperties>() ;
+    
+    public static SOAPAddressingProperties getAddressingProperties()
+    {
+        return CONTEXT.get() ;
+    }
+    
+    public static void setAddressingProperties(final SOAPAddressingProperties addressingProperties)
+    {
+        CONTEXT.set(addressingProperties) ;
+    }
+}

Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingHandler.java (from rev 23585, labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingHandler.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingHandler.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingHandler.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -0,0 +1,91 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.internal.soa.esb.webservice;
+
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+
+/**
+ * The addressing handler for capturing the current 
+ * @author kevin
+ */
+public class AddressingHandler implements SOAPHandler<SOAPMessageContext>
+{
+    public Set<QName> getHeaders()
+    {
+        return null;
+    }
+
+    public void close(final MessageContext context)
+    {
+    }
+
+    public boolean handleFault(final SOAPMessageContext context)
+    {
+        return true;
+    }
+
+    public boolean handleMessage(final SOAPMessageContext context)
+    {
+        final Boolean outbound = (Boolean)context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY) ;
+        if (outbound == null)
+        {
+           throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY) ;
+        }
+
+        if (outbound)
+        {
+            return handleResponse(context) ;
+        }
+        else
+        {
+            return handleRequest(context) ;
+        }
+    }
+    
+    private boolean handleRequest(final SOAPMessageContext context)
+    {
+        final SOAPAddressingProperties props =  (SOAPAddressingProperties) context.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND) ;
+        AddressingContext.setAddressingProperties(props) ;
+        
+        return true ;
+    }
+    
+    private boolean handleResponse(final SOAPMessageContext context)
+    {
+        final SOAPAddressingProperties props = AddressingContext.getAddressingProperties() ;
+        if (props != null)
+        {
+            context.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, props) ;
+            context.setScope(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION) ;
+        }
+        return true ;
+    }
+}

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -38,6 +38,8 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.ws.Provider;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
 
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.client.ServiceInvoker;
@@ -67,20 +69,26 @@
     private static final boolean RETURN_STACK_TRACES ;
     private static final Logger LOGGER = Logger.getLogger(BaseWebService.class);
 
+    private static AddressingBuilder ADDRESSING_BUILDER = AddressingBuilder.getAddressingBuilder() ;
+    
     protected final ServiceInvoker serviceInvoker ;
-    protected MessagePayloadProxy requestProxy ;
-    protected MessagePayloadProxy responseProxy ;
+    protected final MessagePayloadProxy requestProxy ;
+    protected final MessagePayloadProxy responseProxy ;
+    protected final String action ;
 
-    protected BaseWebService(final String category, final String name, final String requestLocation, final String responseLocation)
+    protected BaseWebService(final String category, final String name, final String requestLocation, final String responseLocation, final String action)
         throws MessageDeliverException
     {
         serviceInvoker = new ServiceInvoker(category, name) ;
         requestProxy = new MessagePayloadProxy(null, requestLocation) ;
         responseProxy = new MessagePayloadProxy(responseLocation, null) ;
+        this.action = action ;
     }
 
     public SOAPMessage invoke(final SOAPMessage request)
     {
+        final SOAPAddressingProperties soapIncomingProps = AddressingContext.getAddressingProperties() ;
+        
         final Message esbReq = MessageFactory.getInstance().getMessage() ;
         try
         {
@@ -128,10 +136,24 @@
                         false, false, true);
                 final SOAPMessage response = javax.xml.soap.MessageFactory.newInstance().createMessage();
                 response.getSOAPBody().addDocument(respDoc) ;
+                if (soapIncomingProps == null)
+                {
+                    AddressingContext.setAddressingProperties(null) ;
+                }
+                else
+                {
+                    final SOAPAddressingProperties soapOutgoingProps = (SOAPAddressingProperties) ADDRESSING_BUILDER.newAddressingProperties() ;
+                    if (action != null)
+                    {
+                        soapOutgoingProps.setAction(ADDRESSING_BUILDER.newURI(action)) ;
+                    }
+                    AddressingContext.setAddressingProperties(soapOutgoingProps) ;
+                }
                 return response ;
             }
             else
             {
+                AddressingContext.setAddressingProperties(null) ;
                 // We should be able to return null here but this causes JBossWS to NPE.
                 return javax.xml.soap.MessageFactory.newInstance().createMessage();
             }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -260,7 +260,7 @@
 		Operation op = (Operation) portType.getOperations().get(0);
 		bop.setOperation(op);
 		SOAPOperation soapOperation = new SOAPOperationImpl() ;
-		soapOperation.setSoapActionURI(serviceInfo.getAction()) ;
+		soapOperation.setSoapActionURI(serviceInfo.getResponseAction()) ;
 		bop.addExtensibilityElement(soapOperation) ;
 		
 		if (op.getInput() != null) {

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -47,9 +47,11 @@
 	private final String className ;
 	private final String namespace ;
 	private final boolean isOneWay ;
-	private final String action ;
+	private final String requestAction ;
+	private final String responseAction ;
 	private final String requestLocation ;
 	private final String responseLocation ;
+	private final boolean addressing ;
 	
 	public ESBServiceEndpointInfo(final WebserviceInfo webserviceInfo)
 			throws UnsupportedEncodingException {
@@ -70,7 +72,8 @@
 		packageName = "esb.ws." + serviceCategory + "." + serviceName ;
 		className = packageName + ".Implementation" ;
 		namespace = "http://soa.jboss.org/" + URLEncoder.encode(service.getCategory(), DEFAULT_ENCODING) ;
-		action = namespace + "/" + operationName ;
+		requestAction = namespace + "/" + operationName ;
+		responseAction = requestAction + "Resp" ;
 		
 		isOneWay = (webserviceInfo.getOutXsd() == null) ;
 		if (isOneWay)
@@ -86,6 +89,7 @@
 		}
 		requestLocation = webserviceInfo.getRequestLocation() ;
 		responseLocation = webserviceInfo.getResponseLocation() ;
+		addressing = webserviceInfo.isAddressing() ;
 	}
 
 	public String getRequestName() {
@@ -140,10 +144,14 @@
 		return namespace ;
 	}
 	
-	public String getAction() {
-		return action ;
+	public String getRequestAction() {
+		return requestAction ;
 	}
 	
+	public String getResponseAction() {
+		return responseAction ;
+	}
+	
 	public boolean isOneWay() {
 		return isOneWay ;
 	}
@@ -156,6 +164,10 @@
 		return responseLocation ;
 	}
 	
+	public boolean isAddressing() {
+		return addressing ;
+	}
+	
 	static
 	{
 		DEFAULT_ENCODING = AccessController.doPrivileged(new PrivilegedAction<String>() {
@@ -165,4 +177,4 @@
 			}
 		}) ;
 	}
-}
\ No newline at end of file
+}

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -52,7 +52,7 @@
 		}
 	}
 	
-	public byte[] generate(final String category, final String service, final ESBServiceEndpointInfo epInfo)
+	public byte[] generate(final String category, final String service, final ESBServiceEndpointInfo epInfo, final boolean includeHandlers)
 			throws WebServicePublishException {
 		try {
 			pool.get(epInfo.getClassName());
@@ -100,10 +100,20 @@
 			annotation2.addMemberValue("value", enumValue);
 			attribute.addAnnotation(annotation2);
 			
+			if (includeHandlers)
+			{
+				final Annotation handlerChainAnnotation = new Annotation("javax.jws.HandlerChain", constantPool) ;
+				final StringMemberValue handlerValue = new StringMemberValue(constantPool) ;
+				handlerValue.setValue("esb-jaxws-handlers.xml") ;
+				handlerChainAnnotation.addMemberValue("file", handlerValue) ;
+				attribute.addAnnotation(handlerChainAnnotation) ;
+			}
+			
 			seiClass.getClassFile().addAttribute(attribute);
 			
 			final String constructorStr = "super(\"" +category + "\",\"" + service + "\"," +
-				getParamValue(epInfo.getRequestLocation()) + "," + getParamValue(epInfo.getResponseLocation()) + ");" ;
+				getParamValue(epInfo.getRequestLocation()) + "," + getParamValue(epInfo.getResponseLocation()) + ", \"" + 
+				epInfo.getResponseAction() + "\");" ;
 			CtConstructor defaultConstructor = new CtConstructor(null, seiClass) ;
 			defaultConstructor.setBody(constructorStr) ;
 			seiClass.addConstructor(defaultConstructor) ;

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -30,10 +30,10 @@
  */
 public class OneWayBaseWebService extends BaseWebService
 {
-    protected OneWayBaseWebService(final String category, final String name, final String requestLocation, final String responseLocation)
+    protected OneWayBaseWebService(final String category, final String name, final String requestLocation, final String responseLocation, final String action)
         throws MessageDeliverException
     {
-        super(category, name, requestLocation, responseLocation) ;
+        super(category, name, requestLocation, responseLocation, action) ;
     }
     
     @Override

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -40,10 +40,10 @@
     private static final long TIMEOUT ;
     private static final Logger LOGGER = Logger.getLogger(RequestResponseBaseWebService.class) ;
     
-    protected RequestResponseBaseWebService(final String category, final String name, final String requestLocation, final String responseLocation)
+    protected RequestResponseBaseWebService(final String category, final String name, final String requestLocation, final String responseLocation, final String action)
         throws MessageDeliverException
     {
-        super(category, name, requestLocation, responseLocation) ;
+        super(category, name, requestLocation, responseLocation, action) ;
     }
     
     @Override

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -49,7 +49,12 @@
 import org.jboss.deployment.SubDeployerSupport;
 import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
 import org.jboss.internal.soa.esb.util.XMLHelper;
-import org.jboss.internal.soa.esb.webservice.*;
+import org.jboss.internal.soa.esb.webservice.AddressingHandler;
+import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
+import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
+import org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher;
+import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
+import org.jboss.internal.soa.esb.webservice.JAXWSProviderClassGenerator;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.MetaData;
 import org.jboss.metadata.XmlFileLoader;
@@ -86,6 +91,21 @@
    private static final String PREFIX_CANONICAL_NAME = "jboss.esb:deployment=" ;
    private static final String ESB_ARTIFACT_NAME = "jbossesb.esb" ;
    
+   private final String HANDLER_CHAIN_PREFIX = "<?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>" ;
+   private final String HANDLER_CHAIN_POSTFIX = "</handler-chain></handler-chains>" ;
+   private final String HANDLER_PREFIX = "<handler><handler-name>" ;
+   private final String HANDLER_MIDDLE = "</handler-name><handler-class>" ;
+   private final String HANDLER_POSTFIX = "</handler-class></handler>" ;
+   
+   private final String WSADDR_NAME = "WSAddressing Handler" ;
+   private final String WSADDR_HANDLER = "org.jboss.ws.extensions.addressing.jaxws.WSAddressingServerHandler" ;
+   
+   private final String WSADDR_CONTEXT_NAME = "WSAddressing Context Handler" ;
+   private final String WSADDR_CONTEXT_HANDLER = AddressingHandler.class.getName() ;
+   
    /**
     * Default CTOR used to set default values to the Suffixes and RelativeOrder
     * attributes. Those are read at subdeployer registration time by the MainDeployer
@@ -469,8 +489,16 @@
                        addFile(zos, serviceInfo.getWSDLFileName(), wsdl) ;
                        
                        final Service service = webserviceInfo.getService() ;
+                       final String handlers = getHandlers(serviceInfo) ;
+                       final boolean includeHandlers = (handlers != null) ;
+                       if (includeHandlers)
+                       {
+                           final String wsHandlerName = "WEB-INF/classes/" + serviceInfo.getPackageName().replace('.', '/') + "/esb-jaxws-handlers.xml" ;
+                           addFile(zos, wsHandlerName, handlers) ;
+                       }
+                       
                        final byte[] wsClass = generator.generate(service.getCategory(),
-                           service.getName(), serviceInfo) ;
+                           service.getName(), serviceInfo, includeHandlers) ;
                        final String wsClassName = serviceInfo.getClassName().replace('.', '/') + ".class" ;
                        addFile(zos, "WEB-INF/classes/" + wsClassName, wsClass) ;
 
@@ -659,4 +687,26 @@
     {
         esbNames.remove(deploymentName) ;
     }
+    
+    private String getHandlers(final ESBServiceEndpointInfo serviceInfo)
+    {
+        final String result ;
+        
+        if (!serviceInfo.isAddressing())
+        {
+            result = null ;
+        }
+        else
+        {
+            final StringBuilder sb = new StringBuilder(HANDLER_CHAIN_PREFIX) ;
+            if (serviceInfo.isAddressing())
+            {
+                sb.append(HANDLER_PREFIX).append(WSADDR_CONTEXT_NAME).append(HANDLER_MIDDLE).append(WSADDR_CONTEXT_HANDLER).append(HANDLER_POSTFIX) ;
+                sb.append(HANDLER_PREFIX).append(WSADDR_NAME).append(HANDLER_MIDDLE).append(WSADDR_HANDLER).append(HANDLER_POSTFIX) ;
+            }
+            sb.append(HANDLER_CHAIN_POSTFIX) ;
+            result = sb.toString() ;
+        }
+        return result ;
+    }
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebserviceInfo.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebserviceInfo.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebserviceInfo.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -60,6 +60,10 @@
      * The response location within the message.
      */
     private final String responseLocation ;
+    /**
+     * Flag indicating the endpoint requires addressing.
+     */
+    private final boolean addressing ;
 
     /**
      * Construct the webservice information.
@@ -73,7 +77,7 @@
     public WebserviceInfo(final Service service, final String inXsd, final String outXsd,
         final String faultXsd, final String description, final boolean requestResponse)
     {
-        this(service, inXsd, outXsd, faultXsd, description, requestResponse, null, null) ;
+        this(service, inXsd, outXsd, faultXsd, description, requestResponse, null, null, false) ;
     }
     
     /**
@@ -86,10 +90,11 @@
      * @param requestResponse The service request/response flag.
      * @param requestLocation The request location within the message.
      * @param responseLocation The response location within the message.
+     * @param addressing Does the endpoint require addressing?
      */
     public WebserviceInfo(final Service service, final String inXsd, final String outXsd,
         final String faultXsd, final String description, final boolean requestResponse,
-        final String requestLocation, final String responseLocation)
+        final String requestLocation, final String responseLocation, final boolean addressing)
     {
         this.service = service ;
         this.inXsd = inXsd ;
@@ -99,6 +104,7 @@
         this.requestResponse = requestResponse ;
         this.requestLocation = requestLocation ;
         this.responseLocation = responseLocation ;
+        this.addressing = addressing ;
     }
 
     /**
@@ -174,6 +180,15 @@
     }
 
     /**
+     * Does the endpoint require addressing?
+     * @return
+     */
+    public boolean isAddressing()
+    {
+        return addressing ;
+    }
+
+    /**
      * Test for equality.
      * @param obj The object to compare with
      * @return true if equal, false otherwise.
@@ -188,7 +203,8 @@
                 objEquals(description, webserviceInfo.description) &&
                 (requestResponse == webserviceInfo.isRequestResponse()) &&
                 objEquals(requestLocation, webserviceInfo.requestLocation) &&
-                objEquals(responseLocation, webserviceInfo.responseLocation)) ;
+                objEquals(responseLocation, webserviceInfo.responseLocation) &&
+                (addressing == webserviceInfo.isAddressing())) ;
         }
 
         return false ;
@@ -201,7 +217,7 @@
     public int hashCode()
     {
         return service.hashCode() ^ objHash(inXsd) ^ objHash(outXsd) ^ objHash(faultXsd) & objHash(description) ^ (requestResponse ? 0xdeafdeaf : 0) ^
-            objHash(requestLocation) ^ objHash(responseLocation) ;
+            objHash(requestLocation) ^ objHash(responseLocation)  ^ (addressing ? 0xfeedfeed : 0);
     }
 
     /**
@@ -210,7 +226,9 @@
      */
     public String toString()
     {
-        return service + objName("inXsd", inXsd) + objName("outXsd", outXsd) + objName("faultXsd" , faultXsd) + objName("description" , description) + (requestResponse ? ",requestResponse" : "") ;
+        return service + objName("inXsd", inXsd) + objName("outXsd", outXsd) + objName("faultXsd" , faultXsd) + objName("description" , description) +
+            (requestResponse ? ",requestResponse" : "") + objName("requestLocation", requestLocation) + objName("responseLocation", responseLocation) +
+            (addressing ? ", addressing" : "") ;
     }
 
     /**

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -516,7 +516,7 @@
                                 new org.jboss.soa.esb.Service(service.getCategory(), service.getName()),
                                 actions.getInXsd(), actions.getOutXsd(), actions.getFaultXsd(),
                                 service.getDescription(), MepType.REQUEST_RESPONSE.equals(actions.getMep()),
-                                actions.getRequestLocation(), actions.getResponseLocation()) ;
+                                actions.getRequestLocation(), actions.getResponseLocation(), actions.getAddressing()) ;
                             endpointServices.add(webserviceInfo) ;
                         }
                     }

Modified: labs/jbossesb/trunk/qa/junit/resources/server/ebws/META-INF/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/ebws/META-INF/jboss-esb.xml	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/qa/junit/resources/server/ebws/META-INF/jboss-esb.xml	2009-02-03 20:24:36 UTC (rev 25084)
@@ -8,6 +8,9 @@
       <jms-bus busid="ebws_channel2">
         <jms-message-filter dest-type="QUEUE" dest-name="queue/ebws2"/>
       </jms-bus>
+      <jms-bus busid="ebws_channel3">
+        <jms-message-filter dest-type="QUEUE" dest-name="queue/ebws3"/>
+      </jms-bus>
     </jms-jca-provider>
   </providers>
 
@@ -28,5 +31,13 @@
         <action name="logAction" class="org.jboss.soa.esb.server.ebws.LogMessageAction"/>
       </actions>
     </service>
+    <service category="TestEBWS" name="addressing" description="EBWS addressing service">
+      <listeners>
+        <jms-listener name="JBPM-ESBListener" busidref="ebws_channel3" maxThreads="1"/>
+      </listeners>
+      <actions inXsd='/request.xsd' outXsd='/response.xsd' validate='true' requestLocation='REQUEST_LOCATION' responseLocation='RESPONSE_LOCATION' addressing='true'>
+        <action name="logAction" class="org.jboss.soa.esb.server.ebws.LogMessageAction"/>
+      </actions>
+    </service>
   </services>
 </jbossesb>

Modified: labs/jbossesb/trunk/qa/junit/resources/server/ebws/esb-jbm-service.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/ebws/esb-jbm-service.xml	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/qa/junit/resources/server/ebws/esb-jbm-service.xml	2009-02-03 20:24:36 UTC (rev 25084)
@@ -24,4 +24,16 @@
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.messaging:service=PostOffice</depends>
    </mbean>
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.esb.qa.junit.destination:service=Queue,name=ebws3"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.esb.qa.junit.destination:service=Queue,name=ebws3_reply"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
 </server>

Modified: labs/jbossesb/trunk/qa/junit/resources/server/ebws/esb-jbmq-service.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/ebws/esb-jbmq-service.xml	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/qa/junit/resources/server/ebws/esb-jbmq-service.xml	2009-02-03 20:24:36 UTC (rev 25084)
@@ -24,4 +24,16 @@
       jboss.mq:service=DestinationManager
     </depends>
   </mbean>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.qa.junit.destination:service=Queue,name=ebws3">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.qa.junit.destination:service=Queue,name=ebws3_reply">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
 </server>

Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -135,6 +135,16 @@
         runSoapRequestTest(EBWSUtil.ALTERNATE_SOAP_ENDPOINT) ;
     }
     
+    /**
+     * Test for normal valid response through SOAP with addressing.
+     * @throws Exception for any failures.
+     */
+    public void testNormalSoapAddressingRequest()
+        throws Exception
+    {
+        runSoapAddressingRequestTest(EBWSUtil.NORMAL_SOAP_ADDRESSING_ENDPOINT) ;
+    }
+    
     private void runRequestResponseTest(final String requestLocation, final String responseLocation, final String name)
         throws Exception
     {
@@ -247,6 +257,27 @@
         assertTrue("Response log message", StringUtils.compareXMLContent(EBWSUtil.VALID_RESPONSE, logs[1])) ;
     }
     
+    private void runSoapAddressingRequestTest(final String endpoint)
+        throws Exception
+    {
+        final HttpClient httpClient = new HttpClient() ;
+        final PostMethod postMethod = new PostMethod(endpoint) ;
+        final StringRequestEntity request = new StringRequestEntity(EBWSUtil.SOAP_ADDRESSING_REQUEST) ;
+        postMethod.setRequestEntity(request) ;
+        
+        httpClient.executeMethod(postMethod) ;
+        final String response = postMethod.getResponseBodyAsString() ;
+        System.out.println("Response is " + response) ;
+        assertNotNull("XML response", response) ;
+        assertTrue("XML response", response.contains("http://soa.jboss.org/TestEBWS/addressingOpResp")) ;
+
+        final String[] logs = waitForMessages(2) ;
+        assertNotNull("Log message", logs) ;
+        assertEquals("Log count", 2, logs.length) ;
+        assertTrue("Request log message", StringUtils.compareXMLContent(EBWSUtil.VALID_REQUEST, logs[0])) ;
+        assertTrue("Response log message", StringUtils.compareXMLContent(EBWSUtil.VALID_RESPONSE, logs[1])) ;
+    }
+    
     /**
      * Create the test suite.
      * @return The suite representing this test case.

Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUtil.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUtil.java	2009-02-03 20:15:55 UTC (rev 25083)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUtil.java	2009-02-03 20:24:36 UTC (rev 25084)
@@ -50,9 +50,21 @@
 
     public static final String SOAP_RESPONSE = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
             "<soap:Header/><soap:Body>" + VALID_RESPONSE + "</soap:Body></soap:Envelope>" ;
+    
+    public static final String SOAP_ADDRESSING_REQUEST = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+        "<soap:Header xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">" +
+            "<wsa:MessageID>urn:esb:1234567</wsa:MessageID>" +
+            "<wsa:To>http://example.com/To</wsa:To>" +
+            "<wsa:Action>http://example.com/Action</wsa:Action>" +
+        "</soap:Header>" +
+        "<soap:Body>" + VALID_REQUEST + "</soap:Body></soap:Envelope>" ; 
 
+    public static final String SOAP_ADDRESSING_RESPONSE = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+            "<soap:Header/><soap:Body>" + VALID_RESPONSE + "</soap:Body></soap:Envelope>" ;
+
     public static final String NORMAL_SOAP_ENDPOINT = "http://127.0.0.1:8080/ebws-test/TestEBWS/normal" ; 
     public static final String ALTERNATE_SOAP_ENDPOINT = "http://127.0.0.1:8080/ebws-test/TestEBWS/alternate" ; 
+    public static final String NORMAL_SOAP_ADDRESSING_ENDPOINT = "http://127.0.0.1:8080/ebws-test/TestEBWS/addressing" ; 
     
     public static EBWSServerMBean getEBWSServerMBean()
         throws MalformedObjectNameException




More information about the jboss-svn-commits mailing list