Author: richard.opalka(a)jboss.com
Date: 2010-05-21 08:12:58 -0400 (Fri, 21 May 2010)
New Revision: 12303
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/metadata/AddressingOpMetaExt.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
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/JAXWSWebServiceMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java
Log:
[JBWS-3031] use WSDL meta data if addressing related annotations are missing
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-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -339,8 +339,8 @@
if (faultMD != null)
{
- final String beanName = faultMD.getFaultBeanName();
- return addressingMD.getFaultAction(beanName);
+ final QName faultQName = faultMD.getXmlName();
+ return addressingMD.getFaultAction(faultQName);
}
return ADDR_CONSTANTS.getDefaultFaultAction();
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java 2010-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -24,6 +24,8 @@
import java.util.HashMap;
import java.util.Map;
+import javax.xml.namespace.QName;
+
import org.jboss.ws.metadata.umdm.MetaDataExtension;
/**
@@ -38,7 +40,7 @@
{
private String inboundAction;
private String outboundAction;
- private Map<String, String> faultAction = new HashMap<String, String>();
+ private Map<QName, String> faultAction = new HashMap<QName, String>();
public AddressingOpMetaExt(String extensionNameSpace)
{
@@ -65,14 +67,14 @@
this.outboundAction = outboundAction;
}
- public void setFaultAction(String beanName, String action)
+ public void setFaultAction(QName faultQName, String action)
{
- this.faultAction.put(beanName, action);
+ this.faultAction.put(faultQName, action);
}
- public String getFaultAction(String beanName)
+ public String getFaultAction(QName faultQName)
{
- return this.faultAction.get(beanName);
+ return this.faultAction.get(faultQName);
}
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java 2010-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -149,7 +149,7 @@
}
}
- public void processPolicyExtensions(EndpointMetaData epMetaData, WSDLDefinitions
wsdlDefinitions)
+ public void processPolicyExtensions(EndpointMetaData endpointMD, WSDLDefinitions
wsdlDefinitions)
{
//Collect all policies defined in our wsdl definitions
DOMPolicyReader reader =
(DOMPolicyReader)PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
@@ -159,56 +159,71 @@
Policy policy = reader.readPolicy(policyElement.getElement());
localPolicyRegistry.register(policy.getPolicyURI(), policy);
}
+
//Port scope
- WSDLService wsdlService =
wsdlDefinitions.getService(epMetaData.getServiceMetaData().getServiceName());
+ WSDLService wsdlService =
wsdlDefinitions.getService(endpointMD.getServiceMetaData().getServiceName());
if (wsdlService != null)
{
- WSDLEndpoint wsdlEndpoint = wsdlService.getEndpoint(epMetaData.getPortName());
+ WSDLEndpoint wsdlEndpoint = wsdlService.getEndpoint(endpointMD.getPortName());
if (wsdlEndpoint != null)
{
- List<WSDLExtensibilityElement> portPolicyRefList =
wsdlEndpoint.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
- processPolicies(portPolicyRefList, PolicyScopeLevel.WSDL_PORT,
localPolicyRegistry, epMetaData);
+ // process Policy elements
+ List<WSDLExtensibilityElement> portPolicies =
wsdlEndpoint.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICY);
+ processPolicies(portPolicies, PolicyScopeLevel.WSDL_PORT, endpointMD);
+
+ // process PolicyReference elements
+ List<WSDLExtensibilityElement> portPolicyReferences =
wsdlEndpoint.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
+ processPolicyReferences(portPolicyReferences, PolicyScopeLevel.WSDL_PORT,
localPolicyRegistry, endpointMD);
}
else
{
- log
- .warn("Cannot get port '" + epMetaData.getPortName()
- + "' from the given wsdl definitions! Eventual policies
attached to this port won't be considered.");
+ log.warn("Cannot get port '" + endpointMD.getPortName()
+ + "' from the given wsdl definitions! Eventual policies
attached to this port won't be considered.");
}
}
else
{
- log.warn("Cannot get service '" +
epMetaData.getServiceMetaData().getServiceName()
+ log.warn("Cannot get service '" +
endpointMD.getServiceMetaData().getServiceName()
+ "' from the given wsdl definitions! Eventual policies attached
to this service won't be considered.");
}
//Binding scope
- WSDLBinding wsdlBinding =
wsdlDefinitions.getBindingByInterfaceName(epMetaData.getPortTypeName());
+ WSDLBinding wsdlBinding =
wsdlDefinitions.getBindingByInterfaceName(endpointMD.getPortTypeName());
if (wsdlBinding != null)
{
- List<WSDLExtensibilityElement> bindingPolicyRefList =
wsdlBinding.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
- processPolicies(bindingPolicyRefList, PolicyScopeLevel.WSDL_BINDING,
localPolicyRegistry, epMetaData);
+ // process Policy elements
+ List<WSDLExtensibilityElement> bindingPolicies =
wsdlBinding.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICY);
+ processPolicies(bindingPolicies, PolicyScopeLevel.WSDL_BINDING, endpointMD);
+
+ // process PolicyReference elements
+ List<WSDLExtensibilityElement> bindingPolicyReferences =
wsdlBinding.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
+ processPolicyReferences(bindingPolicyReferences, PolicyScopeLevel.WSDL_BINDING,
localPolicyRegistry, endpointMD);
}
else
{
- log.warn("Cannot get binding for portType '" +
epMetaData.getPortTypeName()
+ log.warn("Cannot get binding for portType '" +
endpointMD.getPortTypeName()
+ "' from the given wsdl definitions! Eventual policies attached
to this binding won't be considered.");
}
//PortType scope
- WSDLInterface wsdlInterface =
wsdlDefinitions.getInterface(epMetaData.getPortTypeName());
+ WSDLInterface wsdlInterface =
wsdlDefinitions.getInterface(endpointMD.getPortTypeName());
if (wsdlInterface != null)
{
- WSDLProperty portTypePolicyProp =
wsdlInterface.getProperty(Constants.WSDL_PROPERTY_POLICYURIS);
- processPolicies(portTypePolicyProp, PolicyScopeLevel.WSDL_PORT_TYPE,
localPolicyRegistry, epMetaData);
+ // process Policy elements
+ List<WSDLExtensibilityElement> portTypePolicies =
wsdlInterface.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICY);
+ processPolicies(portTypePolicies, PolicyScopeLevel.WSDL_PORT_TYPE, endpointMD);
+
+ // process PolicyReference elements
+ WSDLProperty portTypePolicyReferences =
wsdlInterface.getProperty(Constants.WSDL_PROPERTY_POLICYURIS);
+ processPolicies(portTypePolicyReferences, PolicyScopeLevel.WSDL_PORT_TYPE,
localPolicyRegistry, endpointMD);
}
else
{
- log.warn("Cannot get portType '" + epMetaData.getPortTypeName()
+ log.warn("Cannot get portType '" + endpointMD.getPortTypeName()
+ "' from the given wsdl definitions! Eventual policies attached
to this portType won't be considered.");
}
}
-
+
private void processPolicies(WSDLProperty policyProp, PolicyScopeLevel scope,
PolicyRegistry localPolicies, ExtensibleMetaData extMetaData)
{
if (policyProp != null && policyProp.getValue() != null)
@@ -221,8 +236,21 @@
}
}
}
+
+ private void processPolicies(List<WSDLExtensibilityElement> policies,
PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
+ {
+ if (policies != null && policies.size() != 0)
+ {
+ DOMPolicyReader reader =
(DOMPolicyReader)PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+ for (WSDLExtensibilityElement policyElement : policies)
+ {
+ Policy policy = reader.readPolicy(policyElement.getElement());
+ deployPolicy(policy, scope, extMetaData);
+ }
+ }
+ }
- private void processPolicies(List<WSDLExtensibilityElement> policyReferences,
PolicyScopeLevel scope, PolicyRegistry localPolicies, ExtensibleMetaData extMetaData)
+ private void processPolicyReferences(List<WSDLExtensibilityElement>
policyReferences, PolicyScopeLevel scope, PolicyRegistry localPolicies, ExtensibleMetaData
extMetaData)
{
if (policyReferences != null && policyReferences.size() != 0)
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2010-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -43,6 +43,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxrpc.UnqualifiedFaultException;
import org.jboss.ws.core.soap.Use;
import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl;
import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
@@ -50,14 +51,19 @@
import org.jboss.ws.extensions.eventing.EventingUtils;
import org.jboss.ws.extensions.eventing.metadata.EventingEpMetaExt;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.TypeMappingMetaData;
+import org.jboss.ws.metadata.umdm.TypesMetaData;
import org.jboss.ws.metadata.wsdl.WSDLBinding;
import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
import org.jboss.ws.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault;
import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
import org.jboss.ws.metadata.wsdl.WSDLProperty;
import org.jboss.ws.metadata.wsdl.WSDLService;
@@ -526,51 +532,180 @@
/** Process operation meta data extensions. */
protected void processOpMetaExtensions(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation)
{
+ final AddressingProperties ADDR = new AddressingPropertiesImpl();
+ final AddressingOpMetaExt addrExt = new
AddressingOpMetaExt(ADDR.getNamespaceURI());
+ final boolean isOneWay =
Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern());
- String tns = wsdlOperation.getName().getNamespaceURI();
- String portTypeName = wsdlOperation.getName().getLocalPart();
+ final String inputAction = this.getInputAction(wsdlOperation, isOneWay);
+ addrExt.setInboundAction(inputAction);
+
+ if (!isOneWay)
+ {
+ final String outputAction = this.getOutputAction(wsdlOperation, isOneWay);
+ addrExt.setOutboundAction(outputAction);
+
+ setFaultActions(opMetaData, wsdlOperation, addrExt);
+ }
- AddressingProperties ADDR = new AddressingPropertiesImpl();
- AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
+ opMetaData.addExtension(addrExt);
+ }
+
+ private void setFaultActions(final OperationMetaData opMetaData, final
WSDLInterfaceOperation wsdlOperation, final AddressingOpMetaExt addrExt)
+ {
+ for (WSDLInterfaceOperationOutfault fault : wsdlOperation.getOutfaults())
+ {
+ final QName faultQName =
wsdlOperation.getWsdlInterface().getFault(fault.getRef()).getElement();
+ final String action = this.getFaultAction(wsdlOperation, fault);
+
+ addrExt.setFaultAction(faultQName, action);
+ }
+ }
+
+ /*
+ Copy/paste from
http://www.w3.org/TR/wsdl#_names
- // inbound action
+ 2.4.5 Names of Elements within an Operation
+
+ The name attribute of the input and output elements provides a unique name among all
+ input and output elements within the enclosing port type.
+
+ In order to avoid having to name each input and output element within an operation,
+ WSDL provides some default values based on the operation name. If the name attribute
+ is not specified on a one-way or notification message, it defaults to the name of the
operation.
+ If the name attribute is not specified on the input or output messages of a
+ request-response or solicit-response operation, the name defaults to the name of
+ the operation with "Request"/"Solicit" or "Response"
appended, respectively.
+
+ Each fault element must be named to allow a binding to specify the concrete format of
the fault message.
+ The name of the fault element is unique within the set of faults defined for the
operation.
+ */
+
+ private String getInputAction(final WSDLInterfaceOperation wsdlOperation, final
boolean oneWay)
+ {
WSDLProperty wsaInAction =
wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_IN);
- if (wsaInAction != null)
+ if (wsaInAction != null && wsaInAction.getValue() != null &&
!"".equals(wsaInAction.getValue()))
{
- addrExt.setInboundAction(wsaInAction.getValue());
+ return wsaInAction.getValue();
}
+
+ final String prefix = this.getActionPrefix(wsdlOperation);
+ String operationName = wsdlOperation.getName().getLocalPart();
+
+ WSDLProperty inputName =
wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN);
+ if (inputName != null && inputName.getValue() != null &&
!"".equals(inputName.getValue()))
+ {
+ return prefix + inputName.getValue();
+ }
else
{
- WSDLProperty messageName =
wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN);
- if (messageName != null)
- {
- addrExt.setInboundAction(tns + "/" + portTypeName + "/" +
messageName.getValue());
- }
- else
- {
- addrExt.setInboundAction(tns + "/" + portTypeName +
"/IN");
- }
+ return prefix + operationName + (oneWay ? "" : "Request");
}
-
- // outbound action
+ }
+
+ private String getOutputAction(final WSDLInterfaceOperation wsdlOperation, final
boolean oneWay)
+ {
WSDLProperty wsaOutAction =
wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_OUT);
- if (wsaOutAction != null)
+ if (wsaOutAction != null && wsaOutAction.getValue() != null &&
!"".equals(wsaOutAction.getValue()))
{
- addrExt.setOutboundAction(wsaOutAction.getValue());
+ return wsaOutAction.getValue();
}
+
+ final String prefix = this.getActionPrefix(wsdlOperation);
+ String operationName = wsdlOperation.getName().getLocalPart();
+
+ WSDLProperty outputName =
wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT);
+ if (outputName != null && outputName.getValue() != null &&
!"".equals(outputName.getValue()))
+ {
+ return prefix + outputName.getValue();
+ }
else
{
- WSDLProperty messageName =
wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT);
- if (messageName != null)
+ return prefix + operationName + (oneWay ? "" : "Response");
+ }
+ }
+
+ /*
+ Copy/paste from
http://www.w3.org/TR/2007/REC-ws-addr-metadata-20070904/#defactionwsdl11
+
+ 4.4.4 Default Action Pattern for WSDL 1.1
+
+ A default pattern is also defined for backwards compatibility with WSDL 1.1. In the
absence of an explicitly specified value
+ for the [action] property (see section 4.4.1 Explicit Association), the following
pattern is used to construct a default action
+ for inputs and outputs. The general form of an action IRI is as follows:
+
+ Example 4-6. Structure of defaulted wsa:Action IRI.
+
+ [target namespace][delimiter][port type name][delimiter][input|output name]
+
+ For fault messages, the general form of an action IRI is as follows:
+
+ Example 4-7. Structure of default wsa:Action IRI for faults
+
+ [target namespace][delimiter][port type name][delimiter][operation
name][delimiter]Fault[delimiter][fault name]
+ */
+ private String getFaultAction(final WSDLInterfaceOperation wsdlOperation, final
WSDLInterfaceOperationOutfault fault)
+ {
+ final WSDLProperty wsaFaultAction =
fault.getProperty(Constants.WSDL_PROPERTY_ACTION_FAULT);
+ if (wsaFaultAction != null && wsaFaultAction.getValue() != null &&
!"".equals(wsaFaultAction.getValue()))
+ {
+ return wsaFaultAction.getValue();
+ }
+
+ final String prefix = this.getActionPrefix(wsdlOperation);
+ String operationName = wsdlOperation.getName().getLocalPart();
+
+ final WSDLProperty faultName =
fault.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_FAULT);
+ if (faultName != null && faultName.getValue() != null &&
!"".equals(faultName.getValue()))
+ {
+ return prefix + operationName + "/Fault/" + faultName.getValue();
+ }
+
+ throw new IllegalStateException();
+ }
+
+ private String getActionPrefix(final WSDLInterfaceOperation wsdlOperation)
+ {
+ String tns = wsdlOperation.getName().getNamespaceURI();
+ if (!tns.endsWith("/"))
+ tns += "/";
+
+ final String portTypeName =
wsdlOperation.getWsdlInterface().getName().getLocalPart();
+
+ return tns + portTypeName + "/";
+ }
+
+ protected void buildFaultMetaData(OperationMetaData opMetaData, WSDLInterfaceOperation
wsdlOperation)
+ {
+ TypesMetaData typesMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+
+ WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface();
+ for (WSDLInterfaceOperationOutfault outFault : wsdlOperation.getOutfaults())
+ {
+ QName ref = outFault.getRef();
+
+ WSDLInterfaceFault wsdlFault = wsdlInterface.getFault(ref);
+ QName xmlName = wsdlFault.getElement();
+ QName xmlType = wsdlFault.getXmlType();
+ String javaTypeName = null;
+
+ if (xmlType == null)
{
- addrExt.setOutboundAction(tns + "/" + portTypeName + "/"
+ messageName.getValue());
+ log.warn("Cannot obtain fault type for element: " + xmlName);
+ xmlType = xmlName;
}
- else
+
+ TypeMappingMetaData tmMetaData =
typesMetaData.getTypeMappingByXMLType(xmlType);
+ if (tmMetaData != null)
+ javaTypeName = tmMetaData.getJavaTypeName();
+
+ if (javaTypeName == null)
{
- addrExt.setOutboundAction(tns + "/" + portTypeName +
"/OUT");
+ log.warn("Cannot obtain java type mapping for: " + xmlType);
+ javaTypeName = new UnqualifiedFaultException(xmlType).getClass().getName();
}
+
+ FaultMetaData faultMetaData = new FaultMetaData(opMetaData, xmlName, xmlType,
javaTypeName);
+ opMetaData.addFault(faultMetaData);
}
-
- opMetaData.addExtension(addrExt);
}
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2010-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -904,70 +904,4 @@
}
}
- /**
- * Build default action according to the pattern described in
- *
http://www.w3.org/Submission/2004/SUBM-ws-addressing-20040810/
- * Section 3.3.2 'Default Action Pattern'<br>
- * [target namespace]/[port type name]/[input|output name]
- *
- * @param wsdlOperation
- * @return action value
- */
- private String buildWsaActionValue(WSDLInterfaceOperation wsdlOperation)
- {
- WSDLProperty wsaAction =
wsdlOperation.getProperty(Constants.WSDL_ATTRIBUTE_WSA_ACTION.toString());
- String actionValue = null;
-
- if (null == wsaAction)
- {
-
- String tns = wsdlOperation.getName().getNamespaceURI();
- String portTypeName = wsdlOperation.getName().getLocalPart();
- WSDLProperty messageName =
wsdlOperation.getProperty("http://www.jboss.org/jbossws/messagename/...;
-
- actionValue = new String(tns + "/" + portTypeName + "/" +
messageName.getValue());
- }
- else
- {
- actionValue = wsaAction.getValue();
- }
-
- return actionValue;
- }
-
- protected void buildFaultMetaData(OperationMetaData opMetaData, WSDLInterfaceOperation
wsdlOperation)
- {
- TypesMetaData typesMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
-
- WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface();
- for (WSDLInterfaceOperationOutfault outFault : wsdlOperation.getOutfaults())
- {
- QName ref = outFault.getRef();
-
- WSDLInterfaceFault wsdlFault = wsdlInterface.getFault(ref);
- QName xmlName = wsdlFault.getElement();
- QName xmlType = wsdlFault.getXmlType();
- String javaTypeName = null;
-
- if (xmlType == null)
- {
- log.warn("Cannot obtain fault type for element: " + xmlName);
- xmlType = xmlName;
- }
-
- TypeMappingMetaData tmMetaData =
typesMetaData.getTypeMappingByXMLType(xmlType);
- if (tmMetaData != null)
- javaTypeName = tmMetaData.getJavaTypeName();
-
- if (javaTypeName == null)
- {
- log.warn("Cannot obtain java type mapping for: " + xmlType);
- javaTypeName = new UnqualifiedFaultException(xmlType).getClass().getName();
- }
-
- FaultMetaData faultMetaData = new FaultMetaData(opMetaData, xmlName, xmlType,
javaTypeName);
- opMetaData.addFault(faultMetaData);
- }
- }
-
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2010-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -243,39 +243,6 @@
}
- protected void setupOperationsFromWSDL(EndpointMetaData epMetaData, WSDLEndpoint
wsdlEndpoint)
- {
- WSDLDefinitions wsdlDefinitions =
wsdlEndpoint.getInterface().getWsdlDefinitions();
-
- // For every WSDL interface operation build the OperationMetaData
- WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
- for (WSDLInterfaceOperation wsdlOperation : wsdlInterface.getOperations())
- {
- String opName = wsdlOperation.getName().toString();
- QName opQName = wsdlOperation.getName();
-
- // Set java method name
- String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1);
-
- OperationMetaData opMetaData = new OperationMetaData(epMetaData, opQName,
javaName);
- epMetaData.addOperation(opMetaData);
-
- // Set the operation style
- String style = wsdlOperation.getStyle();
- epMetaData.setStyle((Constants.URI_STYLE_DOCUMENT.equals(style) ? Style.DOCUMENT
: Style.RPC));
-
- // Set the operation MEP
- if (Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern()))
- opMetaData.setOneWay(true);
-
- // Set the operation SOAPAction
- WSDLBinding wsdlBinding =
wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getName());
- WSDLBindingOperation wsdlBindingOperation =
wsdlBinding.getOperationByRef(opQName);
- if (wsdlBindingOperation != null)
- opMetaData.setSOAPAction(wsdlBindingOperation.getSOAPAction());
- }
- }
-
public void rebuildEndpointMetaData(EndpointMetaData epMetaData, Class<?>
wsClass)
{
if(log.isDebugEnabled()) log.debug("START: rebuildMetaData");
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-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -88,6 +88,9 @@
import org.jboss.ws.metadata.wsdl.WSDLBindingMessageReference;
import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
import org.jboss.ws.metadata.wsdl.WSDLMIMEPart;
import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.wsf.common.JavaUtils;
@@ -341,7 +344,12 @@
QName xmlName = new QName(namespace, name);
- FaultMetaData fmd = new FaultMetaData(opMetaData, xmlName, xmlType,
exception.getName());
+ FaultMetaData fmd = opMetaData.getFault(xmlName);
+ if (fmd == null)
+ {
+ fmd = new FaultMetaData(opMetaData, xmlName, xmlType, exception.getName());
+ }
+ fmd.setJavaTypeName(exception.getName());
fmd.setFaultBeanName(faultBean);
if (fmd.loadFaultBean() == null)
@@ -565,7 +573,7 @@
* is generated using the metadata defaulting algorithm as if wsdl:input[@name] is
* not present in WSDL.
*/
- private String getInputActionName(final Method method, final EndpointMetaData
endpointMD, final OperationMetaData operationMD)
+ private String getInputActionName(final Method method, final EndpointMetaData
endpointMD, final OperationMetaData operationMD, final AddressingOpMetaExt addrExt)
{
String actionInput = null;
Action actionAnn = method.getAnnotation(Action.class);
@@ -586,6 +594,9 @@
if (webMethodAction != null)
return webMethodAction;
+ if (addrExt.getInboundAction() != null)
+ return addrExt.getInboundAction();
+
String tns = this.getEndpointNamespace(endpointMD);
String portTypeName = endpointMD.getPortTypeName().getLocalPart();
String opName = operationMD.getQName().getLocalPart();
@@ -600,7 +611,7 @@
* is generated using the metadata defaulting algorithm as if wsdl:output[@name] is
not present in
* WSDL.
*/
- private String getOutputActionName(final Method method, final EndpointMetaData
endpointMD, final OperationMetaData operationMD)
+ private String getOutputActionName(final Method method, final EndpointMetaData
endpointMD, final OperationMetaData operationMD, final AddressingOpMetaExt addrExt)
{
if (operationMD.isOneWay())
return null;
@@ -609,6 +620,9 @@
if ((actionAnn != null) && (!"".equals(actionAnn.output())))
return actionAnn.output();
+ if (addrExt.getOutboundAction() != null)
+ return addrExt.getOutboundAction();
+
String tns = this.getEndpointNamespace(endpointMD);
String portTypeName = endpointMD.getPortTypeName().getLocalPart();
String opName = operationMD.getQName().getLocalPart();
@@ -624,7 +638,7 @@
* generated using the metadata defaulting algorithm as if wsdl:fault[@name] is the
corresponding
* exception class name.
*/
- private String getFaultActionName(final Method method, final EndpointMetaData
endpointMD, final OperationMetaData operationMD, final FaultMetaData faultMD)
+ private String getFaultActionName(final Method method, final EndpointMetaData
endpointMD, final OperationMetaData operationMD, final FaultMetaData faultMD, final
AddressingOpMetaExt addrExt)
{
if (operationMD.isOneWay())
return null;
@@ -647,6 +661,10 @@
if ((faultActionAnn != null) &&
(!"".equals(faultActionAnn.value())))
return faultActionAnn.value();
+ final String faultAction = addrExt.getFaultAction(faultMD.getXmlName());
+ if (faultAction != null)
+ return faultAction;
+
String tns = this.getEndpointNamespace(endpointMD);
String portTypeName = endpointMD.getPortTypeName().getLocalPart();
String opName = operationMD.getQName().getLocalPart();
@@ -671,16 +689,24 @@
private void processMetaExtensions(Method method, EndpointMetaData endpointMD,
OperationMetaData operationMD)
{
AddressingProperties ADDR = new AddressingPropertiesImpl();
- AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
- addrExt.setInboundAction(this.getInputActionName(method, endpointMD,
operationMD));
- addrExt.setOutboundAction(this.getOutputActionName(method, endpointMD,
operationMD));
+ AddressingOpMetaExt addrExt =
(AddressingOpMetaExt)operationMD.getExtension(ADDR.getNamespaceURI());
+ if (addrExt == null)
+ {
+ addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
+ operationMD.addExtension(addrExt);
+ }
+
+ final String inboundAction = this.getInputActionName(method, endpointMD,
operationMD, addrExt);
+ addrExt.setInboundAction(inboundAction);
+
+ final String outboundAction = this.getOutputActionName(method, endpointMD,
operationMD, addrExt);
+ addrExt.setOutboundAction(outboundAction);
+
for (FaultMetaData faultMD : operationMD.getFaults())
{
- addrExt.setFaultAction(faultMD.getFaultBeanName(),
this.getFaultActionName(method, endpointMD, operationMD, faultMD));
+ addrExt.setFaultAction(faultMD.getXmlName(), this.getFaultActionName(method,
endpointMD, operationMD, faultMD, addrExt));
}
-
- operationMD.addExtension(addrExt);
}
private void processWebMethod(EndpointMetaData epMetaData, Method method)
@@ -706,10 +732,19 @@
}
String targetNS = epMetaData.getPortTypeName().getNamespaceURI();
- OperationMetaData opMetaData = new OperationMetaData(epMetaData, new
QName(targetNS, operationName), javaName);
+ OperationMetaData opMetaData = epMetaData.getOperation(new QName(targetNS,
operationName));
+ if (opMetaData == null)
+ {
+ opMetaData = new OperationMetaData(epMetaData, new QName(targetNS,
operationName), javaName);
+ epMetaData.addOperation(opMetaData);
+ opMetaData.setSOAPAction(soapAction);
+ }
+ else
+ {
+ opMetaData.setJavaName(javaName);
+ }
+
opMetaData.setOneWay(method.isAnnotationPresent(Oneway.class));
- opMetaData.setSOAPAction(soapAction);
-
if (method.isAnnotationPresent(SOAPBinding.class))
{
SOAPBinding anBinding = method.getAnnotation(SOAPBinding.class);
@@ -723,8 +758,6 @@
opMetaData.setDocumentation(method.getAnnotation(Documentation.class).content());
}
- epMetaData.addOperation(opMetaData);
-
// Build parameter meta data
// Attachment annotations on SEI parameters
List<AttachmentScanResult> scanResult =
ReflectiveAttachmentRefScanner.scanMethod(method);
@@ -1025,7 +1058,8 @@
protected void processWebMethods(EndpointMetaData epMetaData, Class<?> wsClass)
{
- epMetaData.clearOperations();
+ if (epMetaData.getFeature(AddressingFeature.class) == null)
+ epMetaData.clearOperations();
// Process @WebMethod annotations
boolean webMethodFound = false;
@@ -1156,7 +1190,46 @@
}
}
}
+
+ protected void setupOperationsFromWSDL(EndpointMetaData epMetaData, WSDLEndpoint
wsdlEndpoint)
+ {
+ WSDLDefinitions wsdlDefinitions =
wsdlEndpoint.getInterface().getWsdlDefinitions();
+ // For every WSDL interface operation build the OperationMetaData
+ WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
+ for (WSDLInterfaceOperation wsdlOperation : wsdlInterface.getOperations())
+ {
+ String opName = wsdlOperation.getName().toString();
+ QName opQName = wsdlOperation.getName();
+
+ // Set java method name
+ String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1);
+
+ OperationMetaData opMetaData = new OperationMetaData(epMetaData, opQName,
javaName);
+ epMetaData.addOperation(opMetaData);
+
+ // Set the operation style
+ String style = wsdlOperation.getStyle();
+ epMetaData.setStyle((Constants.URI_STYLE_DOCUMENT.equals(style) ? Style.DOCUMENT
: Style.RPC));
+
+ // Set the operation MEP
+ if (Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern()))
+ opMetaData.setOneWay(true);
+
+ // Set the operation SOAPAction
+ WSDLBinding wsdlBinding =
wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getName());
+ WSDLBindingOperation wsdlBindingOperation =
wsdlBinding.getOperationByRef(opQName);
+ if (wsdlBindingOperation != null)
+ opMetaData.setSOAPAction(wsdlBindingOperation.getSOAPAction());
+
+ // Build operation faults
+ buildFaultMetaData(opMetaData, wsdlOperation);
+
+ // process further operation extensions
+ processOpMetaExtensions(opMetaData, wsdlOperation);
+ }
+ }
+
/**
* Set the wrapper generator for this builder.
*/
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2010-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -26,6 +26,8 @@
import java.io.PrintStream;
import java.io.Writer;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
import javax.jws.HandlerChain;
import javax.jws.WebService;
@@ -40,12 +42,17 @@
import org.jboss.ws.extensions.policy.annotation.PolicyAttachment;
import org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder;
import org.jboss.ws.metadata.builder.MetaDataBuilder;
+import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.wsdl.WSDLBinding;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLService;
import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
@@ -151,6 +158,12 @@
if (seiClass.isAnnotationPresent(Documentation.class))
sepMetaData.setDocumentation(seiClass.getAnnotation(Documentation.class).content());
+ if (!toolMode)
+ {
+ processPolicies(serviceMetaData, sepMetaData);
+ setupOperationsFromWSDL(serviceMetaData, sepMetaData);
+ }
+
// Process web methods
processWebMethods(sepMetaData, seiClass);
@@ -172,7 +185,7 @@
// The server must always generate WSDL
if (generateWsdl || !toolMode)
- processOrGenerateWSDL(seiClass, serviceMetaData, result.wsdlLocation,
sepMetaData);
+ generateWSDL(seiClass, serviceMetaData, sepMetaData);
// No need to process endpoint items if we are in tool mode
if (toolMode)
@@ -229,6 +242,70 @@
}
}
+ private void processPolicies(ServiceMetaData serviceMetaData, EndpointMetaData
epMetaData)
+ {
+ final URL wsdlLocation = serviceMetaData.getWsdlLocation();
+
+ if (wsdlLocation != null)
+ {
+ PolicyMetaDataBuilder policyBuilder =
PolicyMetaDataBuilder.getServerSidePolicyMetaDataBuilder(toolMode);
+ WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+ //we can no longer use the user provided wsdl without parsing it right now,
since we
+ //need to look for policies and eventually choose the supported policy
alternatives
+ WSDLDefinitions wsdlDefinitions = factory.parse(wsdlLocation);
+ policyBuilder.processPolicyExtensions(epMetaData, wsdlDefinitions);
+ //now we have the UMDM containing policy data; anyway we can't write a new
wsdl file with
+ //the supported alternatives and so on, since we need to publish the file the
user provided
+ serviceMetaData.setWsdlLocation(wsdlLocation);
+ }
+ }
+
+ private void setupOperationsFromWSDL(ServiceMetaData serviceMetaData, EndpointMetaData
epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
+ if (wsdlDefinitions == null)
+ return; // nothing to parse - WSDL will be generated
+
+ QName serviceName = serviceMetaData.getServiceName();
+
+ // Get the WSDL service
+ WSDLService wsdlService = null;
+ if (serviceName == null)
+ {
+ if (wsdlDefinitions.getServices().length != 1)
+ throw new IllegalArgumentException("Expected a single service
element");
+
+ wsdlService = wsdlDefinitions.getServices()[0];
+ serviceMetaData.setServiceName(wsdlService.getName());
+ }
+ else
+ {
+ wsdlService = wsdlDefinitions.getService(serviceName);
+ }
+ if (wsdlService == null)
+ {
+ List<QName> serviceNames = new ArrayList<QName>();
+ for (WSDLService wsdls : wsdlDefinitions.getServices())
+ serviceNames.add(wsdls.getName());
+
+ log.warn("Cannot obtain wsdl service: " + serviceName + " we have
" + serviceNames);
+ return;
+ }
+
+ // Build endpoint meta data
+
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ QName bindingName = wsdlEndpoint.getBinding();
+ WSDLBinding wsdlBinding =
wsdlEndpoint.getWsdlService().getWsdlDefinitions().getBinding(bindingName);
+ String bindingType = wsdlBinding.getType();
+ if (Constants.NS_SOAP11.equals(bindingType) ||
Constants.NS_SOAP12.equals(bindingType))
+ {
+ setupOperationsFromWSDL(epMetaData, wsdlEndpoint);
+ }
+ }
+ }
+
/**
* With JAX-WS the use of webservices.xml is optional since the annotations can be
used
* to specify most of the information specified in this deployment descriptor file.
@@ -384,38 +461,25 @@
return result;
}
- private void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData, URL
wsdlLocation, EndpointMetaData epMetaData)
+ private void generateWSDL(Class wsClass, ServiceMetaData serviceMetaData,
EndpointMetaData epMetaData)
{
- PolicyMetaDataBuilder policyBuilder =
PolicyMetaDataBuilder.getServerSidePolicyMetaDataBuilder(toolMode);
- try
+ final URL wsdlLocation = serviceMetaData.getWsdlLocation();
+
+ if (wsdlLocation == null)
{
- WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx);
- generator.setExtension(extension);
- WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
- if (wsdlLocation != null)
+ try
{
- //we can no longer use the user provided wsdl without parsing it right now,
since we
- //need to look for policies and eventually choose the supported policy
alternatives
- WSDLDefinitions wsdlDefinitions = factory.parse(wsdlLocation);
- policyBuilder.processPolicyExtensions(epMetaData, wsdlDefinitions);
- //now we have the UMDM containing policy data; anyway we can't write a
new wsdl file with
- //the supported alternatives and so on, since we need to publish the file the
user provided
- serviceMetaData.setWsdlLocation(wsdlLocation);
- }
- else
- {
+ WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx);
+ generator.setExtension(extension);
+
WSDLDefinitions wsdlDefinitions = generator.generate(serviceMetaData);
writeWsdl(serviceMetaData, wsdlDefinitions, epMetaData);
}
+ catch (IOException e)
+ {
+ throw new WSException("Cannot write generated wsdl", e);
+ }
}
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (IOException e)
- {
- throw new WSException("Cannot write generated wsdl", e);
- }
}
private void writeWsdl(ServiceMetaData serviceMetaData, WSDLDefinitions
wsdlDefinitions, EndpointMetaData epMetaData) throws IOException
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java 2010-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -113,6 +113,11 @@
this.xmlType = xmlType;
}
+
+ public void setJavaTypeName(String javaTypeName)
+ {
+ this.javaTypeName = javaTypeName;
+ }
public String getJavaTypeName()
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java 2010-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -88,7 +88,7 @@
String localPart = qname.getLocalPart();
this.responseName = new QName(nsURI, localPart + "Response");
}
-
+
public EndpointMetaData getEndpointMetaData()
{
return epMetaData;
@@ -154,6 +154,11 @@
return getStyle() == Style.DOCUMENT && getParameterStyle() ==
ParameterStyle.WRAPPED;
}
+ public void setJavaName(String javaName)
+ {
+ this.javaName = javaName;
+ }
+
public String getJavaName()
{
return javaName;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2010-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -109,6 +109,7 @@
import org.jboss.ws.tools.JavaToXSD;
import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
+import org.jboss.wsf.common.addressing.AddressingConstants;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -791,54 +792,57 @@
}
}
- private void processPortTypeOperationInput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType,
- WSDLBinding destBinding) throws WSDLException
+ private void processPortTypeOperationInput(Definition srcWsdl, Operation
wsdlOperation, WSDLInterfaceOperation umdmOperation, PortType wsdlPortType,
+ WSDLBinding umdmBinding) throws WSDLException
{
- Input srcInput = srcOperation.getInput();
- if (srcInput != null)
+ Input wsdlOperationInput = wsdlOperation.getInput();
+ if (wsdlOperationInput != null)
{
- Message srcMessage = srcInput.getMessage();
+ Message srcMessage = wsdlOperationInput.getMessage();
if (srcMessage == null)
- throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find input
message on operation " + srcOperation.getName() + " on port type: "
- + srcPortType.getQName());
+ throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find input
message on operation " + wsdlOperation.getName() + " on port type: "
+ + wsdlPortType.getQName());
log.trace("processOperationInput: " + srcMessage.getQName());
- QName wsaAction =
(QName)srcInput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
+ QName wsaAction =
(QName)wsdlOperationInput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
if (wsaAction != null)
- destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN,
wsaAction.getLocalPart()));
-
- List<String> paramOrder =
(List<String>)srcOperation.getParameterOrdering();
+ umdmOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN,
wsaAction.getLocalPart()));
+ wsaAction =
(QName)wsdlOperationInput.getExtensionAttribute(AddressingConstants.Metadata.Attributes.ACTION_QNAME);
+ if (wsaAction != null)
+ umdmOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN,
wsaAction.getLocalPart()));
+
+ List<String> paramOrder =
(List<String>)wsdlOperation.getParameterOrdering();
if (paramOrder != null)
{
for (String name : paramOrder)
{
if (srcMessage.getPart(name) != null)
- destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name));
+ umdmOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name));
}
}
- WSDLInterfaceOperationInput rpcInput = new
WSDLInterfaceOperationInput(destOperation);
+ WSDLInterfaceOperationInput rpcInput = new
WSDLInterfaceOperationInput(umdmOperation);
for (Part srcPart : (List<Part>)srcMessage.getOrderedParts(paramOrder))
{
// Skip SWA attachment parts
- if (ignorePart(srcPortType, srcPart))
+ if (ignorePart(wsdlPortType, srcPart))
continue;
- if (Constants.URI_STYLE_DOCUMENT == destOperation.getStyle())
+ if (Constants.URI_STYLE_DOCUMENT == umdmOperation.getStyle())
{
- WSDLInterfaceOperationInput destInput = new
WSDLInterfaceOperationInput(destOperation);
- QName elementName = messagePartToElementName(srcMessage, srcPart,
destOperation, destBinding);
+ WSDLInterfaceOperationInput destInput = new
WSDLInterfaceOperationInput(umdmOperation);
+ QName elementName = messagePartToElementName(srcMessage, srcPart,
umdmOperation, umdmBinding);
destInput.setElement(elementName);
//Lets remember the Message name
destInput.setMessageName(srcMessage.getQName());
- destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN,
srcMessage.getQName().getLocalPart()));
+ umdmOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN, wsdlOperationInput.getName()));
destInput.setPartName(srcPart.getName());
processUnknownExtensibilityElements(srcMessage, destInput);
- destOperation.addInput(destInput);
+ umdmOperation.addInput(destInput);
}
else
{
@@ -852,18 +856,18 @@
}
else
{
- messagePartToElementName(srcMessage, srcPart, destOperation,
destBinding);
+ messagePartToElementName(srcMessage, srcPart, umdmOperation,
umdmBinding);
}
}
}
- if (Constants.URI_STYLE_RPC == destOperation.getStyle())
+ if (Constants.URI_STYLE_RPC == umdmOperation.getStyle())
{
// This is really a place holder, but also the actual value used in
// WSDL 2.0 RPC bindings
- rpcInput.setElement(destOperation.getName());
+ rpcInput.setElement(umdmOperation.getName());
rpcInput.setMessageName(srcMessage.getQName());
processUnknownExtensibilityElements(srcMessage, rpcInput);
- destOperation.addInput(rpcInput);
+ umdmOperation.addInput(rpcInput);
}
}
}
@@ -885,65 +889,68 @@
return canBeSkipped;
}
- private void processPortTypeOperationOutput(Definition srcWsdl, Operation
srcOperation, WSDLInterfaceOperation destOperation, PortType srcPortType,
- WSDLBinding destBinding) throws WSDLException
+ private void processPortTypeOperationOutput(Definition srcWsdl, Operation
wsdlOperation, WSDLInterfaceOperation umdmOperation, PortType wsdlPortType,
+ WSDLBinding umdmBinding) throws WSDLException
{
- Output srcOutput = srcOperation.getOutput();
- if (srcOutput == null)
+ Output wsdlOperationOutput = wsdlOperation.getOutput();
+ if (wsdlOperationOutput == null)
{
- destOperation.setPattern(Constants.WSDL20_PATTERN_IN_ONLY);
+ umdmOperation.setPattern(Constants.WSDL20_PATTERN_IN_ONLY);
return;
}
- Message srcMessage = srcOutput.getMessage();
- if (srcMessage == null)
- throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find output
message on operation " + srcOperation.getName() + " on port type: "
- + srcPortType.getQName());
+ Message wsdlMessage = wsdlOperationOutput.getMessage();
+ if (wsdlMessage == null)
+ throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find output
message on operation " + wsdlOperation.getName() + " on port type: "
+ + wsdlPortType.getQName());
- log.trace("processOperationOutput: " + srcMessage.getQName());
+ log.trace("processOperationOutput: " + wsdlMessage.getQName());
- destOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT);
- QName wsaAction =
(QName)srcOutput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
+ umdmOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT);
+ QName wsaAction =
(QName)wsdlOperationOutput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
if (wsaAction != null)
- destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_OUT,
wsaAction.getLocalPart()));
+ umdmOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_OUT,
wsaAction.getLocalPart()));
+ wsaAction =
(QName)wsdlOperationOutput.getExtensionAttribute(AddressingConstants.Metadata.Attributes.ACTION_QNAME);
+ if (wsaAction != null)
+ umdmOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_OUT,
wsaAction.getLocalPart()));
- List<String> paramOrder =
(List<String>)srcOperation.getParameterOrdering();
+ List<String> paramOrder =
(List<String>)wsdlOperation.getParameterOrdering();
if (paramOrder != null)
{
for (String name : paramOrder)
{
- if (srcMessage.getPart(name) != null)
+ if (wsdlMessage.getPart(name) != null)
{
- WSDLRPCSignatureItem item = destOperation.getRpcSignatureitem(name);
+ WSDLRPCSignatureItem item = umdmOperation.getRpcSignatureitem(name);
if (item != null)
item.setDirection(Direction.INOUT);
- else destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name,
Direction.OUT));
+ else umdmOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name,
Direction.OUT));
}
}
}
- WSDLInterfaceOperationOutput rpcOutput = new
WSDLInterfaceOperationOutput(destOperation);
- for (Part srcPart : (List<Part>)srcMessage.getOrderedParts(null))
+ WSDLInterfaceOperationOutput umdmOperationOutput = new
WSDLInterfaceOperationOutput(umdmOperation);
+ for (Part srcPart : (List<Part>)wsdlMessage.getOrderedParts(null))
{
// Skip SWA attachment parts
- if (ignorePart(srcPortType, srcPart))
+ if (ignorePart(wsdlPortType, srcPart))
continue;
- if (Constants.URI_STYLE_DOCUMENT == destOperation.getStyle())
+ if (Constants.URI_STYLE_DOCUMENT == umdmOperation.getStyle())
{
- WSDLInterfaceOperationOutput destOutput = new
WSDLInterfaceOperationOutput(destOperation);
+ WSDLInterfaceOperationOutput destOutput = new
WSDLInterfaceOperationOutput(umdmOperation);
- QName elementName = messagePartToElementName(srcMessage, srcPart,
destOperation, destBinding);
+ QName elementName = messagePartToElementName(wsdlMessage, srcPart,
umdmOperation, umdmBinding);
destOutput.setElement(elementName);
// Lets remember the Message name
- destOutput.setMessageName(srcMessage.getQName());
- destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT,
srcMessage.getQName().getLocalPart()));
+ destOutput.setMessageName(wsdlMessage.getQName());
+ umdmOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT, wsdlOperationOutput.getName()));
// Remember the original part name
destOutput.setPartName(srcPart.getName());
- destOperation.addOutput(destOutput);
+ umdmOperation.addOutput(destOutput);
}
else
{
@@ -952,19 +959,19 @@
// binding will pick it up
QName xmlType = srcPart.getTypeName();
if (xmlType != null)
- rpcOutput.addChildPart(new WSDLRPCPart(srcPart.getName(),
destWsdl.registerQName(xmlType)));
- else messagePartToElementName(srcMessage, srcPart, destOperation,
destBinding);
+ umdmOperationOutput.addChildPart(new WSDLRPCPart(srcPart.getName(),
destWsdl.registerQName(xmlType)));
+ else messagePartToElementName(wsdlMessage, srcPart, umdmOperation,
umdmBinding);
}
}
- if (Constants.URI_STYLE_RPC == destOperation.getStyle())
+ if (Constants.URI_STYLE_RPC == umdmOperation.getStyle())
{
// This is really a place holder, but also the actual value used in
// WSDL 2.0 RPC bindings
- QName name = destOperation.getName();
- rpcOutput.setElement(new QName(name.getNamespaceURI(), name.getLocalPart() +
"Response"));
- rpcOutput.setMessageName(srcMessage.getQName());
- destOperation.addOutput(rpcOutput);
+ QName name = umdmOperation.getName();
+ umdmOperationOutput.setElement(new QName(name.getNamespaceURI(),
name.getLocalPart() + "Response"));
+ umdmOperationOutput.setMessageName(wsdlMessage.getQName());
+ umdmOperation.addOutput(umdmOperationOutput);
}
}
@@ -981,16 +988,26 @@
}
}
- private void processOperationFault(WSDLInterfaceOperation destOperation, WSDLInterface
destInterface, Fault srcFault) throws WSDLException
+ private void processOperationFault(WSDLInterfaceOperation umdmOperation, WSDLInterface
umdmInterface, Fault wsdlFault) throws WSDLException
{
- String faultName = srcFault.getName();
+ String faultName = wsdlFault.getName();
log.trace("processOperationFault: " + faultName);
- WSDLInterfaceFault destFault = new WSDLInterfaceFault(destInterface, faultName);
- Message message = srcFault.getMessage();
- QName messageName = message.getQName();
+ WSDLInterfaceFault umdmFault = new WSDLInterfaceFault(umdmInterface, faultName);
+ Message wsdlMessage = wsdlFault.getMessage();
+ QName messageName = wsdlMessage.getQName();
- Map partsMap = message.getParts();
+ WSDLInterfaceOperationOutfault opOutFault = new
WSDLInterfaceOperationOutfault(umdmOperation);
+ QName wsaAction =
(QName)wsdlFault.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
+ if (wsaAction != null)
+ opOutFault.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_FAULT,
wsaAction.getLocalPart()));
+ wsaAction =
(QName)wsdlFault.getExtensionAttribute(AddressingConstants.Metadata.Attributes.ACTION_QNAME);
+ if (wsaAction != null)
+ opOutFault.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_FAULT,
wsaAction.getLocalPart()));
+
+ opOutFault.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_FAULT,
faultName));
+
+ Map partsMap = wsdlMessage.getParts();
if (partsMap.size() != 1)
throw new WSDLException(WSDLException.INVALID_WSDL, "Unsupported number of
fault parts in message " + messageName);
@@ -999,21 +1016,20 @@
if (xmlName != null)
{
- destFault.setElement(xmlName);
+ umdmFault.setElement(xmlName);
}
else
{
- destFault.setElement(messageName);
+ umdmFault.setElement(messageName);
log.warn("Unsupported fault message part in message: " +
messageName);
}
// Add the fault to the interface
- destInterface.addFault(destFault);
+ umdmInterface.addFault(umdmFault);
// Add the fault refererence to the operation
- WSDLInterfaceOperationOutfault opOutFault = new
WSDLInterfaceOperationOutfault(destOperation);
- opOutFault.setRef(destFault.getName());
- destOperation.addOutfault(opOutFault);
+ opOutFault.setRef(umdmFault.getName());
+ umdmOperation.addOutfault(opOutFault);
}
/** Translate the message part name into an XML element name.
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java 2010-05-21
11:46:24 UTC (rev 12302)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java 2010-05-21
12:12:58 UTC (rev 12303)
@@ -569,7 +569,7 @@
AddressingOpMetaExt addrExt = this.getAddressingMD(operationMD);
if (addrExt != null)
{
- fault.setAction(addrExt.getFaultAction(faultMD.getFaultBeanName()));
+ fault.setAction(addrExt.getFaultAction(faultMD.getXmlName()));
}
}