Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 77150 invoked from network); 4 Feb 2008 23:23:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Feb 2008 23:23:42 -0000 Received: (qmail 89624 invoked by uid 500); 4 Feb 2008 23:23:33 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 89577 invoked by uid 500); 4 Feb 2008 23:23:33 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 89568 invoked by uid 99); 4 Feb 2008 23:23:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Feb 2008 15:23:33 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Feb 2008 23:23:12 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 13AFD1A9832; Mon, 4 Feb 2008 15:23:02 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r618489 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/message/ common/schemas/src/main/resources/schemas/wsdl/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/frontend/jaxws/sr... Date: Mon, 04 Feb 2008 23:22:58 -0000 To: cxf-commits@incubator.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080204232302.13AFD1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Mon Feb 4 15:22:57 2008 New Revision: 618489 URL: http://svn.apache.org/viewvc?rev=618489&view=rev Log: Bunch of updates to get the JAX-WS WSA support properly working Added required flag to MAPAggregator and WSAddressingFeature to force it to be required Update to latest ws-addr-wsdl version. (Still need to write a compatibility thing for the old version) Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java incubator/cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/ws-addr-wsdl.xsd incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/resources/hello_world_soap_http_infoset.xml incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/add_numbers_expected.wsdl Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java (original) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java Mon Feb 4 15:22:57 2008 @@ -39,7 +39,9 @@ private InterceptorChain interceptorChain; private Map, Object> contents = new IdentityHashMap, Object>(6); - + public MessageImpl() { + //nothing + } public Collection getAttachments() { return attachments; Modified: incubator/cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/ws-addr-wsdl.xsd URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/ws-addr-wsdl.xsd?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/ws-addr-wsdl.xsd (original) +++ incubator/cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/ws-addr-wsdl.xsd Mon Feb 4 15:22:57 2008 @@ -1,51 +1,69 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - + $Id: ws-addr-wsdl.xsd,v 1.2 2006/05/12 09:46:04 hugo Exp $ +--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java (original) +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java Mon Feb 4 15:22:57 2008 @@ -95,8 +95,8 @@ try { chain.doIntercept(faultMessage); } catch (Exception exc) { - LogUtils.log(LOG, Level.SEVERE, "Error occurred during error handling, give up!", exc); - throw new RuntimeException(exc.getCause()); + LOG.log(Level.SEVERE, "Error occurred during error handling, give up!", exc); + throw new RuntimeException(exc); } } finally { BusFactory.setThreadDefaultBus(origBus); Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java (original) +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java Mon Feb 4 15:22:57 2008 @@ -360,6 +360,7 @@ buildBindingInput(def, bindingOperation, bindingOperationInfo.getInput()); buildBindingOutput(def, bindingOperation, bindingOperationInfo.getOutput()); buildBindingFault(def, bindingOperation, bindingOperationInfo.getFaults()); + addExtensibilityAttributes(bindingOperation, bindingOperationInfo.getExtensionAttributes()); addExtensibilityElements(bindingOperation, getWSDL11Extensors(bindingOperationInfo)); binding.addBindingOperation(bindingOperation); } @@ -373,6 +374,7 @@ bindingFault = def.createBindingFault(); bindingFault.setName(bindingFaultInfo.getFaultInfo().getFaultName().getLocalPart()); bindingOperation.addBindingFault(bindingFault); + addExtensibilityAttributes(bindingFault, bindingFaultInfo.getExtensionAttributes()); addExtensibilityElements(bindingFault, getWSDL11Extensors(bindingFaultInfo)); } @@ -385,6 +387,7 @@ bindingInput = def.createBindingInput(); bindingInput.setName(bindingMessageInfo.getMessageInfo().getName().getLocalPart()); bindingOperation.setBindingInput(bindingInput); + addExtensibilityAttributes(bindingInput, bindingMessageInfo.getExtensionAttributes()); addExtensibilityElements(bindingInput, getWSDL11Extensors(bindingMessageInfo)); } } @@ -396,6 +399,7 @@ bindingOutput = def.createBindingOutput(); bindingOutput.setName(bindingMessageInfo.getMessageInfo().getName().getLocalPart()); bindingOperation.setBindingOutput(bindingOutput); + addExtensibilityAttributes(bindingOutput, bindingMessageInfo.getExtensionAttributes()); addExtensibilityElements(bindingOutput, getWSDL11Extensors(bindingMessageInfo)); } } Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Mon Feb 4 15:22:57 2008 @@ -191,7 +191,9 @@ Fault fault = (Fault)exp; soapFault.setFaultCode(fault.getFaultCode()); soapFault.setFaultString(fault.getMessage()); - throw new SOAPFaultException(soapFault); + SOAPFaultException ex = new SOAPFaultException(soapFault); + ex.initCause(exp); + throw ex; } catch (SOAPException e) { throw new WebServiceException(e); } Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java Mon Feb 4 15:22:57 2008 @@ -20,14 +20,18 @@ package org.apache.cxf.jaxws.handler.soap; import java.net.URI; +import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Set; import javax.xml.namespace.QName; +import javax.xml.soap.Node; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPMessage; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; @@ -59,6 +63,7 @@ import org.apache.cxf.phase.PhaseInterceptorChain; import org.apache.cxf.staxutils.StaxUtils; import org.apache.cxf.transport.MessageObserver; +import org.apache.cxf.ws.addressing.Names; public class SOAPHandlerInterceptor extends AbstractProtocolHandlerInterceptor implements @@ -214,6 +219,32 @@ ContextPropertiesMapping.mapCxf2Jaxws(message.getExchange(), sm, requestor); Exchange exch = message.getExchange(); setupBindingOperationInfo(exch, sm); + SOAPMessage msg = sm.getMessage(); + try { + List params = new ArrayList(); + message.put(MessageContext.REFERENCE_PARAMETERS, params); + SOAPHeader head = msg.getSOAPHeader(); + if (head != null) { + Iterator it = CastUtils.cast(head.getChildElements()); + while (it != null && it.hasNext()) { + Node nd = it.next(); + if (nd instanceof SOAPElement) { + SOAPElement el = (SOAPElement)nd; + if (el.hasAttributeNS(Names.WSA_NAMESPACE_NAME, "IsReferenceParameter") + && ("1".equals(el.getAttributeNS(Names.WSA_NAMESPACE_NAME, + "IsReferenceParameter")) + || Boolean.parseBoolean(el.getAttributeNS(Names.WSA_NAMESPACE_NAME, + "IsReferenceParameter")))) { + params.add(el); + } + } + } + } + } catch (SOAPException e) { + throw new Fault(e); + } + + return sm; } Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java Mon Feb 4 15:22:57 2008 @@ -167,6 +167,11 @@ List portExtensors = endpoint.getExtensors(ExtensibilityElement.class); if (hasUsingAddressing(bindingExtensors) || hasUsingAddressing(portExtensors)) { + WSAddressingFeature feature = new WSAddressingFeature(); + if (addressingRequired(bindingExtensors) + || addressingRequired(portExtensors)) { + feature.setAddressingRequired(true); + } addAddressingFeature(new WSAddressingFeature()); } } @@ -183,6 +188,21 @@ } return found; } + private boolean addressingRequired(List exts) { + boolean found = false; + if (exts != null) { + Iterator extensionElements = exts.iterator(); + while (extensionElements.hasNext() && !found) { + ExtensibilityElement ext = + (ExtensibilityElement)extensionElements.next(); + if (JAXWSAConstants.WSAW_USINGADDRESSING_QNAME.equals(ext.getElementType()) + && ext.getRequired() != null) { + return ext.getRequired(); + } + } + } + return false; + } private void buildWsdlExtensibilities(BindingInfo bindingInfo) { Addressing addressing = getAddressing(); @@ -190,9 +210,11 @@ ExtensionRegistry extensionRegistry = getBus().getExtension(WSDLManager.class) .getExtenstionRegistry(); try { - bindingInfo.addExtensor(extensionRegistry.createExtension(javax.wsdl.Binding.class, - JAXWSAConstants. - WSAW_USINGADDRESSING_QNAME)); + ExtensibilityElement el = extensionRegistry.createExtension(javax.wsdl.Binding.class, + JAXWSAConstants. + WSAW_USINGADDRESSING_QNAME); + el.setRequired(addressing.required()); + bindingInfo.addExtensor(el); } catch (WSDLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -233,23 +255,27 @@ return; } if (addressing.isEnabled()) { - addAddressingFeature(new WSAddressingFeature()); + WSAddressingFeature feature = getWSAddressingFeature(); + if (feature == null) { + feature = new WSAddressingFeature(); + addAddressingFeature(feature); + } + feature.setAddressingRequired(addressing.isRequired()); } else { removeAddressingFeature(); } } - private AbstractFeature getWSAddressingFeature() { + private WSAddressingFeature getWSAddressingFeature() { if (features == null) { return null; } - AbstractFeature addressing = null; for (AbstractFeature f : features) { if (f instanceof WSAddressingFeature) { - addressing = f; + return (WSAddressingFeature)f; } } - return addressing; + return null; } private void addAddressingFeature(AbstractFeature a) { Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Mon Feb 4 15:22:57 2008 @@ -31,7 +31,6 @@ import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlSchema; import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.namespace.QName; import javax.xml.ws.Action; import javax.xml.ws.AsyncHandler; import javax.xml.ws.BindingType; @@ -192,7 +191,7 @@ @Override protected void initializeWSDLOperation(InterfaceInfo intf, OperationInfo o, Method method) { method = ((JaxWsServiceConfiguration)jaxWsConfiguration).getDeclaredMethod(method); - + o.setProperty(Method.class.getName(), method); initializeWrapping(o, method); try { @@ -393,35 +392,46 @@ private FaultInfo getFaultInfo(final OperationInfo operation, final Class expClass) { for (FaultInfo fault : operation.getFaults()) { - if (fault.getProperty(Class.class.getName()) == expClass) { + if (fault.getProperty(Class.class.getName()) == expClass + || fault.getProperty(Class.class.getName()) == expClass) { return fault; } } return null; } - private void buildWSAActions(OperationInfo operation, Method method) { + //nothing + if (method == null) { + return; + } + Action action = method.getAnnotation(Action.class); if (action == null) { return; } - String ns = operation.getName().getNamespaceURI(); MessageInfo input = operation.getInput(); - if (action.input() != null) { - input.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, new QName(ns, action.input())); + if (!StringUtils.isEmpty(action.input())) { + input.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, action.input()); } MessageInfo output = operation.getOutput(); - if (output != null && action.output() != null) { - output.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, new QName(ns, action.output())); + if (output != null && !StringUtils.isEmpty(action.output())) { + output.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, action.output()); } FaultAction[] faultActions = action.fault(); - if (faultActions != null && operation.getFaults() != null) { + if (faultActions != null + && faultActions.length > 0 + && operation.getFaults() != null) { for (FaultAction faultAction : faultActions) { FaultInfo faultInfo = getFaultInfo(operation, faultAction.className()); faultInfo.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, - new QName(ns, faultAction.value())); + faultAction.value()); + if (operation.isUnwrappedCapable()) { + faultInfo = getFaultInfo(operation.getUnwrappedOperation(), faultAction.className()); + faultInfo.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, + faultAction.value()); + } } } } Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java (original) +++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java Mon Feb 4 15:22:57 2008 @@ -37,6 +37,7 @@ import org.apache.cxf.service.factory.ReflectionServiceFactoryBean; import org.apache.cxf.service.factory.ServiceConstructionException; import org.apache.cxf.service.model.BindingInfo; +import org.apache.cxf.service.model.BindingOperationInfo; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.service.model.ServiceModelUtil; import org.apache.cxf.transport.ConduitInitiator; @@ -296,8 +297,13 @@ bindingFactory = mgr.getBindingFactory(binding); - return bindingFactory.createBindingInfo(serviceFactory.getService(), + BindingInfo inf = bindingFactory.createBindingInfo(serviceFactory.getService(), binding, bindingConfig); + + for (BindingOperationInfo boi : inf.getOperations()) { + serviceFactory.updateBindingOperation(boi); + } + return inf; } catch (BusException ex) { throw new ServiceConstructionException( new Message("COULD.NOT.RESOLVE.BINDING", LOG, bindingId), ex); Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original) +++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Mon Feb 4 15:22:57 2008 @@ -248,6 +248,9 @@ for (ServiceInfo inf : service.getServiceInfos()) { for (EndpointInfo ei : inf.getEndpoints()) { + for (BindingOperationInfo boi : ei.getBinding().getOperations()) { + updateBindingOperation(boi); + } try { bfm.getBindingFactory(ei.getBinding().getBindingId()); } catch (BusException e1) { @@ -263,6 +266,10 @@ } } } + } + + public void updateBindingOperation(BindingOperationInfo boi) { + //nothing } public Endpoint createEndpoint(EndpointInfo ei) throws EndpointException { Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java (original) +++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java Mon Feb 4 15:22:57 2008 @@ -20,22 +20,16 @@ package org.apache.cxf.ws.addressing; -import java.lang.reflect.Method; import java.util.Map; import java.util.UUID; import java.util.concurrent.Executor; import java.util.logging.Level; import java.util.logging.Logger; -import javax.jws.WebMethod; -import javax.jws.WebService; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.namespace.QName; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; -import javax.xml.ws.WebFault; import org.apache.cxf.Bus; import org.apache.cxf.binding.soap.model.SoapOperationInfo; @@ -50,9 +44,11 @@ import org.apache.cxf.interceptor.OutgoingChainInterceptor; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.Message; +import org.apache.cxf.service.model.BindingFaultInfo; import org.apache.cxf.service.model.BindingOperationInfo; +import org.apache.cxf.service.model.Extensible; +import org.apache.cxf.service.model.FaultInfo; import org.apache.cxf.service.model.MessageInfo; -import org.apache.cxf.service.model.OperationInfo; import org.apache.cxf.transport.Conduit; import org.apache.cxf.transport.Destination; import org.apache.cxf.workqueue.OneShotAsyncExecutor; @@ -79,10 +75,8 @@ private static final EndpointReferenceType NONE_ENDPOINT_REFERENCE = EndpointReferenceUtils.getEndpointReference(Names.WSA_NONE_ADDRESS); - private static final String HTTP_URI_SCHEME = "http:"; - private static final String URI_AUTHORITY_PREFIX = "//"; - private static final Map ACTION_MAP = - new TwoStageMap(); + private static final Map ACTION_MAP = + new TwoStageMap(); private static final Logger LOG = LogUtils.getL7dLogger(ContextUtils.class); @@ -651,14 +645,6 @@ // pick up the wsaw:Action attribute by walking the WSDL model // directly action = getActionFromServiceModel(message, fault); - - if (action == null) { - Method method = getMethod(message); - LOG.fine("method: " + method + ", fault: " + fault); - if (method != null) { - action = getActionFromAnnotations(message, method, fault); - } - } LOG.fine("action: " + action); return action != null ? getAttributedURI(action) : null; } @@ -672,10 +658,13 @@ private static String getActionFromServiceModel(Message message, Exception fault) { String action = null; - if (fault == null) { - BindingOperationInfo bindingOpInfo = - message.getExchange().get(BindingOperationInfo.class); - if (bindingOpInfo != null) { + BindingOperationInfo bindingOpInfo = + message.getExchange().get(BindingOperationInfo.class); + if (bindingOpInfo != null) { + if (bindingOpInfo.isUnwrappedCapable()) { + bindingOpInfo = bindingOpInfo.getUnwrappedOperation(); + } + if (fault == null) { SoapOperationInfo soi = bindingOpInfo.getExtensor(SoapOperationInfo.class); if (null != soi) { @@ -683,22 +672,43 @@ } if (action == null || "".equals(action)) { - String cachedAction = ACTION_MAP.get(bindingOpInfo); + MessageInfo msgInfo = + ContextUtils.isRequestor(message) + ? bindingOpInfo.getOperationInfo().getInput() + : bindingOpInfo.getOperationInfo().getOutput(); + String cachedAction = ACTION_MAP.get(msgInfo); if (cachedAction == null) { - MessageInfo msgInfo = - ContextUtils.isRequestor(message) - ? bindingOpInfo.getInput().getMessageInfo() - : bindingOpInfo.getOutput().getMessageInfo(); - action = getActionFromMessageAttributes(bindingOpInfo, - msgInfo); + action = getActionFromMessageAttributes(msgInfo); } else { action = cachedAction; } } + } else { + Throwable t = fault.getCause(); + + // FaultAction attribute is not defined in + // http://www.w3.org/2005/02/addressing/wsdl schema + for (BindingFaultInfo bfi : bindingOpInfo.getFaults()) { + FaultInfo fi = bfi.getFaultInfo(); + if (t.getClass().isAssignableFrom(fi.getMessagePart(0).getTypeClass())) { + if (fi.getExtensionAttributes() == null) { + continue; + } + String attr = (String) + fi.getExtensionAttributes().get(Names.WSAW_ACTION_QNAME); + if (attr == null) { + attr = (String) + fi.getExtensionAttributes() + .get(new QName(Names.WSA_NAMESPACE_WSDL_NAME_OLD, + Names.WSAW_ACTION_NAME)); + } + if (attr != null) { + action = attr; + break; + } + } + } } - } else { - // FaultAction attribute is not defined in - // http://www.w3.org/2005/02/addressing/wsdl schema } LOG.fine("action determined from service model: " + action); return action; @@ -711,178 +721,30 @@ * @param msgInfo the current MessageInfo * @return the action if set */ - private static String getActionFromMessageAttributes( - BindingOperationInfo bindingOpInfo, - MessageInfo msgInfo) { + private static String getActionFromMessageAttributes(MessageInfo msgInfo) { String action = null; if (msgInfo != null && msgInfo.getExtensionAttributes() != null) { - QName attr = (QName) - msgInfo.getExtensionAttributes().get(Names.WSAW_ACTION_QNAME); + String attr = getAction(msgInfo); if (attr != null) { - action = getURI(attr.getLocalPart()); - ACTION_MAP.put(bindingOpInfo, action); + action = attr; + ACTION_MAP.put(msgInfo, action); } } return action; } - /** - * Get action from annotations. - * - * @param message the current message - * @param method the invoked on method - * @param fault the fault if one is set - */ - private static String getActionFromAnnotations(Message message, - Method method, - Exception fault) { - String action = null; - if (fault != null) { - WebFault webFault = fault.getClass().getAnnotation(WebFault.class); - if (webFault != null) { - action = getAction(webFault.targetNamespace(), - method, - webFault.name(), - true); - } - } else { - String namespace = getWrapperNamespace(message, method); - if (namespace != null) { - action = getAction(namespace, - method, - getWrapperLocalName(message, method), - false); - } else { - WebService wsAnnotation = - method.getDeclaringClass().getAnnotation(WebService.class); - WebMethod wmAnnotation = - method.getAnnotation(WebMethod.class); - action = wsAnnotation != null && wmAnnotation != null - ? getAction(wsAnnotation.targetNamespace(), - method, - wmAnnotation.operationName(), - false) - : null; - } + public static String getAction(Extensible ext) { + Object o = ext.getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME); + if (o == null) { + o = ext.getExtensionAttributes().get(new QName(Names.WSA_NAMESPACE_WSDL_NAME_OLD, + Names.WSAW_ACTION_NAME)); } - LOG.fine("action determined from annotations: " + action); - return action; - } - - /** - * Get the target namespace from the {Request|Response}Wrapper annotation - * - * @param message the current message - * @param method the target method - * @return the annotated namespace - */ - private static String getWrapperNamespace(Message message, - Method method) { - String namespace = null; - if (ContextUtils.isRequestor(message)) { - RequestWrapper requestWrapper = - method.getAnnotation(RequestWrapper.class); - if (requestWrapper != null) { - namespace = requestWrapper.targetNamespace(); - } - } else { - ResponseWrapper responseWrapper = - method.getAnnotation(ResponseWrapper.class); - if (responseWrapper != null) { - namespace = responseWrapper.targetNamespace(); - } + if (o instanceof QName) { + return ((QName)o).getLocalPart(); } - return namespace; + return o.toString(); } - - /** - * Get the target local name from the {Request|Response}Wrapper annotation - * - * @param message the current message - * @param method the target method - * @return the annotated local name - */ - private static String getWrapperLocalName(Message message, - Method method) { - String localName = null; - if (ContextUtils.isRequestor(message)) { - RequestWrapper requestWrapper = - method.getAnnotation(RequestWrapper.class); - if (requestWrapper != null) { - localName = requestWrapper.localName(); - } - } else { - ResponseWrapper responseWrapper = - method.getAnnotation(ResponseWrapper.class); - if (responseWrapper != null) { - localName = responseWrapper.localName(); - } - } - return localName; - } - - /** - * Construct the Action string. - * - * @param targetNamespace the target namespace - * @param method the method - * @param localName the local name - * @param isFault true if a fault - * @return action string - */ - private static String getAction(String targetNamespace, - Method method, - String localName, - boolean isFault) { - String action = null; - action = targetNamespace; - action += Names.WSA_ACTION_DELIMITER; - action += method.getDeclaringClass().getSimpleName(); - if (isFault) { - action += method.getName(); - action += Names.WSA_FAULT_DELIMITER; - } - action += Names.WSA_ACTION_DELIMITER; - action += localName; - return action; - } - - /** - * Get the current Method. - * - * @param message the current message - * @return the Method from the BindingOperationInfo - */ - private static Method getMethod(Message message) { - Method method = null; - BindingOperationInfo bindingOpInfo = - message.getExchange().get(BindingOperationInfo.class); - if (bindingOpInfo != null) { - OperationInfo opInfo = bindingOpInfo.getOperationInfo(); - if (opInfo != null) { - method = (Method)opInfo.getProperty(Method.class.getName()); - } - } - return method; - } - - /** - * @param s a string that may be a URI without a scheme identifier - * @return a properly formed URI - */ - private static String getURI(String s) { - String uri = null; - if (s.startsWith(HTTP_URI_SCHEME)) { - uri = s; - } else if (s.startsWith(URI_AUTHORITY_PREFIX)) { - uri = HTTP_URI_SCHEME + s; - } else { - uri = HTTP_URI_SCHEME + URI_AUTHORITY_PREFIX + s; - } - return uri; - } - public static EndpointReferenceType getNoneEndpointReference() { return NONE_ENDPOINT_REFERENCE; } Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java (original) +++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java Mon Feb 4 15:22:57 2008 @@ -33,15 +33,18 @@ import javax.xml.ws.WebFault; import org.apache.cxf.binding.soap.SoapBindingConstants; +import org.apache.cxf.binding.soap.SoapFault; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.endpoint.Endpoint; +import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.FaultMode; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; +import org.apache.cxf.service.model.BindingOperationInfo; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.service.model.FaultInfo; import org.apache.cxf.service.model.MessageInfo; @@ -78,6 +81,7 @@ private final Map usingAddressing = new ConcurrentHashMap(); private boolean usingAddressingAdvisory = true; + private boolean addressingRequired; private boolean allowDuplicates = true; @@ -125,9 +129,25 @@ * element is to be advisory */ public void setUsingAddressingAdvisory(boolean advisory) { - usingAddressingAdvisory = advisory; } - + + /** + * Whether the use of addressing is completely required for this endpoint + * + * @return true if addressing is required + */ + public boolean isAddressingRequired() { + return addressingRequired; + } + /** + * Sets whether the use of addressing is completely required for this endpoint + * + */ + public void setAddressingRequired(boolean required) { + addressingRequired = required; + } + + /** * Invoked for normal processing of inbound and outbound messages. * @@ -317,14 +337,12 @@ } else if (!ContextUtils.isRequestor(message)) { // responder validates incoming MAPs AddressingPropertiesImpl maps = getMAPs(message, false, false); - if (null == maps) { + boolean isOneway = message.getExchange().isOneWay(); + if (null == maps && !addressingRequired) { return false; } - boolean isOneway = message.getExchange().isOneWay(); continueProcessing = validateIncomingMAPs(maps, message); - if (continueProcessing) { - // any faults thrown from here on can be correlated with this message - message.put(FaultMode.class, FaultMode.LOGICAL_RUNTIME_FAULT); + if (maps != null) { if (isOneway || !ContextUtils.isGenericAddress(maps.getReplyTo())) { ContextUtils.rebaseResponse(maps.getReplyTo(), @@ -337,10 +355,18 @@ ContextUtils.propogateReceivedMAPs(maps, message.getExchange()); } + } + if (continueProcessing) { + // any faults thrown from here on can be correlated with this message + message.put(FaultMode.class, FaultMode.LOGICAL_RUNTIME_FAULT); } else { // validation failure => dispatch is aborted, response MAPs // must be aggregated - aggregate(message, isFault); + //isFault = true; + //aggregate(message, isFault); + throw new SoapFault(ContextUtils.retrieveMAPFaultReason(message), + new QName(Names.WSA_NAMESPACE_NAME, + ContextUtils.retrieveMAPFaultName(message))); } } if (null != ContextUtils.retrieveMAPs(message, false, ContextUtils.isOutbound(message))) { @@ -356,8 +382,9 @@ * @param isFault true if a fault is being mediated */ private void aggregate(Message message, boolean isFault) { - AddressingPropertiesImpl maps = assembleGeneric(message); boolean isRequestor = ContextUtils.isRequestor(message); + + AddressingPropertiesImpl maps = assembleGeneric(message); addRoleSpecific(maps, message, isRequestor, isFault); // outbound property always used to store MAPs, as this handler // aggregates only when either: @@ -394,14 +421,14 @@ return maps; } - + private String getActionFromInputMessage(final OperationInfo operation) { MessageInfo inputMessage = operation.getInput(); if (inputMessage.getExtensionAttributes() != null) { - QName inputAction = (QName)inputMessage.getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME); + String inputAction = ContextUtils.getAction(inputMessage); if (inputAction != null) { - return inputAction.getLocalPart(); + return inputAction; } } return null; @@ -410,10 +437,9 @@ private String getActionFromOutputMessage(final OperationInfo operation) { MessageInfo outputMessage = operation.getOutput(); if (outputMessage != null && outputMessage.getExtensionAttributes() != null) { - QName outputAction = - (QName)outputMessage.getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME); + String outputAction = ContextUtils.getAction(outputMessage); if (outputAction != null) { - return outputAction.getLocalPart(); + return outputAction; } } return null; @@ -438,9 +464,10 @@ for (FaultInfo faultInfo : operation.getFaults()) { if (isSameFault(faultInfo, faultName)) { if (faultInfo.getExtensionAttributes() != null) { - QName faultAction = - (QName)faultInfo.getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME); - return faultAction.getLocalPart(); + String faultAction = ContextUtils.getAction(faultInfo); + if (faultAction != null) { + return faultAction; + } } return addPath(addPath(getActionBaseUri(operation), "Fault"), faultInfo.getName().getLocalPart()); @@ -466,8 +493,12 @@ } protected String getActionUri(Message message) { - OperationInfo op = message.getExchange().get(OperationInfo.class); - + BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class); + if (bop == null) { + return null; + } + OperationInfo op = bop.getOperationInfo(); + String actionUri = (String) message.get(SoapBindingConstants.SOAP_ACTION); if (actionUri != null) { return actionUri; @@ -655,23 +686,70 @@ private boolean validateIncomingMAPs(AddressingProperties maps, Message message) { boolean valid = true; - if (!allowDuplicates && maps != null) { - AttributedURIType messageID = maps.getMessageID(); - if (messageID != null - && messageIDs.put(messageID.getValue(), - messageID.getValue()) != null) { - LOG.log(Level.WARNING, - "DUPLICATE_MESSAGE_ID_MSG", - messageID.getValue()); + + if (maps != null) { + //WSAB spec, section 4.2 validation (SOAPAction must match action + Map> headers + = CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS)); + List s = headers == null ? null : headers.get(Names.SOAP_ACTION_HEADER); + if (s == null && headers != null) { + s = headers.get(Names.SOAP_ACTION_HEADER.toLowerCase()); + } + if (s != null && s.size() > 0) { + String sa = s.get(0); + if (sa.startsWith("\"")) { + sa = sa.substring(1, sa.lastIndexOf('"')); + } + if (!StringUtils.isEmpty(sa) + && !sa.equals(maps.getAction().getValue())) { + //don't match, must send fault back.... + String reason = + BUNDLE.getString("INVALID_SOAPACTION_MESSAGE"); + + ContextUtils.storeMAPFaultName(Names.ACTION_MISMATCH_NAME, + message); + ContextUtils.storeMAPFaultReason(reason, message); + return false; + } + } + + if (maps.getAction() == null || maps.getAction().getValue() == null) { String reason = - BUNDLE.getString("DUPLICATE_MESSAGE_ID_MSG"); - String l7dReason = - MessageFormat.format(reason, messageID.getValue()); - ContextUtils.storeMAPFaultName(Names.DUPLICATE_MESSAGE_ID_NAME, + BUNDLE.getString("MISSING_ACTION_MESSAGE"); + + ContextUtils.storeMAPFaultName(Names.HEADER_REQUIRED_NAME, message); - ContextUtils.storeMAPFaultReason(l7dReason, message); - valid = false; + ContextUtils.storeMAPFaultReason(reason, message); + return false; + } + + if (!allowDuplicates) { + AttributedURIType messageID = maps.getMessageID(); + if (messageID != null + && messageIDs.put(messageID.getValue(), + messageID.getValue()) != null) { + LOG.log(Level.WARNING, + "DUPLICATE_MESSAGE_ID_MSG", + messageID.getValue()); + String reason = + BUNDLE.getString("DUPLICATE_MESSAGE_ID_MSG"); + String l7dReason = + MessageFormat.format(reason, messageID.getValue()); + ContextUtils.storeMAPFaultName(Names.DUPLICATE_MESSAGE_ID_NAME, + message); + ContextUtils.storeMAPFaultReason(l7dReason, message); + valid = false; + } + } + } else if (usingAddressingAdvisory) { + String reason = + BUNDLE.getString("MISSING_ACTION_MESSAGE"); + + ContextUtils.storeMAPFaultName(Names.HEADER_REQUIRED_NAME, + message); + ContextUtils.storeMAPFaultReason(reason, message); + return false; } return valid; } Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties (original) +++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties Mon Feb 4 15:22:57 2008 @@ -25,3 +25,5 @@ INVALID_MAP_MSG = Invalid Message Addressing Property {0} MAP_REQUIRED_MSG = Message Addressing Property {0} required DUPLICATE_MESSAGE_ID_MSG = Duplicate Message ID {0} +INVALID_SOAPACTION_MESSAGE = A header representing a Message Addressing Property is not valid and the message cannot be processed +MISSING_ACTION_MESSAGE = A required header representing a Message Addressing Property is not present \ No newline at end of file Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java (original) +++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java Mon Feb 4 15:22:57 2008 @@ -35,7 +35,10 @@ public static final String WSA_NAMESPACE_NAME = "http://www.w3.org/2005/08/addressing"; - public static final String WSA_NAMESPACE_WSDL_NAME = + + public static final String WSA_NAMESPACE_WSDL_NAME = "http://www.w3.org/2006/05/addressing/wsdl"; + + public static final String WSA_NAMESPACE_WSDL_NAME_OLD = "http://www.w3.org/2005/02/addressing/wsdl"; public static final String WSA_NAMESPACE_PATTERN = "/addressing"; @@ -142,7 +145,18 @@ "DuplicateMessageID"; public static final QName DUPLICATE_MESSAGE_ID_QNAME = new QName(WSA_NAMESPACE_NAME, DUPLICATE_MESSAGE_ID_NAME); - + + public static final String ACTION_MISMATCH_NAME = + "ActionMismatch"; + public static final QName ACTION_MISMATCH_QNAME = + new QName(WSA_NAMESPACE_NAME, ACTION_MISMATCH_NAME); + + public static final String HEADER_REQUIRED_NAME = + "MessageAddressingHeaderRequired"; + public static final QName HEADER_REQUIRED_QNAME = + new QName(WSA_NAMESPACE_NAME, HEADER_REQUIRED_NAME); + + public static final String SOAP11HTTP_ADDRESSING_BINDING = "http://schemas.xmlsoap.org/soap/envelope/?addressing=ms"; public static final String SOAP12HTTP_ADDRESSING_BINDING = Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java (original) +++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java Mon Feb 4 15:22:57 2008 @@ -58,4 +58,14 @@ public boolean isUsingAddressingAdvisory() { return mapAggregator.isUsingAddressingAdvisory(); } + + + public boolean isAddressingRequired() { + return mapAggregator.isAddressingRequired(); + } + public void setAddressingRequired(boolean required) { + mapAggregator.setAddressingRequired(required); + } + + } Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java (original) +++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java Mon Feb 4 15:22:57 2008 @@ -45,14 +45,14 @@ @Test public void testGetWSDLNamespaceURI() throws Exception { assertEquals("unexpected constant", - "http://www.w3.org/2005/02/addressing/wsdl", + "http://www.w3.org/2006/05/addressing/wsdl", constants.getWSDLNamespaceURI()); } @Test public void testGetWSDLExtensibility() throws Exception { assertEquals("unexpected constant", - new QName("http://www.w3.org/2005/02/addressing/wsdl", + new QName("http://www.w3.org/2006/05/addressing/wsdl", "UsingAddressing"), constants.getWSDLExtensibilityQName()); } @@ -60,7 +60,7 @@ @Test public void testGetWSDLActionQName() throws Exception { assertEquals("unexpected constant", - new QName("http://www.w3.org/2005/02/addressing/wsdl", + new QName("http://www.w3.org/2006/05/addressing/wsdl", "Action"), constants.getWSDLActionQName()); } Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java (original) +++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java Mon Feb 4 15:22:57 2008 @@ -29,9 +29,12 @@ import javax.xml.namespace.QName; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; +//import javax.xml.ws.RequestWrapper; +//import javax.xml.ws.ResponseWrapper; import org.apache.cxf.binding.Binding; +import org.apache.cxf.binding.soap.SoapFault; import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.Message; @@ -40,6 +43,8 @@ import org.apache.cxf.service.model.BindingMessageInfo; import org.apache.cxf.service.model.BindingOperationInfo; import org.apache.cxf.service.model.EndpointInfo; +import org.apache.cxf.service.model.InterfaceInfo; +import org.apache.cxf.service.model.MessageInfo.Type; import org.apache.cxf.service.model.OperationInfo; import org.apache.cxf.service.model.ServiceInfo; import org.apache.cxf.transport.Conduit; @@ -203,7 +208,7 @@ @Test public void testResponderInboundValidMAPs() throws Exception { - Message message = setUpMessage(false, false, false); + Message message = setUpMessage(false, false, false, false, false, false, true); aggregator.mediate(message, false); control.verify(); verifyMessage(message, false, false, false); @@ -212,7 +217,7 @@ @Test public void testResponderInboundDecoupled() throws Exception { Message message = - setUpMessage(false, false, false, true, false, true); + setUpMessage(false, false, false, true, false, true, true); aggregator.mediate(message, false); control.verify(); verifyMessage(message, false, false, true); @@ -221,7 +226,7 @@ @Test public void testResponderInboundOneway() throws Exception { Message message = - setUpMessage(false, false, true, true, false, true); + setUpMessage(false, false, true, true, false, true, true); aggregator.mediate(message, false); control.verify(); verifyMessage(message, false, false, true); @@ -229,26 +234,26 @@ @Test public void testResponderInboundValidMAPsFault() throws Exception { - Message message = setUpMessage(false, false, false); + Message message = setUpMessage(false, false, false, false, false, false, true); aggregator.mediate(message, true); control.verify(); verifyMessage(message, false, false, true); } - @Test + @Test(expected = SoapFault.class) public void testResponderInboundInvalidMAPs() throws Exception { aggregator.messageIDs.put("urn:uuid:12345", "urn:uuid:12345"); - Message message = setUpMessage(false, false, false); + Message message = setUpMessage(false, false, false, false, false, false, true); aggregator.setAllowDuplicates(false); aggregator.mediate(message, false); control.verify(); verifyMessage(message, false, false, false /*check*/); } - @Test + @Test(expected = SoapFault.class) public void testResponderInboundInvalidMAPsFault() throws Exception { aggregator.messageIDs.put("urn:uuid:12345", "urn:uuid:12345"); - Message message = setUpMessage(false, false, false); + Message message = setUpMessage(false, false, false, false, false, false, true); aggregator.setAllowDuplicates(false); aggregator.mediate(message, true); control.verify(); @@ -620,15 +625,21 @@ ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType(); to.setAddress(ContextUtils.getAttributedURI(expectedTo)); conduit.getTarget(); - EasyMock.expectLastCall().andReturn(to); + EasyMock.expectLastCall().andReturn(to).anyTimes(); } private void setUpMethod(Message message, Exchange exchange, Method method) { - setUpMessageExchange(message, exchange); - OperationInfo opInfo = new OperationInfo(); + setUpMessageExchange(message, exchange); + ServiceInfo si = new ServiceInfo(); + InterfaceInfo iinf = new InterfaceInfo(si, new QName("http://foo/bar", "SEI")); + OperationInfo opInfo = iinf.addOperation(new QName("http://foo/bar", method.getName())); opInfo.setProperty(Method.class.getName(), method); + opInfo.setInput("opRequest", + opInfo.createMessage(new QName("http://foo/bar", "opRequest"), Type.INPUT)); + opInfo.setOutput("opResponse", + opInfo.createMessage(new QName("http://foo/bar", "opResponse"), Type.INPUT)); BindingOperationInfo bindingOpInfo = new TestBindingOperationInfo(opInfo); - setUpExchangeGet(exchange, BindingOperationInfo.class, bindingOpInfo, 2); + setUpExchangeGet(exchange, BindingOperationInfo.class, bindingOpInfo); // Usual fun with EasyMock not always working as expected //BindingOperationInfo bindingOpInfo = // EasyMock.createMock(BindingOperationInfo.class); @@ -669,12 +680,8 @@ } private void setUpExchangeGet(Exchange exchange, Class clz, T value) { - setUpExchangeGet(exchange, clz, value, 1); - } - - private void setUpExchangeGet(Exchange exchange, Class clz, T value, int n) { exchange.get(clz); - EasyMock.expectLastCall().andReturn(value).times(n); + EasyMock.expectLastCall().andReturn(value).anyTimes(); //exchange.put(Endpoint.class, value); } @@ -688,15 +695,15 @@ Message message, boolean outbound) { exchange.getOutMessage(); - EasyMock.expectLastCall().andReturn(outbound ? message : null); + EasyMock.expectLastCall().andReturn(outbound ? message : null).anyTimes(); //exchange.setOutMessage(outbound ? message : new MessageImpl()); } private void setUpExchangeConduit(Message message, Exchange exchange, Conduit conduit) { - exchange.getConduit(message); - EasyMock.expectLastCall().andReturn(conduit); + //exchange.getConduit(message); + //EasyMock.expectLastCall().andReturn(conduit); //exchange.setConduit(conduit); } Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/resources/hello_world_soap_http_infoset.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/resources/hello_world_soap_http_infoset.xml?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/resources/hello_world_soap_http_infoset.xml (original) +++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/resources/hello_world_soap_http_infoset.xml Mon Feb 4 15:22:57 2008 @@ -7,7 +7,7 @@ ns:SOAPService Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java Mon Feb 4 15:22:57 2008 @@ -46,10 +46,6 @@ return CONFIG; } - @Test - public void foo() { - - } @Test public void testUsingKeepAliveConnection() throws Exception { Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java Mon Feb 4 15:22:57 2008 @@ -114,7 +114,7 @@ private void removeInterceptors(List chain, Interceptor[] interceptors) { for (int i = 0; i < interceptors.length; i++) { - chain.add(interceptors[i]); + chain.remove(interceptors[i]); } } @@ -190,14 +190,14 @@ } @Test - @Ignore public void testExplicitMAPs() throws Exception { try { + String msgId = "urn:uuid:12345-" + Math.random(); Map requestContext = ((BindingProvider)greeter).getRequestContext(); AddressingProperties maps = new AddressingPropertiesImpl(); AttributedURIType id = - ContextUtils.getAttributedURI("urn:uuid:12345"); + ContextUtils.getAttributedURI(msgId); maps.setMessageID(id); requestContext.put(CLIENT_ADDRESSING_PROPERTIES, maps); String greeting = greeter.greetMe("explicit1"); @@ -213,14 +213,14 @@ greeter.greetMe("explicit2"); fail("expected ProtocolException on duplicate message ID"); } catch (ProtocolException pe) { - assertTrue("expected duplicate message ID failure", - "Duplicate Message ID urn:uuid:12345".equals(pe.getMessage())); + assertEquals("expected duplicate message ID failure", + "Duplicate Message ID " + msgId, pe.getMessage()); checkVerification(); } // clearing the message ID ensure a duplicate is not sent maps.setMessageID(null); - maps.setRelatesTo(ContextUtils.getRelatesTo(id.getValue())); + //maps.setRelatesTo(ContextUtils.getRelatesTo(id.getValue())); greeting = greeter.greetMe("explicit3"); assertEquals("unexpected response received from service", "Hello explicit3", @@ -398,6 +398,7 @@ || wsaHeaders.contains(Names.WSA_RELATESTO_NAME))) { ret = "expected ReplyTo or RelatesTo header"; } + /* if (partial) { if (!wsaHeaders.contains(Names.WSA_FROM_NAME)) { ret = "expected From header"; @@ -408,6 +409,7 @@ // ret = "expected Action header"; //} } + */ if (requestLeg && !(wsaHeaders.contains(CUSTOMER_NAME.getLocalPart()))) { ret = "expected CustomerKey header"; } Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java Mon Feb 4 15:22:57 2008 @@ -67,6 +67,9 @@ : MAPTest.INBOUND_KEY); AddressingPropertiesImpl maps = (AddressingPropertiesImpl)message.get(mapProperty); + if (maps == null) { + return; + } if (ContextUtils.isRequestor(message)) { if (isOutbound) { String exposeAs = getExpectedExposeAs(false); Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml Mon Feb 4 15:22:57 2008 @@ -25,7 +25,9 @@ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + + + Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/add_numbers_expected.wsdl URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/add_numbers_expected.wsdl?rev=618489&r1=618488&r2=618489&view=diff ============================================================================== --- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/add_numbers_expected.wsdl (original) +++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/add_numbers_expected.wsdl Mon Feb 4 15:22:57 2008 @@ -101,17 +101,17 @@ - + - + - + - + - + @@ -119,7 +119,7 @@ - +