Author: thomas.diesler(a)jboss.com
Date: 2007-03-26 09:09:51 -0400 (Mon, 26 Mar 2007)
New Revision: 2685
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java
Log:
Add support for operation namespace defined on wsdl biniding
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2007-03-26
09:34:42 UTC (rev 2684)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2007-03-26
13:09:51 UTC (rev 2685)
@@ -160,6 +160,16 @@
QName opQName = wsdlOperation.getName();
String opName = opQName.getLocalPart();
+ WSDLBindingOperation wsdlBindingOperation =
wsdlOperation.getBindingOperation();
+ if (wsdlBindingOperation == null)
+ log.warn("Could not locate binding operation for:" + opQName);
+
+ // Change operation according namespace defined on binding
+ // <soap:body use="encoded"
namespace="http://MarshallTestW2J.org/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ String namespaceURI = wsdlBindingOperation.getNamespaceURI();
+ if (namespaceURI != null)
+ opQName = new QName(namespaceURI, opName);
+
// Set java method name
String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1);
ServiceEndpointMethodMapping seiMethodMapping = null;
@@ -186,8 +196,6 @@
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());
@@ -214,7 +222,8 @@
}
}
- private ParameterMetaData buildInputParameter(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
TypeMappingImpl typeMapping, String partName, QName xmlName, QName xmlType, int pos,
boolean optional)
+ private ParameterMetaData buildInputParameter(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
+ TypeMappingImpl typeMapping, String partName, QName xmlName, QName xmlType, int
pos, boolean optional)
{
WSDLRPCSignatureItem item = wsdlOperation.getRpcSignatureitem(partName);
if (item != null)
@@ -276,7 +285,8 @@
return inMetaData;
}
- private ParameterMetaData buildOutputParameter(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, int
pos, String partName, QName xmlName, QName xmlType, TypeMappingImpl typeMapping, boolean
optional)
+ private ParameterMetaData buildOutputParameter(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
+ int pos, String partName, QName xmlName, QName xmlType, TypeMappingImpl
typeMapping, boolean optional)
{
// Default is first listed output
boolean hasReturnMapping = opMetaData.getReturnParameter() == null;
@@ -364,7 +374,8 @@
return outMetaData;
}
- private int processBindingParameters(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int wsdlPosition)
+ private int processBindingParameters(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
+ TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int
wsdlPosition)
{
WSDLBindingOperationInput bindingInput = bindingOperation.getInputs()[0];
for (WSDLSOAPHeader header : bindingInput.getSoapHeaders())
@@ -373,7 +384,8 @@
QName xmlType = lookupSchemaType(wsdlOperation, xmlName);
String partName = header.getPartName();
- ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation,
seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++,
!header.isIncludeInSignature());
+ ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation,
seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++, !header
+ .isIncludeInSignature());
if (pmd != null)
pmd.setInHeader(true);
}
@@ -391,7 +403,8 @@
return wsdlPosition;
}
- private int processBindingOutputParameters(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int wsdlPosition)
+ private int processBindingOutputParameters(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
+ TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int
wsdlPosition)
{
WSDLBindingOperationOutput bindingOutput = bindingOperation.getOutputs()[0];
for (WSDLSOAPHeader header : bindingOutput.getSoapHeaders())
@@ -408,7 +421,8 @@
{
QName xmlType = lookupSchemaType(wsdlOperation, xmlName);
- ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation,
seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping,
!header.isIncludeInSignature());
+ ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation,
seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping, !header
+ .isIncludeInSignature());
if (pmd != null)
{
pmd.setInHeader(true);
@@ -490,17 +504,17 @@
String ns = xmlType.getNamespaceURI() != null ? xmlType.getNamespaceURI() :
"";
XSTypeDefinition xsType = schemaModel.getTypeDefinition(localPart, ns);
XOPScanner scanner = new XOPScanner();
- if(scanner.findXOPTypeDef(xsType)!=null |
(localPart.equals("base64Binary")&&ns.equals(Constants.NS_SCHEMA_XSD)))
+ if (scanner.findXOPTypeDef(xsType) != null |
(localPart.equals("base64Binary") &&
ns.equals(Constants.NS_SCHEMA_XSD)))
{
// FIXME: read the xmime:contentType from the element declaration
// See SchemaUtils#findXOPTypeDef(XSTypeDefinition typeDef) for details
/*
- FIXME: the classloader is not set yet
- paramMetaData.setXopContentType(
- MimeUtils.resolveMimeType(paramMetaData.getJavaType())
- );
- */
+ FIXME: the classloader is not set yet
+ paramMetaData.setXopContentType(
+ MimeUtils.resolveMimeType(paramMetaData.getJavaType())
+ );
+ */
paramMetaData.setXOP(true);
@@ -581,7 +595,9 @@
}
}
- private int processDocElement(OperationMetaData operation, WSDLInterfaceOperation
wsdlOperation, WSDLBindingOperation bindingOperation, ServiceEndpointMethodMapping
seiMethodMapping, TypeMappingImpl typeMapping, List<WrappedParameter>
wrappedParameters, List<WrappedParameter> wrappedResponseParameters)
+ private int processDocElement(OperationMetaData operation, WSDLInterfaceOperation
wsdlOperation, WSDLBindingOperation bindingOperation,
+ ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping,
List<WrappedParameter> wrappedParameters,
+ List<WrappedParameter> wrappedResponseParameters)
{
WSDLInterfaceOperationInput input = wsdlOperation.getInputs()[0];
WSDLBindingOperationInput bindingInput = bindingOperation.getInputs()[0];
@@ -606,7 +622,6 @@
ParameterMetaData inMetaData = new ParameterMetaData(operation, xmlName, xmlType,
javaTypeName);
operation.addParameter(inMetaData);
-
// Set the variable names
if (inMetaData.getOperationMetaData().isDocumentWrapped())
{
@@ -618,7 +633,6 @@
if (javaXmlTypeMapping == null)
throw new WSException("Cannot obtain java/xml type mapping for: " +
xmlType);
-
Map<String, String> variableMap =
createVariableMappingMap(javaXmlTypeMapping.getVariableMappings());
for (MethodParamPartsMapping partMapping :
seiMethodMapping.getMethodParamPartsMappings())
{
@@ -639,17 +653,15 @@
if (variable == null)
throw new IllegalArgumentException("Could not determine variable name
for element: " + elementName);
- WrappedParameter wrapped = new WrappedParameter(new QName(elementName),
partMapping.getParamType(), variable,
- partMapping.getParamPosition());
+ WrappedParameter wrapped = new WrappedParameter(new QName(elementName),
partMapping.getParamType(), variable, partMapping.getParamPosition());
-
String parameterMode = wsdlMessageMapping.getParameterMode();
if (parameterMode == null || parameterMode.length() < 2)
throw new IllegalArgumentException("Invalid parameter mode for
element: " + elementName);
- if (! "OUT".equals(parameterMode))
+ if (!"OUT".equals(parameterMode))
wrappedParameters.add(wrapped);
- if (! "IN".equals(parameterMode))
+ if (!"IN".equals(parameterMode))
{
wrapped.setHolder(true);
// wrapped parameters can not be shared between request/response objects
(accessors)
@@ -738,9 +750,8 @@
return isWrapParameters;
}
- private int processOutputDocElement(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation,
- ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping,
List<WrappedParameter> wrappedResponseParameters,
- int wsdlPosition)
+ private int processOutputDocElement(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
+ TypeMappingImpl typeMapping, List<WrappedParameter>
wrappedResponseParameters, int wsdlPosition)
{
WSDLInterfaceOperationOutput opOutput = wsdlOperation.getOutputs()[0];
QName xmlName = opOutput.getElement();
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java 2007-03-26
09:34:42 UTC (rev 2684)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java 2007-03-26
13:09:51 UTC (rev 2685)
@@ -57,6 +57,8 @@
private String encodingStyle = Constants.URI_LITERAL_ENC;
/** WSDL-1.1, soapAction attribute from the soap:operation element */
private String soapAction;
+ /** WSDL-1.1, namespaceURI attribute from the soap:body element */
+ private String namespaceURI;
/** A OPTIONAL set of Binding Message Reference components */
private List<WSDLBindingOperationInput> inputs = new
ArrayList<WSDLBindingOperationInput>();
@@ -104,6 +106,16 @@
this.soapAction = soapAction;
}
+ public String getNamespaceURI()
+ {
+ return namespaceURI;
+ }
+
+ public void setNamespaceURI(String namespaceURI)
+ {
+ this.namespaceURI = namespaceURI;
+ }
+
public WSDLBindingOperationInput[] getInputs()
{
WSDLBindingOperationInput[] arr = new WSDLBindingOperationInput[inputs.size()];
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java 2007-03-26
09:34:42 UTC (rev 2684)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java 2007-03-26
13:09:51 UTC (rev 2685)
@@ -257,9 +257,6 @@
return null;
WSDLBindingOperation bindingOperation = binding.getOperationByRef(getName());
- if (bindingOperation == null)
- return null;
-
return bindingOperation;
}
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2007-03-26
09:34:42 UTC (rev 2684)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2007-03-26
13:09:51 UTC (rev 2685)
@@ -1008,18 +1008,18 @@
private void processBindingOperation(Definition srcWsdl, WSDLBinding destBinding,
String bindingStyle, BindingOperation srcBindingOperation) throws WSDLException
{
- String srcBindingName = srcBindingOperation.getName();
- log.trace("processBindingOperation: " + srcBindingName);
+ String srcOperationName = srcBindingOperation.getName();
+ log.trace("processBindingOperation: " + srcOperationName);
WSDLInterface destInterface = destBinding.getInterface();
String namespaceURI = destInterface.getName().getNamespaceURI();
WSDLBindingOperation destBindingOperation = new WSDLBindingOperation(destBinding);
- QName refQName = new QName(namespaceURI, srcBindingName);
+ QName refQName = new QName(namespaceURI, srcOperationName);
destBindingOperation.setRef(refQName);
destBinding.addOperation(destBindingOperation);
- String opName = srcBindingName;
+ String opName = srcOperationName;
WSDLInterfaceOperation destIntfOperation = destInterface.getOperation(opName);
// Process soap:operation@soapAction, soap:operation@style
@@ -1066,7 +1066,6 @@
{
log.trace("processBindingInput");
- QName soap11Body = new QName(Constants.NS_SOAP11, "body");
List<ExtensibilityElement> extList =
srcBindingInput.getExtensibilityElements();
WSDLBindingOperationInput input = new
WSDLBindingOperationInput(destBindingOperation);
destBindingOperation.addInput(input);
@@ -1091,7 +1090,7 @@
}
};
- processBindingReference(srcWsdl, destBindingOperation, destIntfOperation,
soap11Body, extList, input, srcBindingOperation, cb);
+ processBindingReference(srcWsdl, destBindingOperation, destIntfOperation, extList,
input, srcBindingOperation, cb);
}
private void processBindingOutput(Definition srcWsdl, WSDLBindingOperation
destBindingOperation, final WSDLInterfaceOperation destIntfOperation,
@@ -1099,7 +1098,6 @@
{
log.trace("processBindingInput");
- QName soap11Body = new QName(Constants.NS_SOAP11, "body");
List<ExtensibilityElement> extList =
srcBindingOutput.getExtensibilityElements();
WSDLBindingOperationOutput output = new
WSDLBindingOperationOutput(destBindingOperation);
destBindingOperation.addOutput(output);
@@ -1125,20 +1123,28 @@
}
};
- processBindingReference(srcWsdl, destBindingOperation, destIntfOperation,
soap11Body, extList, output, srcBindingOperation, cb);
+ processBindingReference(srcWsdl, destBindingOperation, destIntfOperation, extList,
output, srcBindingOperation, cb);
}
- private void processBindingReference(Definition srcWsdl, WSDLBindingOperation
destBindingOperation, WSDLInterfaceOperation destIntfOperation, QName soap11Body,
- List<ExtensibilityElement> extList, WSDLBindingMessageReference reference,
BindingOperation srcBindingOperation, ReferenceCallback callback)
+ private void processBindingReference(Definition srcWsdl, WSDLBindingOperation
destBindingOperation, WSDLInterfaceOperation destIntfOperation,
List<ExtensibilityElement> extList,
+ WSDLBindingMessageReference reference, BindingOperation srcBindingOperation,
ReferenceCallback callback)
throws WSDLException
{
for (ExtensibilityElement extElement : extList)
{
QName elementType = extElement.getElementType();
- if (soap11Body.equals(elementType) || SOAP12_BODY.equals(elementType))
+ if (extElement instanceof SOAPBody)
{
processEncodingStyle(extElement, destBindingOperation);
+
+ // <soap:body use="encoded"
namespace="http://MarshallTestW2J.org/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ String namespaceURI = ((SOAPBody)extElement).getNamespaceURI();
+ destBindingOperation.setNamespaceURI(namespaceURI);
}
+ else if (SOAP12_BODY.equals(elementType))
+ {
+ processEncodingStyle(extElement, destBindingOperation);
+ }
else if (extElement instanceof SOAPHeader)
{
SOAPHeader header = (SOAPHeader)extElement;
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java 2007-03-26
09:34:42 UTC (rev 2684)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java 2007-03-26
13:09:51 UTC (rev 2685)
@@ -282,10 +282,10 @@
private WSDLBindingMessageReference getBindingReference(WSDLInterfaceMessageReference
reference)
{
- WSDLInterfaceOperation operation = reference.getWsdlOperation();
- WSDLInterface wsdlInterface = operation.getWsdlInterface();
+ WSDLInterfaceOperation wsdlOperation = reference.getWsdlOperation();
+ WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface();
WSDLBinding binding =
wsdlInterface.getWsdlDefinitions().getBindingByInterfaceName(wsdlInterface.getName());
- WSDLBindingOperation bindingOperation =
binding.getOperationByRef(operation.getName());
+ WSDLBindingOperation bindingOperation =
binding.getOperationByRef(wsdlOperation.getName());
WSDLBindingMessageReference[] bindingReferences;
if (reference instanceof WSDLInterfaceOperationInput)