[jboss-svn-commits] JBL Code SVN: r23585 - in labs/jbossesb/branches/JBESB_4_4_GA_CP: product/etc/schemas/xml and 5 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Oct 24 20:20:23 EDT 2008
Author: kevin.conner at jboss.com
Date: 2008-10-24 20:20:23 -0400 (Fri, 24 Oct 2008)
New Revision: 23585
Added:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingContext.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingHandler.java
Modified:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/docs/ProgrammersGuide.odt
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/etc/schemas/xml/jbossesb-1.0.1.xsd
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/META-INF/jboss-esb.xml
labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/esb-jbm-service.xml
labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/esb-jbmq-service.xml
labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUtil.java
Log:
Add support for WS-A: JBESB-2025
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/docs/ProgrammersGuide.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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">
Added: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingContext.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingContext.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingContext.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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) ;
+ }
+}
Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingContext.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingHandler.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingHandler.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingHandler.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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 ;
+ }
+}
Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/AddressingHandler.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -258,7 +258,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/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -48,9 +48,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 Service service)
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" ;
final Actions actions = service.getActions() ;
if (actions != null)
@@ -89,12 +92,14 @@
}
requestLocation = actions.getRequestLocation() ;
responseLocation = actions.getResponseLocation() ;
+ addressing = actions.getAddressing() ;
}
else
{
isOneWay = false ;
requestLocation = null ;
responseLocation = null ;
+ addressing = false ;
}
}
@@ -150,10 +155,14 @@
return namespace ;
}
- public String getAction() {
- return action ;
+ public String getRequestAction() {
+ return requestAction ;
}
+ public String getResponseAction() {
+ return responseAction ;
+ }
+
public boolean isOneWay() {
return isOneWay ;
}
@@ -166,6 +175,10 @@
return responseLocation ;
}
+ public boolean isAddressing() {
+ return addressing ;
+ }
+
static
{
DEFAULT_ENCODING = AccessController.doPrivileged(new PrivilegedAction<String>() {
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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;
@@ -90,6 +95,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
@@ -506,15 +526,24 @@
final String wsdl = ESBContractGenerator.generateWSDL(service, serviceInfo) ;
addFile(zos, serviceInfo.getWSDLFileName(), wsdl) ;
+ 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) ;
// Filter...
// At the moment we only need the filter to overcome a bug in JBossWS re In-Only endpoints, so
- // we only include for one way services...
- if(mep == MepType.ONE_WAY) {
+ // we only include for one way services
+ if(serviceInfo.isOneWay())
+ {
String filterName = serviceInfo.getServletName() + "_Filter";
filterDefinitions.append("<filter><filter-name>") ;
@@ -697,4 +726,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/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/META-INF/jboss-esb.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/META-INF/jboss-esb.xml 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/META-INF/jboss-esb.xml 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/esb-jbm-service.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/esb-jbm-service.xml 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/esb-jbm-service.xml 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/esb-jbmq-service.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/esb-jbmq-service.xml 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/ebws/esb-jbmq-service.xml 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUtil.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUtil.java 2008-10-24 17:24:58 UTC (rev 23584)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUtil.java 2008-10-25 00:20:23 UTC (rev 23585)
@@ -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