You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ke...@apache.org on 2007/04/05 12:39:57 UTC
svn commit: r525791 - in
/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2:
description/ util/
Author: keithc
Date: Thu Apr 5 03:39:56 2007
New Revision: 525791
URL: http://svn.apache.org/viewvc?view=rev&rev=525791
Log:
Addinng addressing attributes to ?wsdl2. Fix for Axis2-2394.
Modified:
webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisBinding.java?view=diff&rev=525791&r1=525790&r2=525791
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisBinding.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisBinding.java Thu Apr 5 03:39:56 2007
@@ -20,6 +20,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.util.WSDLSerializationUtil;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axiom.om.OMElement;
@@ -116,7 +117,7 @@
* @return The generated binding element
*/
public OMElement toWSDL20(OMNamespace tns, OMNamespace wsoap, OMNamespace whttp,
- String interfaceName, Map nameSpaceMap) {
+ String interfaceName, Map nameSpaceMap, String addressingFlag) {
String property;
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement bindingElement;
@@ -155,6 +156,9 @@
if (soapModules != null && soapModules.size() > 0) {
WSDLSerializationUtil.addSOAPModuleElements(omFactory, soapModules, wsoap, bindingElement);
}
+
+ WSDLSerializationUtil.addWSAddressingToBinding(addressingFlag, omFactory, bindingElement);
+
} else if (WSDL2Constants.URI_WSDL2_HTTP.equals(type)) {
// HTTP Binding specific properties
property = (String) options.get(WSDL2Constants.ATTR_WHTTP_METHOD);
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisOperation.java?view=diff&rev=525791&r1=525790&r2=525791
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisOperation.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisOperation.java Thu Apr 5 03:39:56 2007
@@ -664,6 +664,7 @@
if (inMessage != null) {
OMElement inMessageElement = omFactory.createOMElement(WSDL2Constants.IN_PUT_LOCAL_NAME, null);
inMessageElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ELEMENT, null, WSDLSerializationUtil.getElementName(inMessage, nameSpaceMap)));
+ WSDLSerializationUtil.addWSAWActionAttribute(inMessageElement, getInputAction());
axisOperationElement.addChild(inMessageElement);
}
@@ -672,6 +673,7 @@
if (outMessage != null) {
OMElement outMessageElement = omFactory.createOMElement(WSDL2Constants.OUT_PUT_LOCAL_NAME, null);
outMessageElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ELEMENT, null, WSDLSerializationUtil.getElementName(outMessage, nameSpaceMap)));
+ WSDLSerializationUtil.addWSAWActionAttribute(outMessageElement, getOutputAction());
axisOperationElement.addChild(outMessageElement);
}
@@ -688,6 +690,7 @@
faultElement = omFactory.createOMElement(WSDL2Constants.OUT_FAULT_LOCAL_NAME, null);
}
faultElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_REF, null, tns.getPrefix() + ":" + faultMessage.getName()));
+ WSDLSerializationUtil.addWSAWActionAttribute(faultElement, getFaultAction(faultMessage.getName()));
axisOperationElement.addChild(faultElement);
}
}
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java?view=diff&rev=525791&r1=525790&r2=525791
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java Thu Apr 5 03:39:56 2007
@@ -349,7 +349,7 @@
+ ":" + inaxisMessage.getName(), null);
addPolicyAsExtElement(PolicyInclude.INPUT_POLICY,
inaxisMessage.getPolicyInclude(), input, fac);
- addWSAWActionAttribute(input, axisOperation
+ WSDLSerializationUtil.addWSAWActionAttribute(input, axisOperation
.getInputAction());
operation.addChild(input);
}
@@ -373,7 +373,7 @@
+ ":" + outAxisMessage.getName(), null);
addPolicyAsExtElement(PolicyInclude.OUTPUT_POLICY,
outAxisMessage.getPolicyInclude(), output, fac);
- addWSAWActionAttribute(output, axisOperation
+ WSDLSerializationUtil.addWSAWActionAttribute(output, axisOperation
.getOutputAction());
operation.addChild(output);
}
@@ -391,7 +391,7 @@
+ ":" + faultyMessage.getName(), null);
fault.addAttribute(ATTRIBUTE_NAME, faultyMessage.getName(),
null);
- addWSAWActionAttribute(fault, axisOperation
+ WSDLSerializationUtil.addWSAWActionAttribute(fault, axisOperation
.getFaultAction(faultyMessage.getName()));
// TODO add policies for fault messages
operation.addChild(fault);
@@ -437,7 +437,7 @@
port.addAttribute(ATTRIBUTE_NAME, name, null);
port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
+ axisService.getName() + BINDING_NAME_SUFFIX, null);
- addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
+ WSDLSerializationUtil.addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
soap);
addPolicyAsExtElement(PolicyInclude.PORT_POLICY, axisService
@@ -490,7 +490,7 @@
port.addAttribute(ATTRIBUTE_NAME, name, null);
port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
+ axisService.getName() + SOAP12BINDING_NAME_SUFFIX, null);
- addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
+ WSDLSerializationUtil.addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
soap12);
addPolicyAsExtElement(PolicyInclude.PORT_POLICY, axisService
@@ -526,7 +526,7 @@
AddressingConstants.ADDRESSING_OPTIONAL)) {
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
- addExtensionElement(fac, binding,
+ WSDLSerializationUtil.addExtensionElement(fac, binding,
AddressingConstants.USING_ADDRESSING,
DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
wsawNamespace);
@@ -534,7 +534,7 @@
AddressingConstants.ADDRESSING_REQUIRED)) {
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
- addExtensionElement(fac, binding,
+ WSDLSerializationUtil.addExtensionElement(fac, binding,
AddressingConstants.USING_ADDRESSING,
DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
wsawNamespace);
@@ -660,7 +660,7 @@
AddressingConstants.ADDRESSING_OPTIONAL)) {
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
- addExtensionElement(fac, binding,
+ WSDLSerializationUtil.addExtensionElement(fac, binding,
AddressingConstants.USING_ADDRESSING,
DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
wsawNamespace);
@@ -668,7 +668,7 @@
AddressingConstants.ADDRESSING_REQUIRED)) {
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
- addExtensionElement(fac, binding,
+ WSDLSerializationUtil.addExtensionElement(fac, binding,
AddressingConstants.USING_ADDRESSING,
DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
wsawNamespace);
@@ -873,14 +873,6 @@
}
}
- private void addExtensionElement(OMFactory fac, OMElement element,
- String name, String att1Name, String att1Value,
- OMNamespace soapNameSpace) {
- OMElement extElement = fac.createOMElement(name, soapNameSpace);
- element.addChild(extElement);
- extElement.addAttribute(att1Name, att1Value, null);
- }
-
private void setDefinitionElement(OMElement defintion) {
this.definition = defintion;
}
@@ -900,15 +892,6 @@
extElement.addAttribute("message", WSDLSerializationUtil.getPrefix(targetNamespace, axisService.getNameSpacesMap()) + ":"
+ header.getMessage().getLocalPart(), null);
}
- }
-
- private void addWSAWActionAttribute(OMElement element, String action) {
- if (action == null || action.length() == 0) {
- return;
- }
- OMNamespace namespace = element.declareNamespace(
- AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
- element.addAttribute("Action", action, namespace);
}
private void addPolicyAsExtElement(int type, PolicyInclude policyInclude,
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java?view=diff&rev=525791&r1=525790&r2=525791
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java Thu Apr 5 03:39:56 2007
@@ -154,7 +154,8 @@
descriptionElement.addChild(axisEndpoint.getBinding().toWSDL20(tns, wsoap, whttp,
interfaceName,
- axisService.getNameSpacesMap()));
+ axisService.getNameSpacesMap(),
+ axisService.getWSAddressingFlag()));
}
descriptionElement.addChild(serviceElement);
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java?view=diff&rev=525791&r1=525790&r2=525791
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java Thu Apr 5 03:39:56 2007
@@ -28,6 +28,7 @@
import org.apache.axis2.wsdl.HTTPHeaderMessage;
import org.apache.axis2.namespace.Constants;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
@@ -329,6 +330,45 @@
descriptionElement.declareNamespace((String) nameSpaceMap.get(key), key);
}
}
+ }
+ }
+
+ public static void addWSAWActionAttribute(OMElement element, String action) {
+ if (action == null || action.length() == 0) {
+ return;
+ }
+ OMNamespace namespace = element.declareNamespace(
+ AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
+ element.addAttribute("Action", action, namespace);
+ }
+
+ public static void addExtensionElement(OMFactory fac, OMElement element,
+ String name, String att1Name, String att1Value,
+ OMNamespace soapNameSpace) {
+ OMElement extElement = fac.createOMElement(name, soapNameSpace);
+ element.addChild(extElement);
+ extElement.addAttribute(att1Name, att1Value, null);
+ }
+
+ public static void addWSAddressingToBinding(String addressingFlag, OMFactory omFactory, OMElement bindingElement) {
+ // Add WS-Addressing UsingAddressing element if appropriate
+ // SHOULD be on the binding element per the specification
+ if (addressingFlag.equals(
+ AddressingConstants.ADDRESSING_OPTIONAL)) {
+ OMNamespace wsawNamespace = omFactory.createOMNamespace(
+ AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
+ WSDLSerializationUtil.addExtensionElement(omFactory, bindingElement,
+ AddressingConstants.USING_ADDRESSING,
+ "required", "true",
+ wsawNamespace);
+ } else if (addressingFlag.equals(
+ AddressingConstants.ADDRESSING_REQUIRED)) {
+ OMNamespace wsawNamespace = omFactory.createOMNamespace(
+ AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
+ WSDLSerializationUtil.addExtensionElement(omFactory, bindingElement,
+ AddressingConstants.USING_ADDRESSING,
+ "required", "true",
+ wsawNamespace);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org