Author: thomas.diesler(a)jboss.com
Date: 2007-10-11 12:18:51 -0400 (Thu, 11 Oct 2007)
New Revision: 4741
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
stack/native/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
Log:
[JBWS-1807] HTTP bindings for Provider
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2007-10-11
16:12:29 UTC (rev 4740)
+++
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2007-10-11
16:18:51 UTC (rev 4741)
@@ -41,6 +41,7 @@
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;
@@ -177,45 +178,51 @@
// Build endpoint meta data
for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
{
- QName portName = wsdlEndpoint.getName();
- QName interfaceQName = wsdlEndpoint.getInterface().getName();
- ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData,
portName, interfaceQName, Type.JAXRPC);
- epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
- serviceMetaData.addEndpoint(epMetaData);
-
- // config-name, config-file
- if (serviceRefMetaData != null)
+ 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))
{
- String configName= serviceRefMetaData.getConfigName();
- String configFile = serviceRefMetaData.getConfigFile();
- if (configName != null || configFile != null)
- epMetaData.setConfigName(configName, configFile);
- }
+ QName portName = wsdlEndpoint.getName();
+ QName interfaceQName = wsdlEndpoint.getInterface().getName();
+ ClientEndpointMetaData epMetaData = new
ClientEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXRPC);
+ epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
+ serviceMetaData.addEndpoint(epMetaData);
- // Init the endpoint binding
- initEndpointBinding(wsdlEndpoint, epMetaData);
+ // config-name, config-file
+ if (serviceRefMetaData != null)
+ {
+ String configName= serviceRefMetaData.getConfigName();
+ String configFile = serviceRefMetaData.getConfigFile();
+ if (configName != null || configFile != null)
+ epMetaData.setConfigName(configName, configFile);
+ }
- // Init the service encoding style
- initEndpointEncodingStyle(epMetaData);
+ // Init the endpoint binding
+ initEndpointBinding(wsdlEndpoint, epMetaData);
- ServiceEndpointInterfaceMapping seiMapping = null;
- if (javaWsdlMapping != null)
- {
- QName portType = wsdlEndpoint.getInterface().getName();
- seiMapping =
javaWsdlMapping.getServiceEndpointInterfaceMappingByPortType(portType);
- if (seiMapping != null)
+ // Init the service encoding style
+ initEndpointEncodingStyle(epMetaData);
+
+ ServiceEndpointInterfaceMapping seiMapping = null;
+ if (javaWsdlMapping != null)
{
-
epMetaData.setServiceEndpointInterfaceName(seiMapping.getServiceEndpointInterface());
+ QName portType = wsdlEndpoint.getInterface().getName();
+ seiMapping =
javaWsdlMapping.getServiceEndpointInterfaceMappingByPortType(portType);
+ if (seiMapping != null)
+ {
+
epMetaData.setServiceEndpointInterfaceName(seiMapping.getServiceEndpointInterface());
+ }
+ else
+ {
+ log.warn("Cannot obtain the SEI mapping for: " + portType);
+ }
}
- else
- {
- log.warn("Cannot obtain the SEI mapping for: " + portType);
- }
+
+ processEndpointMetaDataExtensions(epMetaData, wsdlDefinitions);
+ setupOperationsFromWSDL(epMetaData, wsdlEndpoint, seiMapping);
+ setupHandlers(serviceRefMetaData, portName, epMetaData);
}
-
- processEndpointMetaDataExtensions(epMetaData, wsdlDefinitions);
- setupOperationsFromWSDL(epMetaData, wsdlEndpoint, seiMapping);
- setupHandlers(serviceRefMetaData, portName, epMetaData);
}
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-10-11
16:12:29 UTC (rev 4740)
+++
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-10-11
16:18:51 UTC (rev 4741)
@@ -149,23 +149,28 @@
for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
{
- QName portName = wsdlEndpoint.getName();
- QName interfaceQName = wsdlEndpoint.getInterface().getName();
- ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData,
portName, interfaceQName, Type.JAXWS);
- epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
- serviceMetaData.addEndpoint(epMetaData);
+ 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))
+ {
+ QName portName = wsdlEndpoint.getName();
+ QName interfaceQName = wsdlEndpoint.getInterface().getName();
+ ClientEndpointMetaData epMetaData = new
ClientEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXWS);
+ epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
+ serviceMetaData.addEndpoint(epMetaData);
- // Init the endpoint binding
- initEndpointBinding(wsdlEndpoint, epMetaData);
+ // Init the endpoint binding
+ initEndpointBinding(wsdlEndpoint, epMetaData);
- // Init the service encoding style
- initEndpointEncodingStyle(epMetaData);
+ // Init the service encoding style
+ initEndpointEncodingStyle(epMetaData);
- setupOperationsFromWSDL(epMetaData, wsdlEndpoint);
+ setupOperationsFromWSDL(epMetaData, wsdlEndpoint);
- // service-ref contributions
- bufferServiceRefContributions(epMetaData);
-
+ // service-ref contributions
+ bufferServiceRefContributions(epMetaData);
+ }
}
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2007-10-11
16:12:29 UTC (rev 4740)
+++ stack/native/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2007-10-11
16:18:51 UTC (rev 4741)
@@ -615,7 +615,7 @@
return locationURL;
}
- private void processPortType(Definition srcWsdl, PortType srcPortType) throws
WSDLException
+ private void processPortType(Definition srcWsdl, PortType srcPortType, WSDLBinding
destBinding) throws WSDLException
{
log.trace("processPortType: " + srcPortType.getQName());
@@ -640,11 +640,11 @@
destWsdl.addInterface(destInterface);
- processPortTypeOperations(srcWsdl, destInterface, srcPortType);
+ processPortTypeOperations(srcWsdl, destInterface, srcPortType, destBinding);
}
}
- private void processPortTypeOperations(Definition srcWsdl, WSDLInterface
destInterface, PortType srcPortType) throws WSDLException
+ private void processPortTypeOperations(Definition srcWsdl, WSDLInterface
destInterface, PortType srcPortType, WSDLBinding destBinding) throws WSDLException
{
Iterator itOperations = srcPortType.getOperations().iterator();
while (itOperations.hasNext())
@@ -657,17 +657,18 @@
if (srcOperation.getStyle() != null && false ==
OperationType.NOTIFICATION.equals(srcOperation.getStyle()))
{
- processOperationInput(srcWsdl, srcOperation, destOperation, srcPortType);
+ processPortTypeOperationInput(srcWsdl, srcOperation, destOperation,
srcPortType, destBinding);
}
- processOperationOutput(srcWsdl, srcOperation, destOperation, srcPortType);
- processOperationFaults(srcOperation, destOperation, destInterface);
+ processPortTypeOperationOutput(srcWsdl, srcOperation, destOperation,
srcPortType, destBinding);
+ processPortTypeOperationFaults(srcOperation, destOperation, destInterface,
destBinding);
destInterface.addOperation(destOperation);
}
}
- private void processOperationInput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType) throws WSDLException
+ private void processPortTypeOperationInput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType,
+ WSDLBinding destBinding) throws WSDLException
{
Input srcInput = srcOperation.getInput();
if (srcInput != null)
@@ -703,7 +704,7 @@
if (Constants.URI_STYLE_DOCUMENT == destOperation.getStyle())
{
WSDLInterfaceOperationInput destInput = new
WSDLInterfaceOperationInput(destOperation);
- QName elementName = messagePartToElementName(srcMessage, srcPart,
destOperation);
+ QName elementName = messagePartToElementName(srcMessage, srcPart,
destOperation, destBinding);
destInput.setElement(elementName);
//Lets remember the Message name
@@ -722,8 +723,13 @@
// binding will pick it up
QName xmlType = srcPart.getTypeName();
if (xmlType != null)
+ {
rpcInput.addChildPart(new WSDLRPCPart(srcPart.getName(),
destWsdl.registerQName(xmlType)));
- else messagePartToElementName(srcMessage, srcPart, destOperation);
+ }
+ else
+ {
+ messagePartToElementName(srcMessage, srcPart, destOperation,
destBinding);
+ }
}
}
if (Constants.URI_STYLE_RPC == destOperation.getStyle())
@@ -755,7 +761,8 @@
return canBeSkipped;
}
- private void processOperationOutput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType) throws WSDLException
+ private void processPortTypeOperationOutput(Definition srcWsdl, Operation
srcOperation, WSDLInterfaceOperation destOperation, PortType srcPortType,
+ WSDLBinding destBinding) throws WSDLException
{
Output srcOutput = srcOperation.getOutput();
if (srcOutput == null)
@@ -802,7 +809,7 @@
{
WSDLInterfaceOperationOutput destOutput = new
WSDLInterfaceOperationOutput(destOperation);
- QName elementName = messagePartToElementName(srcMessage, srcPart,
destOperation);
+ QName elementName = messagePartToElementName(srcMessage, srcPart,
destOperation, destBinding);
destOutput.setElement(elementName);
// Lets remember the Message name
@@ -822,7 +829,7 @@
QName xmlType = srcPart.getTypeName();
if (xmlType != null)
rpcOutput.addChildPart(new WSDLRPCPart(srcPart.getName(),
destWsdl.registerQName(xmlType)));
- else messagePartToElementName(srcMessage, srcPart, destOperation);
+ else messagePartToElementName(srcMessage, srcPart, destOperation,
destBinding);
}
}
@@ -837,7 +844,8 @@
}
}
- private void processOperationFaults(Operation srcOperation, WSDLInterfaceOperation
destOperation, WSDLInterface destInterface) throws WSDLException
+ private void processPortTypeOperationFaults(Operation srcOperation,
WSDLInterfaceOperation destOperation, WSDLInterface destInterface, WSDLBinding
destBinding)
+ throws WSDLException
{
Map faults = srcOperation.getFaults();
@@ -885,18 +893,23 @@
}
/** Translate the message part name into an XML element name.
- * @throws WSDLException
*/
- private QName messagePartToElementName(Message srcMessage, Part srcPart,
WSDLInterfaceOperation destOperation) throws WSDLException
+ private QName messagePartToElementName(Message srcMessage, Part srcPart,
WSDLInterfaceOperation destOperation, WSDLBinding destBinding) throws WSDLException
{
- QName xmlName;
+ QName xmlName = null;
// R2306 A wsdl:message in a DESCRIPTION MUST NOT specify both type and element
attributes on the same wsdl:part
if (srcPart.getTypeName() != null && srcPart.getElementName() != null)
throw new WSDLException(WSDLException.INVALID_WSDL, "Message parts must not
define an element name and type name: " + srcMessage.getQName());
+ String bindingType = destBinding.getType();
+ if (Constants.NS_HTTP.equals(bindingType))
+ {
+ xmlName = new QName(srcPart.getName());
+ }
+
String style = destOperation.getStyle();
- if (Constants.URI_STYLE_RPC.equals(style))
+ if (xmlName == null && Constants.URI_STYLE_RPC.equals(style))
{
// R2203 An rpc-literal binding in a DESCRIPTION MUST refer, in its
soapbind:body element(s),
// only to wsdl:part element(s) that have been defined using the type
attribute.
@@ -911,7 +924,8 @@
if (xmlName == null)
xmlName = new QName(srcPart.getName());
}
- else
+
+ if (xmlName == null && Constants.URI_STYLE_DOCUMENT.equals(style))
{
// R2204 A document-literal binding in a DESCRIPTION MUST refer, in each of its
soapbind:body element(s),
// only to wsdl:part element(s) that have been defined using the element
attribute
@@ -923,6 +937,9 @@
xmlName = srcPart.getElementName();
}
+ if (xmlName == null)
+ throw new IllegalStateException("Cannot name for wsdl part: " +
srcPart);
+
xmlName = destWsdl.registerQName(xmlName);
String key = srcMessage.getQName() + "->" + srcPart.getName();
messagePartToElementMap.put(key, xmlName);
@@ -987,7 +1004,7 @@
return ("rpc".equals(operationStyle)) ? Constants.URI_STYLE_RPC :
Constants.URI_STYLE_DOCUMENT;
}
- private boolean processBinding(Definition srcWsdl, Binding srcBinding) throws
WSDLException
+ private WSDLBinding processBinding(Definition srcWsdl, Binding srcBinding) throws
WSDLException
{
QName srcBindingQName = srcBinding.getQName();
log.trace("processBinding: " + srcBindingQName);
@@ -997,7 +1014,6 @@
{
PortType srcPortType = getDefinedPortType(srcBinding);
- // Get binding type
String bindingType = null;
List<ExtensibilityElement> extList =
srcBinding.getExtensibilityElements();
for (ExtensibilityElement extElement : extList)
@@ -1025,7 +1041,6 @@
if (bindingType == null)
throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot obtain
binding type for: " + srcBindingQName);
- // Ignore unknown bindings
if (Constants.NS_SOAP11.equals(bindingType) ||
Constants.NS_SOAP12.equals(bindingType) || Constants.NS_HTTP.equals(bindingType))
{
destBinding = new WSDLBinding(destWsdl, srcBindingQName);
@@ -1034,11 +1049,9 @@
processUnknownExtensibilityElements(srcBinding, destBinding);
destWsdl.addBinding(destBinding);
- // mark SWA Parts upfront
preProcessSWAParts(srcBinding, srcWsdl);
+ processPortType(srcWsdl, srcPortType, destBinding);
- processPortType(srcWsdl, srcPortType);
-
String bindingStyle = Style.getDefaultStyle().toString();
for (ExtensibilityElement extElement : extList)
{
@@ -1058,7 +1071,7 @@
}
}
- return destBinding != null;
+ return destBinding;
}
/** The port might reference a binding which is defined in another wsdl
@@ -1076,7 +1089,7 @@
List<Binding> bindings = bindingsByNamespace.get(nsURI);
if (bindings == null)
throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find
bindings for namespace: " + nsURI);
-
+
for (Binding auxBinding : bindings)
{
if (srcBindingName.equals(auxBinding.getQName()))
@@ -1086,7 +1099,7 @@
}
}
}
-
+
return srcBinding;
}
@@ -1562,7 +1575,8 @@
destEndpoint.setAddress(getSOAPAddress(srcPort));
processUnknownExtensibilityElements(srcPort, destEndpoint);
- if (processBinding(srcWsdl, srcBinding))
+ WSDLBinding destBinding = processBinding(srcWsdl, srcBinding);
+ if (destBinding != null)
destService.addEndpoint(destEndpoint);
}