Author: richard.opalka(a)jboss.com
Date: 2010-04-13 01:58:30 -0400 (Tue, 13 Apr 2010)
New Revision: 11972
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
Log:
[JBWS-2991] respect @AddressingFeature attributes
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java 2010-04-13
02:26:53 UTC (rev 11971)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java 2010-04-13
05:58:30 UTC (rev 11972)
@@ -36,8 +36,11 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.addressing.AddressingBuilder;
import javax.xml.ws.addressing.AddressingException;
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.EndpointReference;
import javax.xml.ws.addressing.JAXWSAConstants;
import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
@@ -61,142 +64,196 @@
* @author Heiko.Braun(a)jboss.com
* @since 24-Nov-2005
*/
+@SuppressWarnings("unchecked")
public class WSAddressingClientHandler extends GenericSOAPHandler
{
- // Provide logging
- private static Logger log = Logger.getLogger(WSAddressingClientHandler.class);
+ // Provide logging
+ private static Logger log = Logger.getLogger(WSAddressingClientHandler.class);
- private static AddressingBuilder ADDR_BUILDER;
- private static AddressingConstantsImpl ADDR_CONSTANTS;
- private static Set<QName> HEADERS = new HashSet<QName>();
+ private static AddressingBuilder ADDR_BUILDER;
- static
- {
- ADDR_CONSTANTS = new AddressingConstantsImpl();
- ADDR_BUILDER = AddressingBuilder.getAddressingBuilder();
+ private static AddressingConstantsImpl ADDR_CONSTANTS;
- HEADERS.add( ADDR_CONSTANTS.getActionQName());
- HEADERS.add( ADDR_CONSTANTS.getToQName());
- }
+ private static Set<QName> HEADERS = new HashSet<QName>();
- public Set getHeaders()
- {
- return Collections.unmodifiableSet(HEADERS);
- }
+ static
+ {
+ ADDR_CONSTANTS = new AddressingConstantsImpl();
+ ADDR_BUILDER = AddressingBuilder.getAddressingBuilder();
- protected boolean handleOutbound(MessageContext msgContext)
- {
- log.debug("handleOutbound");
+ HEADERS.add(ADDR_CONSTANTS.getActionQName());
+ HEADERS.add(ADDR_CONSTANTS.getToQName());
+ }
- SOAPAddressingProperties addrProps =
(SOAPAddressingProperties)msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES);
+ public Set getHeaders()
+ {
+ return Collections.unmodifiableSet(HEADERS);
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.debug("handleOutbound");
+
+ SOAPAddressingProperties addrProps = (SOAPAddressingProperties) msgContext
+ .get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES);
if (addrProps != null)
{
msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND,
addrProps);
msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND,
Scope.APPLICATION);
}
-
- addrProps =
(SOAPAddressingProperties)msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+
+ addrProps = (SOAPAddressingProperties)
msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
if (addrProps == null)
{
// supply default addressing properties
- addrProps =
(SOAPAddressingPropertiesImpl)ADDR_BUILDER.newAddressingProperties();
+ addrProps = (SOAPAddressingPropertiesImpl)
ADDR_BUILDER.newAddressingProperties();
msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND,
addrProps);
msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND,
Scope.APPLICATION);
}
-
+
+ // Add required wsa:Action
if (addrProps.getAction() == null)
{
- try
- {
- OperationMetaData opMetaData =
((CommonMessageContext)msgContext).getOperationMetaData();
- if (msgContext.get(BindingProvider.SOAPACTION_URI_PROPERTY) != null)
- {
-
addrProps.setAction(ADDR_BUILDER.newURI(msgContext.get(BindingProvider.SOAPACTION_URI_PROPERTY).toString()));
- }
- else
- {
- AddressingOpMetaExt addressingMD =
(AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());
- if (addressingMD == null)
- throw new IllegalStateException("Addressing Meta Data not
available");
+ addrProps.setAction(this.getAction(msgContext));
+ }
- String action = addressingMD.getInboundAction();
- if (action == null) action = opMetaData.getJavaName();
- addrProps.setAction(ADDR_BUILDER.newURI(action));
- }
- }
- catch (URISyntaxException ex)
- {
- // ignore
- }
- }
-
- //Add optional messageID
+ // Add optional wsa:MessageID
if (addrProps.getMessageID() == null)
{
addrProps.setMessageID(AddressingClientUtil.createMessageID());
}
-
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- addrProps.writeHeaders(soapMessage);
+ // Add optional wsa:To
+ if (addrProps.getTo() == null)
+ {
+ addrProps.setTo(this.getAddress(msgContext));
+ }
- return true;
- }
+ // Add optional wsa:ReplyTo
+ if (addrProps.getReplyTo() == null)
+ {
+ addrProps.setReplyTo(this.newAnonymousURI());
+ }
- protected boolean handleInbound(MessageContext msgContext)
- {
- log.debug("handleInbound");
+ SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
+ addrProps.writeHeaders(soapMessage);
- try
- {
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- if (soapMessage.getSOAPPart().getEnvelope() != null)
- {
- SOAPAddressingBuilder builder =
(SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
- SOAPAddressingProperties addrProps =
(SOAPAddressingProperties)builder.newAddressingProperties();
- CommonMessageContext commonMsgContext =
(CommonMessageContext)msgContext;
- ClientEndpointMetaData serverMetaData =
(ClientEndpointMetaData)commonMsgContext.getEndpointMetaData();
- AddressingFeature addrFeature =
serverMetaData.getFeature(AddressingFeature.class);
- if (addrFeature != null && addrFeature.isRequired())
- {
- try
- {
- soapMessage.setProperty("isRequired", true);
- }
- catch (Exception e)
- {
- //ignore
- }
-
- }
- addrProps.readHeaders(soapMessage);
+ return true;
+ }
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.debug("handleInbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
+ if (soapMessage.getSOAPPart().getEnvelope() != null)
+ {
+ SOAPAddressingBuilder builder = (SOAPAddressingBuilder)
SOAPAddressingBuilder.getAddressingBuilder();
+ SOAPAddressingProperties addrProps = (SOAPAddressingProperties)
builder.newAddressingProperties();
+ if (this.isAddressingRequired(msgContext))
+ {
+ try
+ {
+ soapMessage.setProperty("isRequired", true);
+ }
+ catch (Exception e)
+ {
+ //ignore
+ }
+
+ }
+ addrProps.readHeaders(soapMessage);
msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES,
Scope.APPLICATION);
msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND,
addrProps);
msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND,
Scope.APPLICATION);
- msgContext.put(MessageContext.REFERENCE_PARAMETERS,
convertToElementList(addrProps.getReferenceParameters().getElements()));
+ msgContext.put(MessageContext.REFERENCE_PARAMETERS,
convertToElementList(addrProps.getReferenceParameters()
+ .getElements()));
msgContext.setScope(MessageContext.REFERENCE_PARAMETERS, Scope.APPLICATION);
- }
- }
- catch (SOAPException ex)
- {
- throw new AddressingException("Cannot handle response", ex);
- }
+ }
+ }
+ catch (SOAPException ex)
+ {
+ throw new AddressingException("Cannot handle response", ex);
+ }
- return true;
- }
-
- private static List<Element> convertToElementList(List<Object> objects)
+ return true;
+ }
+
+ private static List<Element> convertToElementList(List<Object> objects)
{
- if (objects == null) return null;
+ if (objects == null)
+ return null;
List<Element> elements = new LinkedList<Element>();
for (Object o : objects)
{
if (o instanceof Element)
{
- elements.add((Element)o);
+ elements.add((Element) o);
}
}
return elements;
}
+
+ private AttributedURI getAction(final MessageContext msgContext)
+ {
+ String action = null;
+
+ if (msgContext.get(BindingProvider.SOAPACTION_URI_PROPERTY) != null)
+ action = msgContext.get(BindingProvider.SOAPACTION_URI_PROPERTY).toString();
+
+ OperationMetaData operationMD = ((CommonMessageContext)
msgContext).getOperationMetaData();
+ if (operationMD != null)
+ {
+ AddressingOpMetaExt addressingMD = (AddressingOpMetaExt)
+ operationMD.getExtension(ADDR_CONSTANTS.getNamespaceURI());
+
+ action = addressingMD.getInboundAction();
+ if (action == null)
+ action = operationMD.getJavaName();
+ }
+
+ return this.newURI(action);
+ }
+
+ private AttributedURI getAddress(final MessageContext msgContext)
+ {
+ final OperationMetaData operationMD = ((CommonMessageContext)
msgContext).getOperationMetaData();
+ if (operationMD != null)
+ {
+ final ClientEndpointMetaData endpointMD = (ClientEndpointMetaData)
operationMD.getEndpointMetaData();
+
+ return this.newURI(endpointMD.getEndpointAddress());
+ }
+
+ return null;
+ }
+
+ private AttributedURI newURI(final String uri)
+ {
+ try
+ {
+ return ADDR_BUILDER.newURI(uri);
+ }
+ catch (URISyntaxException e)
+ {
+ throw new WebServiceException(e.getMessage(), e);
+ }
+ }
+
+ private EndpointReference newAnonymousURI()
+ {
+ return
ADDR_BUILDER.newEndpointReference(this.newURI(ADDR_CONSTANTS.getAnonymousURI()).getURI());
+ }
+
+ private boolean isAddressingRequired(final MessageContext msgContext)
+ {
+ CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext;
+ ClientEndpointMetaData serverMetaData =
(ClientEndpointMetaData)commonMsgContext.getEndpointMetaData();
+ AddressingFeature addrFeature =
serverMetaData.getFeature(AddressingFeature.class);
+
+ return addrFeature != null && addrFeature.isRequired();
+ }
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java 2010-04-13
02:26:53 UTC (rev 11971)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java 2010-04-13
05:58:30 UTC (rev 11972)
@@ -29,6 +29,7 @@
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.wsf.common.addressing.AddressingConstants;
import org.jboss.wsf.common.handler.GenericSOAPHandler;
import org.w3c.dom.Element;
@@ -63,6 +64,7 @@
* @author Heiko.Braun(a)jboss.com
* @since 24-Nov-2005
*/
+@SuppressWarnings("unchecked")
public class WSAddressingServerHandler extends GenericSOAPHandler
{
// Provide logging
@@ -90,12 +92,25 @@
{
if(log.isDebugEnabled()) log.debug("handleInbound");
+// if (!this.isAddressingEnabled(msgContext))
+// {
+// try
+// {
+// SOAPFault fault = new SOAPFaultImpl();
+//
fault.setFaultCode(AddressingConstants.Core.Faults.MESSAGEADDRESSINGHEADERREQUIRED_QNAME);
+// fault.setFaultString("A required header representing a Message
Addressing Property is not present");
+// throw new SOAPFaultException(fault);
+// }
+// catch (SOAPException e)
+// {
+// throw new WebServiceException(e);
+// }
+// }
+
SOAPAddressingProperties addrProps =
(SOAPAddressingProperties)ADDR_BUILDER.newAddressingProperties();
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext;
- ServerEndpointMetaData serverMetaData =
(ServerEndpointMetaData)commonMsgContext.getEndpointMetaData();
- AddressingFeature addrFeature =
serverMetaData.getFeature(AddressingFeature.class);
- if (addrFeature != null && addrFeature.isRequired())
+ if (this.isAddressingRequired(msgContext))
{
try
{
@@ -108,38 +123,41 @@
}
addrProps.readHeaders(soapMessage);
- msgContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, addrProps);
- msgContext.setScope(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND,
Scope.APPLICATION);
- msgContext.put(MessageContext.REFERENCE_PARAMETERS,
convertToElementList(addrProps.getReferenceParameters().getElements()));
- msgContext.setScope(MessageContext.REFERENCE_PARAMETERS, Scope.APPLICATION);
-
- //check if soap action matches wsa action
- String[] soapActions =
commonMsgContext.getMessageAbstraction().getMimeHeaders().getHeader("SOAPAction");
- if (soapActions != null && soapActions.length > 0)
+ if (addrProps.getAction() != null)
{
- String soapAction = soapActions[0];
- if (!soapAction.equals("\"\"") &&
addrProps.getAction() != null)
- {
- String wsaAction = addrProps.getAction().getURI().toString();
- // R1109 The value of the SOAPAction HTTP header field in a HTTP request
MESSAGE MUST be a quoted string.
- if (!soapAction.equals(wsaAction) &&
!soapAction.equals("\"" + wsaAction + "\""))
- {
- try
- {
- SOAPFault fault = new SOAPFaultImpl();
- fault.setFaultCode(new QName(ADDR_CONSTANTS.getNamespaceURI(),
"ActionMismatch"));
- fault.setFaultString("Mismatch between soap action:" +
soapAction + " and wsa action:\""
- + addrProps.getAction().getURI() + "\"");
- Detail detail = fault.addDetail();
- detail.addDetailEntry(new QName(ADDR_CONSTANTS.getNamespaceURI(),
"ProblemAction"));
- throw new SOAPFaultException(fault);
- }
- catch (SOAPException e)
- {
- throw new WebServiceException(e);
- }
- }
- }
+ msgContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND,
addrProps);
+ msgContext.setScope(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND,
Scope.APPLICATION);
+ msgContext.put(MessageContext.REFERENCE_PARAMETERS,
convertToElementList(addrProps.getReferenceParameters().getElements()));
+ msgContext.setScope(MessageContext.REFERENCE_PARAMETERS, Scope.APPLICATION);
+
+ //check if soap action matches wsa action
+ String[] soapActions =
commonMsgContext.getMessageAbstraction().getMimeHeaders().getHeader("SOAPAction");
+ if (soapActions != null && soapActions.length > 0)
+ {
+ String soapAction = soapActions[0];
+ if (!soapAction.equals("\"\"") &&
addrProps.getAction() != null)
+ {
+ String wsaAction = addrProps.getAction().getURI().toString();
+ // R1109 The value of the SOAPAction HTTP header field in a HTTP request
MESSAGE MUST be a quoted string.
+ if (!soapAction.equals(wsaAction) &&
!soapAction.equals("\"" + wsaAction + "\""))
+ {
+ try
+ {
+ SOAPFault fault = new SOAPFaultImpl();
+ fault.setFaultCode(new QName(ADDR_CONSTANTS.getNamespaceURI(),
"ActionMismatch"));
+ fault.setFaultString("Mismatch between soap action:" +
soapAction + " and wsa action:\""
+ + addrProps.getAction().getURI() + "\"");
+ Detail detail = fault.addDetail();
+ detail.addDetailEntry(new QName(ADDR_CONSTANTS.getNamespaceURI(),
"ProblemAction"));
+ throw new SOAPFaultException(fault);
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+ }
+ }
}
return true;
}
@@ -161,7 +179,13 @@
protected boolean handleOutbound(MessageContext msgContext)
{
if(log.isDebugEnabled()) log.debug("handleOutbound");
- handleResponseOrFault(msgContext, false);
+ final boolean isAddressingEnabled = this.isAddressingEnabled(msgContext);
+ final boolean isAddressingRequest = this.isAddressingRequest(msgContext);
+
+ if (isAddressingEnabled && isAddressingRequest)
+ {
+ handleResponseOrFault(msgContext, false);
+ }
return true;
}
@@ -172,7 +196,14 @@
public boolean handleFault(MessageContext msgContext)
{
if(log.isDebugEnabled()) log.debug("handleFault");
- handleResponseOrFault(msgContext, true);
+ final boolean isAddressingEnabled = this.isAddressingEnabled(msgContext);
+ final boolean isAddressingRequest = this.isAddressingRequest(msgContext);
+
+ if (isAddressingEnabled && isAddressingRequest)
+ {
+ handleResponseOrFault(msgContext, true);
+ }
+
return true;
}
@@ -239,12 +270,30 @@
return ADDR_CONSTANTS.getDefaultFaultAction();
}
- /* check wsa formal constraints */
- private void validateRequest(SOAPAddressingProperties addrProps)
+ private boolean isAddressingRequired(final MessageContext msgContext)
{
- // If wsa:ReplyTo is supplied and the message lacks a [message id] property, the
processor MUST fault.
- if (addrProps.getReplyTo() != null && addrProps.getMessageID() == null)
- throw new IllegalArgumentException("wsa:MessageId is required when wsa:ReplyTo is
supplied");
-
+ final AddressingFeature addrFeature = this.getAddressingFeature(msgContext);
+
+ return addrFeature != null && addrFeature.isEnabled() &&
addrFeature.isRequired();
}
+
+ private boolean isAddressingEnabled(final MessageContext msgContext)
+ {
+ final AddressingFeature addrFeature = this.getAddressingFeature(msgContext);
+
+ return addrFeature != null && addrFeature.isEnabled();
+ }
+
+ private AddressingFeature getAddressingFeature(final MessageContext msgContext)
+ {
+ final CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext;
+ final ServerEndpointMetaData serverMetaData =
(ServerEndpointMetaData)commonMsgContext.getEndpointMetaData();
+
+ return serverMetaData.getFeature(AddressingFeature.class);
+ }
+
+ private boolean isAddressingRequest(final MessageContext msgContext)
+ {
+ return msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND) != null;
+ }
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java 2010-04-13
02:26:53 UTC (rev 11971)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java 2010-04-13
05:58:30 UTC (rev 11972)
@@ -33,21 +33,24 @@
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPHeaderElement;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.addressing.AddressingConstants;
import javax.xml.ws.addressing.AddressingException;
import javax.xml.ws.addressing.AttributedURI;
-import javax.xml.ws.addressing.MapRequiredException;
import javax.xml.ws.addressing.ReferenceParameters;
import javax.xml.ws.addressing.Relationship;
import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
+import javax.xml.ws.soap.SOAPFaultException;
import org.jboss.logging.Logger;
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl;
import org.jboss.ws.extensions.addressing.EndpointReferenceImpl;
@@ -80,13 +83,28 @@
private String getRequiredHeaderContent(SOAPHeader soapHeader, QName qname)
{
Element element = DOMUtils.getFirstChildElement(soapHeader, qname);
- if(null == element) throw new MapRequiredException(qname);
+ if(null == element) throwAddressingHeaderMissing();
String value = DOMUtils.getTextContent(element);
- if(null == value || value.equals("")) throw new MapRequiredException(qname);
+ if(null == value || value.equals("")) throwAddressingHeaderMissing();
return value;
}
+
+ private void throwAddressingHeaderMissing()
+ {
+ try
+ {
+ SOAPFault fault = new SOAPFaultImpl();
+
fault.setFaultCode(org.jboss.wsf.common.addressing.AddressingConstants.Core.Faults.MESSAGEADDRESSINGHEADERREQUIRED_QNAME);
+ fault.setFaultString("A required header representing a Message Addressing
Property is not present");
+ throw new SOAPFaultException(fault);
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
private String getOptionalHeaderContent(SOAPHeader soapHeader, QName qname)
{
@@ -154,7 +172,7 @@
{
//check the action header only if the required value is true
String action = getRequiredHeaderContent(soapHeader,
ADDR.getActionQName());
- setAction(builder.newURI(action));
+ setAction(builder.newURI(action));
}
else
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2010-04-13
02:26:53 UTC (rev 11971)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2010-04-13
05:58:30 UTC (rev 11972)
@@ -586,16 +586,11 @@
if (webMethodAction != null)
return webMethodAction;
- if (endpointMD.isFeatureEnabled(AddressingFeature.class))
- {
- String tns = endpointMD.getPortTypeName().getNamespaceURI();
- String portTypeName = endpointMD.getPortTypeName().getLocalPart();
- String opName = operationMD.getQName().getLocalPart();
+ String tns = this.getEndpointNamespace(endpointMD);
+ String portTypeName = endpointMD.getPortTypeName().getLocalPart();
+ String opName = operationMD.getQName().getLocalPart();
- return tns + portTypeName + "/" + opName + "Request";
- }
-
- return null;
+ return tns + portTypeName + "/" + opName + "Request";
}
/*
@@ -614,16 +609,11 @@
if ((actionAnn != null) && (!"".equals(actionAnn.output())))
return actionAnn.output();
- if (endpointMD.isFeatureEnabled(AddressingFeature.class))
- {
- String tns = endpointMD.getPortTypeName().getNamespaceURI();
- String portTypeName = endpointMD.getPortTypeName().getLocalPart();
- String opName = operationMD.getQName().getLocalPart();
+ String tns = this.getEndpointNamespace(endpointMD);
+ String portTypeName = endpointMD.getPortTypeName().getLocalPart();
+ String opName = operationMD.getQName().getLocalPart();
- return tns + portTypeName + "/" + opName + "Response";
- }
-
- return null;
+ return tns + portTypeName + "/" + opName + "Response";
}
/*
@@ -657,18 +647,22 @@
if ((faultActionAnn != null) &&
(!"".equals(faultActionAnn.value())))
return faultActionAnn.value();
- if (endpointMD.isFeatureEnabled(AddressingFeature.class))
- {
- String tns = endpointMD.getPortTypeName().getNamespaceURI();
- String portTypeName = endpointMD.getPortTypeName().getLocalPart();
- String opName = operationMD.getQName().getLocalPart();
- int dotIndex = faultBeanName.lastIndexOf('.');
- String excetionClassName = dotIndex == -1 ? faultBeanName :
faultBeanName.substring(dotIndex + 1);
+ String tns = this.getEndpointNamespace(endpointMD);
+ String portTypeName = endpointMD.getPortTypeName().getLocalPart();
+ String opName = operationMD.getQName().getLocalPart();
+ int dotIndex = faultBeanName.lastIndexOf('.');
+ String excetionClassName = dotIndex == -1 ? faultBeanName :
faultBeanName.substring(dotIndex + 1);
- return tns + portTypeName + "/" + opName + "/Fault/" +
excetionClassName;
- }
+ return tns + portTypeName + "/" + opName + "/Fault/" +
excetionClassName;
+ }
+
+ private String getEndpointNamespace(final EndpointMetaData endpointMD)
+ {
+ String namespace = endpointMD.getPortTypeName().getNamespaceURI();
+ if (!namespace.endsWith("/"))
+ namespace += "/";
- return null;
+ return namespace;
}
/**