You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2006/06/07 05:30:30 UTC
svn commit: r412266 - in /webservices/axis2/trunk/java/modules: codegen/
codegen/src/org/apache/axis2/wsdl/codegen/
codegen/src/org/apache/axis2/wsdl/util/ common/src/org/apache/axis2/wsdl/
core/src/org/apache/axis2/description/ integration/ jibx/ secu...
Author: chathura
Date: Tue Jun 6 20:30:30 2006
New Revision: 412266
URL: http://svn.apache.org/viewvc?rev=412266&view=rev
Log:
Woden switch added to the wsdl2java tool. More improved woden2saxiserservicebuilder
Modified:
webservices/axis2/trunk/java/modules/codegen/project.xml
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperationFactory.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
webservices/axis2/trunk/java/modules/integration/project.xml
webservices/axis2/trunk/java/modules/jibx/project.xml
webservices/axis2/trunk/java/modules/security/project.xml
webservices/axis2/trunk/java/modules/xmlbeans/project.xml
Modified: webservices/axis2/trunk/java/modules/codegen/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/project.xml?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/project.xml (original)
+++ webservices/axis2/trunk/java/modules/codegen/project.xml Tue Jun 6 20:30:30 2006
@@ -199,6 +199,15 @@
<module>true</module>
</properties>
</dependency>
+ <dependency>
+ <groupId>incubator-woden</groupId>
+ <artifactId>woden</artifactId>
+ <version>${woden.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+
</dependencies>
<reports/>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Tue Jun 6 20:30:30 2006
@@ -16,8 +16,23 @@
package org.apache.axis2.wsdl.codegen;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
import org.apache.axis2.AxisFault;
import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.description.WSDL20ToAxisServiceBuilder;
import org.apache.axis2.util.XMLUtils;
import org.apache.axis2.wsdl.codegen.emitter.Emitter;
import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension;
@@ -29,22 +44,10 @@
import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
public class CodeGenerationEngine {
private static final Log log = LogFactory.getLog(CodeGenerationEngine.class);
@@ -79,18 +82,37 @@
get(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION);
wsdlUri = option.getOptionValue();
configuration = new CodeGenConfiguration(allOptions);
- Definition wsdl4jDef = readInTheWSDLFile(wsdlUri);
- QName serviceQname = null;
- if (configuration.getServiceName()!=null){
- serviceQname = new QName(wsdl4jDef.getTargetNamespace(), configuration.getServiceName());
+
+
+ CommandLineOption wsdlVersionOption =
+ (CommandLineOption)allOptions.get(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_OPTION);
+ if(wsdlVersionOption != null &&("2.0".equals(wsdlVersionOption.getOptionValue()) ||
+ "2".equals(wsdlVersionOption.getOptionValue()))){
+ //its WSDL 2.0
+ org.apache.woden.WSDLReader wsdlReader = org.apache.woden.WSDLFactory.newInstance().newWSDLReader();
+ //TODO Check whether this does the networ downloading
+ DescriptionElement description = wsdlReader.readWSDL(wsdlUri);
+ QName serviceQname = null;
+ if (configuration.getServiceName()!=null){
+ serviceQname = new QName(description.getTargetNamespace().toString(), configuration.getServiceName());
+ }
+ configuration.setAxisService(new WSDL20ToAxisServiceBuilder(description, serviceQname, configuration.getPortName()).populateService());
+ }else{
+ //It ll be WSDL 1.1
+ Definition wsdl4jDef = readInTheWSDLFile(wsdlUri);
+ QName serviceQname = null;
+ if (configuration.getServiceName()!=null){
+ serviceQname = new QName(wsdl4jDef.getTargetNamespace(), configuration.getServiceName());
+ }
+
+ configuration.setAxisService(new WSDL11ToAxisServiceBuilder(
+ wsdl4jDef,
+ serviceQname,
+ configuration.getPortName()).
+ populateService()
+ );
}
-
- configuration.setAxisService(new WSDL11ToAxisServiceBuilder(
- wsdl4jDef,
- serviceQname,
- configuration.getPortName()).
- populateService()
- );
+
} catch (AxisFault axisFault) {
throw new CodeGenerationException(CodegenMessages.getMessage("engine.wsdlParsingException"), axisFault);
} catch (WSDLException e) {
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java Tue Jun 6 20:30:30 2006
@@ -39,7 +39,9 @@
String NAME_SPACE_TO_PACKAGE_OPTION = "ns2p";
String SERVER_SIDE_INTERFACE_OPTION = "ssi";
String EXTERNAL_MAPPING_OPTION = "em";
+ String WSDL_VERSION_OPTION = "wv";
+
//long option constants
String OUTPUT_LOCATION_OPTION_LONG = "output";
String SERVER_SIDE_CODE_OPTION_LONG = "server-side";
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java Tue Jun 6 20:30:30 2006
@@ -44,6 +44,7 @@
(WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION).equalsIgnoreCase(optionType) ||
+ (WSDL2JavaConstants.WSDL_VERSION_OPTION).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG).equalsIgnoreCase(optionType) ||
(WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION_LONG).equalsIgnoreCase(optionType) ||
Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java Tue Jun 6 20:30:30 2006
@@ -73,6 +73,7 @@
* Field MEP_URI_IN_OUT
*/
public static final String MEP_URI_IN_OUT = "http://www.w3.org/2004/08/wsdl/in-out";
+ public static final String MEP_URI_IN_OUT_03 = "http://www.w3.org/2004/03/wsdl/in-out";
public static final int MEP_CONSTANT_IN_OUT = 12;
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperationFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperationFactory.java?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperationFactory.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperationFactory.java Tue Jun 6 20:30:30 2006
@@ -75,13 +75,14 @@
return abOpdesc;
}
+ //FIXME add in the latest MEP uris
public static AxisOperation getOperationDescription(String mepURI) throws AxisFault {
AxisOperation abOpdesc;
if (MEP_URI_IN_ONLY.equals(mepURI)) {
abOpdesc = new InOnlyAxisOperation();
} else if (MEP_URI_OUT_ONLY.equals(mepURI)) {
abOpdesc = new OutOnlyAxisOperation();
- } else if (MEP_URI_IN_OUT.equals(mepURI)) {
+ } else if (MEP_URI_IN_OUT.equals(mepURI) ||MEP_URI_IN_OUT_03.equals(mepURI)) {
abOpdesc = new InOutAxisOperation();
} else if (MEP_URI_IN_OPTIONAL_OUT.equals(mepURI)) {
abOpdesc = new InOutAxisOperation();
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java Tue Jun 6 20:30:30 2006
@@ -1,39 +1,46 @@
package org.apache.axis2.description;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
import org.apache.axis2.AxisFault;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.woden.WSDLException;
import org.apache.woden.WSDLFactory;
import org.apache.woden.WSDLReader;
+import org.apache.woden.schema.Schema;
+import org.apache.woden.wsdl20.Binding;
+import org.apache.woden.wsdl20.BindingOperation;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.Endpoint;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.InterfaceFaultReference;
+import org.apache.woden.wsdl20.InterfaceMessageReference;
+import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.Service;
+import org.apache.woden.wsdl20.enumeration.Direction;
import org.apache.woden.wsdl20.extensions.ExtensionElement;
import org.apache.woden.wsdl20.extensions.UnknownExtensionElement;
import org.apache.woden.wsdl20.xml.BindingElement;
import org.apache.woden.wsdl20.xml.DescriptionElement;
-import org.apache.woden.wsdl20.xml.EndpointElement;
-import org.apache.woden.wsdl20.xml.ImportElement;
import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
-import org.apache.woden.wsdl20.xml.ServiceElement;
import org.apache.woden.wsdl20.xml.TypesElement;
-import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
-import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement;
-import org.apache.woden.wsdl20.enumeration.Direction;
import org.apache.ws.policy.Policy;
import org.apache.ws.policy.PolicyReference;
import org.apache.ws.policy.util.DOMPolicyReader;
import org.apache.ws.policy.util.PolicyFactory;
import org.w3c.dom.Element;
-import javax.xml.namespace.QName;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -52,18 +59,22 @@
public class WSDL20ToAxisServiceBuilder extends WSDLToAxisServiceBuilder {
- private DescriptionElement descriptionElement;
+ private Description description;
private String wsdlURI;
- //FIXME @author Chathura THis shoud be a URI. Fine whats used by
- //woden.
+ // FIXME @author Chathura THis shoud be a URI. Find whats used by
+ // woden.
private static String RPC = "rpc";
private String interfaceName;
+ private String savedTargetNamespace;
+
+ private Map namespacemap;
+
public WSDL20ToAxisServiceBuilder(InputStream in, QName serviceName,
- String interfaceName) {
+ String interfaceName) {
this.in = in;
this.serviceName = serviceName;
this.interfaceName = interfaceName;
@@ -71,26 +82,28 @@
setPolicyRegistryFromService(axisService);
}
- public WSDL20ToAxisServiceBuilder(DescriptionElement des, QName serviceName,
- String interfaceName) {
- this.descriptionElement = des;
+ public WSDL20ToAxisServiceBuilder(DescriptionElement descriptionElement,
+ QName serviceName, String interfaceName) {
+ savedTargetNamespace = descriptionElement.getTargetNamespace()
+ .toString();
+ namespacemap = descriptionElement.getNamespaces();
+ this.description = descriptionElement.toComponent();
this.serviceName = serviceName;
this.interfaceName = interfaceName;
this.axisService = new AxisService();
setPolicyRegistryFromService(axisService);
}
-
public WSDL20ToAxisServiceBuilder(String wsdlUri, QName serviceName) {
super(null, serviceName);
this.wsdlURI = wsdlUri;
}
- public WSDL20ToAxisServiceBuilder(DescriptionElement descriptionElement,
- QName serviceName) {
- super(null, serviceName);
- this.descriptionElement = descriptionElement;
- }
+ // public WSDL20ToAxisServiceBuilder(DescriptionElement descriptionElement,
+ // QName serviceName) {
+ // super(null, serviceName);
+ // this.descriptionElement = descriptionElement;
+ // }
public WSDL20ToAxisServiceBuilder(String wsdlUri, AxisService service) {
super(null, service);
@@ -98,52 +111,83 @@
}
public AxisService populateService() throws AxisFault {
+
try {
- if (descriptionElement == null) {
- descriptionElement = readInTheWSDLFile(wsdlURI);
+ if (description == null) {
+ DescriptionElement descriptionElement = readInTheWSDLFile(wsdlURI);
+ savedTargetNamespace = descriptionElement.getTargetNamespace()
+ .toString();
+ namespacemap = descriptionElement.getNamespaces();
+ this.description = descriptionElement.toComponent();
+
}
+
// Setting wsdl4jdefintion to axisService , so if some one want
// to play with it he can do that by getting the parameter
Parameter wsdldefintionParamter = new Parameter();
wsdldefintionParamter.setName(WSDLConstants.WSDL_20_DESCRIPTION);
- wsdldefintionParamter.setValue(descriptionElement);
+ wsdldefintionParamter.setValue(description);
axisService.addParameter(wsdldefintionParamter);
- if (descriptionElement == null) {
+ if (description == null) {
return null;
}
// setting target name space
- axisService.setTargetNamespace(descriptionElement
- .getTargetNamespace().getRawPath());
+ axisService.setTargetNamespace(savedTargetNamespace);
// adding ns in the original WSDL
// processPoliciesInDefintion(wsdl4jDefinition); TODO : Differing
// policy support
// scheam generation
- processImports(descriptionElement);
- axisService.setNameSpacesMap(descriptionElement.getNamespaces());
- TypesElement typesElement = descriptionElement.getTypesElement();
- if (null != typesElement) {
- this.copyExtensibleElements(
- typesElement.getExtensionElements(),
- descriptionElement, axisService, TYPES);
+
+ // Create the namespacemap
+
+ HashMap stringBasedNamespaceMap = new HashMap();
+ Iterator iterator = namespacemap.keySet().iterator();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ stringBasedNamespaceMap.put(key, ((URI) namespacemap.get(key))
+ .toString());
+ }
+ axisService.setNameSpacesMap(stringBasedNamespaceMap);
+ // TypeDefinition[] typeDefinitions =
+ // description.getTypeDefinitions();
+ // for(int i=0; i<typeDefinitions.length; i++){
+ // if("org.apache.ws.commons.schema".equals(typeDefinitions[i].getContentModel())){
+ // axisService.addSchema((XmlSchema)typeDefinitions[i].getContent());
+ // }else
+ // if("org.w3c.dom".equals(typeDefinitions[i].getContentModel())){
+ // axisService.addSchema(getXMLSchema((Element)typeDefinitions[i].getContent(),
+ // null));
+ // }
+ //
+ // }
+
+ TypesElement typesElement = description.toElement()
+ .getTypesElement();
+ if (typesElement != null) {
+ Schema[] schemas = typesElement.getSchemas();
+ for (int i = 0; i < schemas.length; i++) {
+ axisService.addSchema(schemas[i].getSchemaDefinition());
+ }
}
- BindingElement binding = findBinding(descriptionElement);
+
+ Binding binding = findBinding(description);
// //////////////////(1.2) /////////////////////////////
// // create new Schema extensions element for wrapping
- Element[] schemaElements =
- generateWrapperSchema(descriptionElement,
- binding);
- if (schemaElements != null && schemaElements.length > 0) {
- for (int i = 0; i < schemaElements.length; i++) {
- Element schemaElement = schemaElements[i];
- if (schemaElement != null) {
- axisService.addSchema(getXMLSchema(schemaElement, null));
- }
- }
- }
-// processBinding(binding, wsdl4jDefinition);
+ // Element[] schemaElements =
+ // generateWrapperSchema(descriptionElement,
+ // binding);
+ // if (schemaElements != null && schemaElements.length > 0) {
+ // for (int i = 0; i < schemaElements.length; i++) {
+ // Element schemaElement = schemaElements[i];
+ // if (schemaElement != null) {
+ // axisService.addSchema(getXMLSchema(schemaElement, null));
+ // }
+ // }
+ // }
+ processBinding(binding, description);
return axisService;
} catch (WSDLException e) {
throw new AxisFault(e);
@@ -152,52 +196,192 @@
}
}
- // private Binding findBinding(DescriptionElement descriptionElement) throws
- // AxisFault {
- // ServiceElement[] serviceElements =
- // descriptionElement.getServiceElements();
- // Service service;
- // Binding binding = null;
- // Port port = null;
- // if (serviceName != null) {
- // service = (Service) services.get(serviceName);
- // if (service == null) {
- // throw new AxisFault("Service not found the WSDL "
- // + serviceName.getLocalPart());
- // }
- // } else {
- // if (services.size() > 0) {
- // service = (Service) services.values().toArray()[0];
- // } else {
- // throw new AxisFault("No service element found in the WSDL");
- // }
- // }
- // copyExtensibleElements(service.getExtensibilityElements(), dif,
- // axisService, SERVICE);
- // if (portName != null) {
- // port = service.getPort(portName);
- // if (port == null) {
- // throw new AxisFault("No port found for the given name :"
- // + portName);
- // }
- // } else {
- // Map ports = service.getPorts();
- // if (ports != null && ports.size() > 0) {
- // port = (Port) ports.values().toArray()[0];
- // }
- // }
- // axisService.setName(service.getQName().getLocalPart());
- // if (port != null) {
- // copyExtensibleElements(port.getExtensibilityElements(), dif,
- // axisService, PORT);
- // binding = port.getBinding();
- // }
- // return binding;
- // }
+ private void processBinding(Binding binding, Description description)
+ throws Exception {
+ if (binding != null) {
+
+ // TODO @author Chathura have to copy policy elements.
+ // copyExtensibleElements(binding.getExtensibilityElements(), dif,
+ // axisService, BINDING);
+
+ Interface serviceInterface = binding.getInterface();
+
+ processInterface(serviceInterface, description);
+
+// BindingOperation[] bindingOperations = binding.getBindingOperations();
+// for(int i=0; i<bindingOperations.length; i++){
+// BindingOperation bindingOperation = bindingOperations[i];
+//
+// bindingOperation.get
+// }
+
+ // List list = binding.getBindingOperations();
+ //
+ // for (int i = 0; i < list.size(); i++) {
+ // BindingOperation wsdl4jBindingOperation = (BindingOperation) list
+ // .get(i);
+ // AxisOperation operation = axisService.getOperation(new QName(
+ // wsdl4jBindingOperation.getName()));
+ // copyExtensibleElements(wsdl4jBindingOperation
+ // .getExtensibilityElements(), dif, operation,
+ // BINDING_OPERATION);
+ //
+ // BindingInput bindingInput = wsdl4jBindingOperation
+ // .getBindingInput();
+ // BindingOutput bindingOutput = wsdl4jBindingOperation
+ // .getBindingOutput();
+ // String MEP = operation.getMessageExchangePattern();
+ // if (bindingInput != null) {
+ // if (WSDLConstants.MEP_URI_IN_ONLY.equals(MEP)
+ // || WSDLConstants.MEP_URI_IN_OPTIONAL_OUT
+ // .equals(MEP)
+ // || WSDLConstants.MEP_URI_OUT_OPTIONAL_IN
+ // .equals(MEP)
+ // || WSDLConstants.MEP_URI_ROBUST_OUT_ONLY
+ // .equals(MEP)
+ // || WSDLConstants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
+ // || WSDLConstants.MEP_URI_IN_OUT.equals(MEP)) {
+ // AxisMessage inMessage = operation
+ // .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ // copyExtensibleElements(bindingInput
+ // .getExtensibilityElements(), dif, inMessage,
+ // BINDING_OPERATION_INPUT);
+ //
+ // }
+ // }
+ // if (bindingOutput != null) {
+ // if (WSDLConstants.MEP_URI_OUT_ONLY.equals(MEP)
+ // || WSDLConstants.MEP_URI_OUT_OPTIONAL_IN
+ // .equals(MEP)
+ // || WSDLConstants.MEP_URI_IN_OPTIONAL_OUT
+ // .equals(MEP)
+ // || WSDLConstants.MEP_URI_ROBUST_OUT_ONLY
+ // .equals(MEP)
+ // || WSDLConstants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
+ // || WSDLConstants.MEP_URI_IN_OUT.equals(MEP)) {
+ // AxisMessage outAxisMessage = operation
+ // .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ // copyExtensibleElements(bindingOutput
+ // .getExtensibilityElements(), dif,
+ // outAxisMessage, BINDING_OPERATION_OUTPUT);
+ //
+ // }
+ // }
+ // }
+
+ }
+ }
+
+ private void processInterface(Interface serviceInterface, Description dif)
+ throws Exception {
+
+ // TODO @author Chathura copy the policy elements
+ // copyExtensionAttributes(wsdl4jPortType.getExtensionAttributes(),
+ // axisService, PORT_TYPE);
+
+ InterfaceOperation[] interfaceOperations = serviceInterface
+ .getInterfaceOperations();
+ InterfaceOperation operation;
+ for (int i = 0; i < interfaceOperations.length; i++) {
+ axisService.addOperation(populateOperations(interfaceOperations[i],
+ description));
+ }
+
+ }
+
+ private AxisOperation populateOperations(InterfaceOperation operation,
+ Description description) throws Exception {
+ QName opName = operation.getName();
+ // Copy Name Attribute
+ AxisOperation axisOperation = axisService.getOperation(opName);
+ if (axisOperation == null) {
+ String MEP = operation.getMessageExchangePattern().toString();
+ axisOperation = AxisOperationFactory.getOperationDescription(MEP);
+ axisOperation.setName(opName);
+
+ // All policy includes must share same registry
+ PolicyInclude pi = axisOperation.getPolicyInclude();
+ if (pi == null) {
+ pi = new PolicyInclude();
+ axisOperation.setPolicyInclude(pi);
+ }
+ pi.setPolicyRegistry(registry);
+ }
+
+ if (style != null) {
+ axisOperation.setStyle(style);
+ }
+ // copyExtensibleElements(wsdl4jOperation.getExtensibilityElements(),
+ // dif,
+ // axisOperation, PORT_TYPE_OPERATION);
+
+ InterfaceMessageReference[] interfaceMessageReferences = operation
+ .getInterfaceMessageReferences();
+ for (int i = 0; i < interfaceMessageReferences.length; i++) {
+ InterfaceMessageReference messageReference = interfaceMessageReferences[i];
+ if (messageReference.getMessageLabel().equals(
+ messageReference.getMessageLabel().IN)) {
+ // Its an input message
+
+ if (isServerSide) {
+ AxisMessage inMessage = axisOperation
+ .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+ inMessage.setElementQName(messageReference
+ .getElementDeclaration().getName());
+ inMessage.setName(messageReference
+ .getElementDeclaration().getName().getLocalPart());
+ // TODO copy policy elements
+ } else {
+ AxisMessage inMessage = axisOperation
+ .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+
+ inMessage.setElementQName(messageReference
+ .getElementDeclaration().getName());
+ inMessage.setName(messageReference
+ .getElementDeclaration().getName().getLocalPart());
+ // TODO copy policy elements
+ }
+ }
+ if (messageReference.getMessageLabel().equals(
+ messageReference.getMessageLabel().OUT)){
+ if(isServerSide){
+ AxisMessage outMessage = axisOperation
+ .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+
+ outMessage.setElementQName(messageReference
+ .getElementDeclaration().getName());
+ outMessage.setName(messageReference
+ .getElementDeclaration().getName().getLocalPart());
+// TODO copy policy elements
+ }else{
+ AxisMessage outMessage = axisOperation
+ .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+ outMessage.setElementQName(messageReference
+ .getElementDeclaration().getName());
+ outMessage.setName(messageReference
+ .getElementDeclaration().getName().getLocalPart());
+// TODO copy policy elements
+ }
+ }
+
+ }
+ InterfaceFaultReference[] faults = operation.getInterfaceFaultReferences();
+ for(int i=0; i<faults.length; i++){
+ AxisMessage faultMessage = new AxisMessage();
+ faultMessage.setElementQName(faults[i].toElement().getRef());
+ faultMessage.setName(faults[i].toElement().getRef().getLocalPart());
+ axisOperation.setFaultMessages(faultMessage);
+ }
+
+
+ return axisOperation;
+ }
private void copyExtensibleElements(ExtensionElement[] extensionElement,
- DescriptionElement descriptionElement, AxisDescription description,
- String originOfExtensibilityElements) {
+ DescriptionElement descriptionElement, AxisDescription description,
+ String originOfExtensibilityElements) {
for (int i = 0; i < extensionElement.length; i++) {
ExtensionElement element = extensionElement[i];
@@ -256,128 +440,68 @@
// TODO : we are ignored that.
}
-// } else if (element instanceof SOAPAddress) {
-// SOAPAddress soapAddress = (SOAPAddress) wsdl4jElement;
-// axisService.setEndpoint(soapAddress.getLocationURI());
-// } else if (wsdl4jElement instanceof Schema) {
-// Schema schema = (Schema) wsdl4jElement;
-// //just add this schema - no need to worry about the imported
-// ones
-// axisService.addSchema(getXMLSchema(schema.getElement(),
-// wsdl4jDefinition.getDocumentBaseURI()));
-// } else if
-// (SOAPConstants.Q_ELEM_SOAP_OPERATION.equals(wsdl4jElement
-// .getElementType())) {
-// SOAPOperation soapOperation = (SOAPOperation) wsdl4jElement;
-// if (description instanceof AxisOperation) {
-// AxisOperation axisOperation = (AxisOperation) description;
-// if (soapOperation.getStyle() != null) {
-// axisOperation.setStyle(soapOperation.getStyle());
-// }
-// axisOperation.setSoapAction(soapOperation
-// .getSoapActionURI());
-// }
-// } else if
-// (SOAPConstants.Q_ELEM_SOAP_HEADER.equals(wsdl4jElement
-// .getElementType())) {
-// SOAPHeader soapHeader = (SOAPHeader) wsdl4jElement;
-// SOAPHeaderMessage headerMessage = new SOAPHeaderMessage();
-// headerMessage.setNamespaceURI(soapHeader.getNamespaceURI());
-// headerMessage.setUse(soapHeader.getUse());
-// Boolean required = soapHeader.getRequired();
-// if (null != required) {
-// headerMessage.setRequired(required.booleanValue());
-// }
-// if (null != wsdl4jDefinition) {
-// //find the relevant schema part from the messages
-// Message msg = wsdl4jDefinition.getMessage(soapHeader
-// .getMessage());
-// Part msgPart = msg.getPart(soapHeader.getPart());
-// headerMessage.setElement(msgPart.getElementName());
-// }
-// headerMessage.setMessage(soapHeader.getMessage());
-//
-// headerMessage.setPart(soapHeader.getPart());
-// if (description instanceof AxisMessage) {
-// ((AxisMessage) description).addSoapHeader(headerMessage);
-// }
-// } else if
-// (SOAPConstants.Q_ELEM_SOAP_BINDING.equals(wsdl4jElement
-// .getElementType())) {
-// SOAPBinding soapBinding = (SOAPBinding) wsdl4jElement;
-// style = soapBinding.getStyle();
-// axisService.setSoapNsUri(soapBinding.getElementType()
-// .getNamespaceURI());
-// }
- }
- }
- }
-
- private void processImports
- (DescriptionElement
- descriptionElement) {
- ImportElement[] wsdlImports = descriptionElement.getImportElements();
-
- for (int i = 0; i < wsdlImports.length; i++) {
- ImportElement importElement = wsdlImports[i];
- DescriptionElement importedDescriptionElement = importElement
- .getDescriptionElement();
- if (importedDescriptionElement != null) {
- processImports(importedDescriptionElement);
-// copy ns
-
- Map namespaces = importedDescriptionElement.getNamespaces();
- Iterator keys = namespaces.keySet().iterator();
- while (keys.hasNext()) {
- Object key = keys.next();
- if (!descriptionElement.getNamespaces().containsValue(
- namespaces.get(key))) {
- descriptionElement.getNamespaces().put(key,
- namespaces.get(key));
- }
- }
-
- descriptionElement.getNamespaces().putAll(namespaces);
-// copy types
- TypesElement t = importedDescriptionElement.getTypesElement();
- ExtensionElement[] typesList = t.getExtensionElements();
-
- TypesElement types = descriptionElement.getTypesElement();
- if (types == null) {
- descriptionElement.setTypesElement(types);
- } else {
- for (int j = 0; j < typesList.length; j++) {
- ExtensionElement extensionElement = typesList[j];
- types.addExtensionElement(extensionElement);
- }
- }
-
- // add interfaces
- InterfaceElement[] interfaceElements = importedDescriptionElement
- .getInterfaceElements();
- for (int j = 0; j < interfaceElements.length; j++) {
- InterfaceElement interfaceElement = interfaceElements[j];
- descriptionElement.addInterfaceElement(interfaceElement);
- }
-
- // add bindings
- BindingElement[] bindingElements = importedDescriptionElement
- .getBindingElements();
- for (int j = 0; j < bindingElements.length; j++) {
- BindingElement bindingElement = bindingElements[j];
- descriptionElement.addBindingElement(bindingElement);
- }
-
+ // } else if (element instanceof SOAPAddress) {
+ // SOAPAddress soapAddress = (SOAPAddress) wsdl4jElement;
+ // axisService.setEndpoint(soapAddress.getLocationURI());
+ // } else if (wsdl4jElement instanceof Schema) {
+ // Schema schema = (Schema) wsdl4jElement;
+ // //just add this schema - no need to worry about the imported
+ // ones
+ // axisService.addSchema(getXMLSchema(schema.getElement(),
+ // wsdl4jDefinition.getDocumentBaseURI()));
+ // } else if
+ // (SOAPConstants.Q_ELEM_SOAP_OPERATION.equals(wsdl4jElement
+ // .getElementType())) {
+ // SOAPOperation soapOperation = (SOAPOperation) wsdl4jElement;
+ // if (description instanceof AxisOperation) {
+ // AxisOperation axisOperation = (AxisOperation) description;
+ // if (soapOperation.getStyle() != null) {
+ // axisOperation.setStyle(soapOperation.getStyle());
+ // }
+ // axisOperation.setSoapAction(soapOperation
+ // .getSoapActionURI());
+ // }
+ // } else if
+ // (SOAPConstants.Q_ELEM_SOAP_HEADER.equals(wsdl4jElement
+ // .getElementType())) {
+ // SOAPHeader soapHeader = (SOAPHeader) wsdl4jElement;
+ // SOAPHeaderMessage headerMessage = new SOAPHeaderMessage();
+ // headerMessage.setNamespaceURI(soapHeader.getNamespaceURI());
+ // headerMessage.setUse(soapHeader.getUse());
+ // Boolean required = soapHeader.getRequired();
+ // if (null != required) {
+ // headerMessage.setRequired(required.booleanValue());
+ // }
+ // if (null != wsdl4jDefinition) {
+ // //find the relevant schema part from the messages
+ // Message msg = wsdl4jDefinition.getMessage(soapHeader
+ // .getMessage());
+ // Part msgPart = msg.getPart(soapHeader.getPart());
+ // headerMessage.setElement(msgPart.getElementName());
+ // }
+ // headerMessage.setMessage(soapHeader.getMessage());
+ //
+ // headerMessage.setPart(soapHeader.getPart());
+ // if (description instanceof AxisMessage) {
+ // ((AxisMessage) description).addSoapHeader(headerMessage);
+ // }
+ // } else if
+ // (SOAPConstants.Q_ELEM_SOAP_BINDING.equals(wsdl4jElement
+ // .getElementType())) {
+ // SOAPBinding soapBinding = (SOAPBinding) wsdl4jElement;
+ // style = soapBinding.getStyle();
+ // axisService.setSoapNsUri(soapBinding.getElementType()
+ // .getNamespaceURI());
+ // }
}
}
}
- private BindingElement findBinding (DescriptionElement discription)
- throws AxisFault {
- ServiceElement[] services = discription.getServiceElements();
- ServiceElement service = null;
- EndpointElement endpoint = null;
- BindingElement binding = null;
+ private Binding findBinding(Description discription) throws AxisFault {
+ Service[] services = discription.getServices();
+ Service service = null;
+ Endpoint endpoint = null;
+ Binding binding = null;
if (services.length == 0) {
throw new AxisFault("No service found in the WSDL");
@@ -400,17 +524,17 @@
// FIXME @author Chathura get the policy stuff to be copied
// copyExtensibleElements(service.getExtensibilityElements(), dif,
// axisService, SERVICE);
- EndpointElement[] endpointElements = service.getEndpointElements();
+ Endpoint[] endpoints = service.getEndpoints();
if (this.interfaceName != null) {
- if (endpointElements.length == 0) {
+ if (endpoints.length == 0) {
throw new AxisFault("No Endpoints/Ports found in the service:"
+ service.getName().getLocalPart());
}
- for (int i = 0; i < endpointElements.length; ++i) {
- if (this.interfaceName.equals(endpointElements[i])) {
- endpoint = endpointElements[i];
+ for (int i = 0; i < endpoints.length; ++i) {
+ if (this.interfaceName.equals(endpoints[i])) {
+ endpoint = endpoints[i];
}
}
if (endpoint == null) {
@@ -419,7 +543,7 @@
}
} else {
// if no particular endpoint is specified use the first one.
- endpoint = endpointElements[0];
+ endpoint = endpoints[0];
}
axisService.setName(service.getName().getLocalPart());
@@ -428,27 +552,28 @@
// copyExtensibleElements(port.getExtensibilityElements(), dif,
// axisService, PORT);
- binding = endpoint.getBindingElement();
+ binding = endpoint.getBinding();
}
return binding;
}
- private Element[] generateWrapperSchema (DescriptionElement wodenDescription, BindingElement binding) {
+ private Element[] generateWrapperSchema(
+ DescriptionElement wodenDescription, BindingElement binding) {
List schemaElementList = new ArrayList();
String targetNamespaceUri = wodenDescription.getTargetNamespace()
.toString();
-// ///////////////////////////////////////////////////////////////////////////////////////////
-// if there are any bindings present then we have to process them. we
-// have to generate a schema
-// per binding (that is the safest option). if not we just resolve to
-// the good old port type
-// list, in which case we'll generate a schema per porttype
-// //////////////////////////////////////////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////////////////////////////////////////////
+ // if there are any bindings present then we have to process them. we
+ // have to generate a schema
+ // per binding (that is the safest option). if not we just resolve to
+ // the good old port type
+ // list, in which case we'll generate a schema per porttype
+ // //////////////////////////////////////////////////////////////////////////////////////////
-//FIXME @author Chathura Once this method is done we could run the
-//basic codgen
+ // FIXME @author Chathura Once this method is done we could run the
+ // basic codgen
schemaElementList.add(createSchemaForInterface(binding
.getInterfaceElement(), targetNamespaceUri,
findWrapForceable(binding)));
@@ -457,80 +582,92 @@
}
private Element createSchemaForInterface(InterfaceElement interfaceElement,
- String targetNamespaceUri, boolean forceWrapping) {
+ String targetNamespaceUri, boolean forceWrapping) {
- //loop through the messages. We'll populate things map with the relevant
+ // loop through the messages. We'll populate things map with the
+ // relevant
// messages
- //from the operations
+ // from the operations
- // this will have name (QName) as the key and InterfaceMessageReferenceElement as the value
+ // this will have name (QName) as the key and
+ // InterfaceMessageReferenceElement as the value
Map messagesMap = new HashMap();
- // this will have operation name (a QName) as the key and InterfaceMessageReferenceElement as the value
+ // this will have operation name (a QName) as the key and
+ // InterfaceMessageReferenceElement as the value
Map inputOperationsMap = new HashMap();
- // this will have operation name (a QName) as the key and InterfaceMessageReferenceElement as the value
+ // this will have operation name (a QName) as the key and
+ // InterfaceMessageReferenceElement as the value
Map outputOperationsMap = new HashMap();
Map faultyOperationsMap = new HashMap();
- //this contains the required namespace imports. the key in this
- //map would be the namaspace URI
+ // this contains the required namespace imports. the key in this
+ // map would be the namaspace URI
Map namespaceImportsMap = new HashMap();
- //generated complextypes. Keep in the list for writing later
- //the key for the complexType map is the message QName
+ // generated complextypes. Keep in the list for writing later
+ // the key for the complexType map is the message QName
Map complexTypeElementsMap = new HashMap();
- //generated Elements. Kep in the list for later writing
+ // generated Elements. Kep in the list for later writing
List elementElementsList = new ArrayList();
- //list namespace prefix map. This map will include uri -> prefix
+ // list namespace prefix map. This map will include uri -> prefix
Map namespacePrefixMap = new HashMap();
- ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // //////////////////////////////////////////////////////////////////////////////////////////////////
// First thing is to populate the message map with the messages to
// process.
- ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // //////////////////////////////////////////////////////////////////////////////////////////////////
- //we really need to do this for a single porttype!
- InterfaceOperationElement[] operationElements = interfaceElement.getInterfaceOperationElements();
+ // we really need to do this for a single porttype!
+ InterfaceOperationElement[] operationElements = interfaceElement
+ .getInterfaceOperationElements();
InterfaceOperationElement opElement;
for (int k = 0; k < operationElements.length; k++) {
opElement = operationElements[k];
- InterfaceMessageReferenceElement[] interfaceMessageReferenceElements =
- opElement.getInterfaceMessageReferenceElements();
+ InterfaceMessageReferenceElement[] interfaceMessageReferenceElements = opElement
+ .getInterfaceMessageReferenceElements();
for (int i = 0; i < interfaceMessageReferenceElements.length; i++) {
InterfaceMessageReferenceElement interfaceMessageReferenceElement = interfaceMessageReferenceElements[i];
- String direction = interfaceMessageReferenceElement.getDirection().toString();
- messagesMap.put(interfaceMessageReferenceElement.getElementName(), interfaceMessageReferenceElement);
+ String direction = interfaceMessageReferenceElement
+ .getDirection().toString();
+ messagesMap.put(interfaceMessageReferenceElement
+ .getElementName(), interfaceMessageReferenceElement);
if (Direction.IN.toString().equalsIgnoreCase(direction)) {
- inputOperationsMap.put(opElement.getName(), interfaceMessageReferenceElement);
+ inputOperationsMap.put(opElement.getName(),
+ interfaceMessageReferenceElement);
} else if (Direction.OUT.toString().equalsIgnoreCase(direction)) {
- outputOperationsMap.put(opElement.getName(), interfaceMessageReferenceElement);
+ outputOperationsMap.put(opElement.getName(),
+ interfaceMessageReferenceElement);
}
}
- InterfaceFaultReferenceElement[] interfaceFaultReferenceElements
- = opElement.getInterfaceFaultReferenceElements();
+ InterfaceFaultReferenceElement[] interfaceFaultReferenceElements = opElement
+ .getInterfaceFaultReferenceElements();
for (int i = 0; i < interfaceFaultReferenceElements.length; i++) {
- InterfaceFaultReferenceElement interfaceFaultReferenceElement
- = interfaceFaultReferenceElements[i];
- String direction = interfaceFaultReferenceElement.getDirection().toString();
- messagesMap.put(interfaceFaultReferenceElement.getRef(), interfaceFaultReferenceElement);
- faultyOperationsMap.put(interfaceFaultReferenceElement.getInterfaceFaultElement(), interfaceFaultReferenceElement);
+ InterfaceFaultReferenceElement interfaceFaultReferenceElement = interfaceFaultReferenceElements[i];
+ String direction = interfaceFaultReferenceElement
+ .getDirection().toString();
+ messagesMap.put(interfaceFaultReferenceElement.getRef(),
+ interfaceFaultReferenceElement);
+ faultyOperationsMap.put(interfaceFaultReferenceElement
+ .getInterfaceFaultElement(),
+ interfaceFaultReferenceElement);
}
}
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //check whether there are messages that are wrappable. If there are no
+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // check whether there are messages that are wrappable. If there are no
// messages that are wrappable we'll
- //just return null and endup this process. However we need to take the
+ // just return null and endup this process. However we need to take the
// force flag into account here
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////////
QName[] keys;
if (forceWrapping) {
- //just take all the messages and wrap them, we've been told to
+ // just take all the messages and wrap them, we've been told to
// force wrapping!
keys = (QName[]) messagesMap.keySet().toArray(
new QName[messagesMap.size()]);
@@ -542,13 +679,13 @@
boolean noMessagesTobeProcessed = true;
// TODO Fix this
-// for (int i = 0; i < allKeys.length; i++) {
-// if (findWrapppable((Message) messagesMap.get(allKeys[i]))) {
-// noMessagesTobeProcessed = false;
-// //add that message to the list
-// wrappableMessageNames.add(allKeys[i]);
-// }
-// }
+ // for (int i = 0; i < allKeys.length; i++) {
+ // if (findWrapppable((Message) messagesMap.get(allKeys[i]))) {
+ // noMessagesTobeProcessed = false;
+ // //add that message to the list
+ // wrappableMessageNames.add(allKeys[i]);
+ // }
+ // }
if (noMessagesTobeProcessed) {
return null;
}
@@ -557,230 +694,231 @@
.toArray(new QName[wrappableMessageNames.size()]);
}
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Now we have the message list to process - Process the whole list of
// messages at once
// since we need to generate one single schema
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// List resolvedMessageQNames = new ArrayList();
-// //find the xsd prefix
-// String xsdPrefix = findSchemaPrefix();
-// Message wsdl4jMessage;
-// //DOM document that will be the ultimate creator
-// Document document = getDOMDocumentBuilder().newDocument();
-// for (int i = 0; i < keys.length; i++) {
-// wsdl4jMessage = (Message) messagesMap.get(keys[i]);
-// //No need to check the wrappable,
-//
-// //This message is wrappabel. However we need to see whether the
-// // message is already
-// //resolved!
-// if (!resolvedMessageQNames.contains(wsdl4jMessage.getQName())) {
-// //This message has not been touched before!. So we can go ahead
-// // now
-// Map parts = wsdl4jMessage.getParts();
-// //add the complex type
-// String name = wsdl4jMessage.getQName().getLocalPart();
-// Element newComplexType = document.createElementNS(
-// XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
-// + XML_SCHEMA_COMPLEX_TYPE_LOCAL_NAME);
-// newComplexType.setAttribute(XSD_NAME, name);
-//
-// Element cmplxContentSequence = document.createElementNS(
-// XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
-// + XML_SCHEMA_SEQUENCE_LOCAL_NAME);
-// Element child;
-// Iterator iterator = parts.keySet().iterator();
-// while (iterator.hasNext()) {
-// Part part = (Part) parts.get(iterator.next());
-// //the part name
-// String elementName = part.getName();
-// boolean isTyped = true;
-// //the type name
-// QName schemaTypeName;
-// if (part.getTypeName() != null) {
-// schemaTypeName = part.getTypeName();
-// } else if (part.getElementName() != null) {
-// schemaTypeName = part.getElementName();
-// isTyped = false;
-// } else {
-// throw new RuntimeException(" Unqualified Message part!");
-// }
-//
-// child = document.createElementNS(XMLSCHEMA_NAMESPACE_URI,
-// xsdPrefix + ":" + XML_SCHEMA_ELEMENT_LOCAL_NAME);
-//
-// String prefix;
-// if (XMLSCHEMA_NAMESPACE_URI.equals(schemaTypeName
-// .getNamespaceURI())) {
-// prefix = xsdPrefix;
-// } else {
-// //this schema is a third party one. So we need to have
-// // an import statement in our generated schema
-// String uri = schemaTypeName.getNamespaceURI();
-// if (!namespaceImportsMap.containsKey(uri)) {
-// //create Element for namespace import
-// Element namespaceImport = document.createElementNS(
-// XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
-// + XML_SCHEMA_IMPORT_LOCAL_NAME);
-// namespaceImport.setAttribute("namespace", uri);
-// //add this to the map
-// namespaceImportsMap.put(uri, namespaceImport);
-// //we also need to associate this uri with a prefix
-// // and include that prefix
-// //in the schema's namspace declarations. So add
-// // theis particular namespace to the
-// //prefix map as well
-// prefix = getTemporaryNamespacePrefix();
-// namespacePrefixMap.put(uri, prefix);
-// } else {
-// //this URI should be already in the namspace prefix
-// // map
-// prefix = (String) namespacePrefixMap.get(uri);
-// }
-//
-// }
-// // If it's from a type the element we need to add a name and
-// // the type
-// //if not it's the element reference
-// if (isTyped) {
-// child.setAttribute(XSD_NAME, elementName);
-// child.setAttribute(XSD_TYPE, prefix + ":"
-// + schemaTypeName.getLocalPart());
-// } else {
-// child.setAttribute(XSD_REF, prefix + ":"
-// + schemaTypeName.getLocalPart());
-// }
-// cmplxContentSequence.appendChild(child);
-// }
-// newComplexType.appendChild(cmplxContentSequence);
-// //add this newly created complextype to the list
-// complexTypeElementsMap.put(wsdl4jMessage.getQName(),
-// newComplexType);
-// resolvedMessageQNames.add(wsdl4jMessage.getQName());
-// }
-//
-// }
-//
-// Element elementDeclaration;
-//
-// //loop through the input op map and generate the elements
-// String[] inputOperationtNames = (String[]) inputOperationsMap.keySet()
-// .toArray(new String[inputOperationsMap.size()]);
-// for (int j = 0; j < inputOperationtNames.length; j++) {
-// String inputOpName = inputOperationtNames[j];
-// elementDeclaration = document.createElementNS(
-// XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
-// + XML_SCHEMA_ELEMENT_LOCAL_NAME);
-// elementDeclaration.setAttribute(XSD_NAME, inputOpName);
-//
-// String typeValue = ((Message) inputOperationsMap.get(inputOpName))
-// .getQName().getLocalPart();
-// elementDeclaration.setAttribute(XSD_TYPE, AXIS2WRAPPED + ":"
-// + typeValue);
-// elementElementsList.add(elementDeclaration);
-// resolvedRpcWrappedElementMap.put(inputOpName, new QName(
-// targetNamespaceUri, inputOpName, AXIS2WRAPPED));
-// }
-//
-// //loop through the output op map and generate the elements
-// String[] outputOperationtNames = (String[]) outputOperationsMap
-// .keySet().toArray(new String[outputOperationsMap.size()]);
-// for (int j = 0; j < outputOperationtNames.length; j++) {
-//
-// String baseoutputOpName = outputOperationtNames[j];
-// String outputOpName = baseoutputOpName + "Response";
-// elementDeclaration = document.createElementNS(
-// XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
-// + XML_SCHEMA_ELEMENT_LOCAL_NAME);
-// elementDeclaration.setAttribute(XSD_NAME, outputOpName);
-// String typeValue = ((Message) outputOperationsMap
-// .get(baseoutputOpName)).getQName().getLocalPart();
-// elementDeclaration.setAttribute(XSD_TYPE, AXIS2WRAPPED + ":"
-// + typeValue);
-// elementElementsList.add(elementDeclaration);
-// resolvedRpcWrappedElementMap.put(outputOpName, new QName(
-// targetNamespaceUri, outputOpName, AXIS2WRAPPED));
-//
-// }
-//
-// //loop through the faultoutput op map and generate the elements
-// String[] faultyOperationtNames = (String[]) faultyOperationsMap
-// .keySet().toArray(new String[faultyOperationsMap.size()]);
-// for (int j = 0; j < faultyOperationtNames.length; j++) {
-//
-// String baseFaultOpName = faultyOperationtNames[j];
-// elementDeclaration = document.createElementNS(
-// XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
-// + XML_SCHEMA_ELEMENT_LOCAL_NAME);
-// elementDeclaration.setAttribute(XSD_NAME, baseFaultOpName);
-// String typeValue = ((Message) faultyOperationsMap
-// .get(baseFaultOpName)).getQName().getLocalPart();
-// elementDeclaration.setAttribute(XSD_TYPE, AXIS2WRAPPED + ":"
-// + typeValue);
-// elementElementsList.add(elementDeclaration);
-// resolvedRpcWrappedElementMap.put(baseFaultOpName, new QName(
-// targetNamespaceUri, baseFaultOpName, AXIS2WRAPPED));
-//
-// }
-//
-// //////////////////////////////////////////////////////////////////////////////////////////////
-// // Now we are done with processing the messages and generating the right
-// // schema object model
-// // time to write out the schema
-// //////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Element schemaElement = document.createElementNS(
-// XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
-// + XML_SCHEMA_LOCAL_NAME);
-//
-// //loop through the namespace declarations first
-// String[] nameSpaceDeclarationArray = (String[]) namespacePrefixMap
-// .keySet().toArray(new String[namespacePrefixMap.size()]);
-// for (int i = 0; i < nameSpaceDeclarationArray.length; i++) {
-// String s = nameSpaceDeclarationArray[i];
-// schemaElement.setAttributeNS("http://www.w3.org/2000/xmlns/",
-// "xmlns:" + namespacePrefixMap.get(s).toString(), s);
-//
-// }
-//
-// //add the targetNamespace
-//
-// schemaElement.setAttributeNS("http://www.w3.org/2000/xmlns/",
-// XMLNS_AXIS2WRAPPED, targetNamespaceUri);
-// schemaElement.setAttribute(XSD_TARGETNAMESPACE, targetNamespaceUri);
-// schemaElement.setAttribute(XSD_ELEMENT_FORM_DEFAULT, XSD_UNQUALIFIED);
-//
-// Element[] namespaceImports = (Element[]) namespaceImportsMap.values()
-// .toArray(new Element[namespaceImportsMap.size()]);
-// for (int i = 0; i < namespaceImports.length; i++) {
-// schemaElement.appendChild(namespaceImports[i]);
-//
-// }
-//
-// Element[] complexTypeElements = (Element[]) complexTypeElementsMap
-// .values().toArray(new Element[complexTypeElementsMap.size()]);
-// for (int i = 0; i < complexTypeElements.length; i++) {
-// schemaElement.appendChild(complexTypeElements[i]);
-//
-// }
-//
-// Element[] elementDeclarations = (Element[]) elementElementsList
-// .toArray(new Element[elementElementsList.size()]);
-// for (int i = 0; i < elementDeclarations.length; i++) {
-// schemaElement.appendChild(elementDeclarations[i]);
-//
-// }
+ // List resolvedMessageQNames = new ArrayList();
+ // //find the xsd prefix
+ // String xsdPrefix = findSchemaPrefix();
+ // Message wsdl4jMessage;
+ // //DOM document that will be the ultimate creator
+ // Document document = getDOMDocumentBuilder().newDocument();
+ // for (int i = 0; i < keys.length; i++) {
+ // wsdl4jMessage = (Message) messagesMap.get(keys[i]);
+ // //No need to check the wrappable,
+ //
+ // //This message is wrappabel. However we need to see whether the
+ // // message is already
+ // //resolved!
+ // if (!resolvedMessageQNames.contains(wsdl4jMessage.getQName())) {
+ // //This message has not been touched before!. So we can go ahead
+ // // now
+ // Map parts = wsdl4jMessage.getParts();
+ // //add the complex type
+ // String name = wsdl4jMessage.getQName().getLocalPart();
+ // Element newComplexType = document.createElementNS(
+ // XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
+ // + XML_SCHEMA_COMPLEX_TYPE_LOCAL_NAME);
+ // newComplexType.setAttribute(XSD_NAME, name);
+ //
+ // Element cmplxContentSequence = document.createElementNS(
+ // XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
+ // + XML_SCHEMA_SEQUENCE_LOCAL_NAME);
+ // Element child;
+ // Iterator iterator = parts.keySet().iterator();
+ // while (iterator.hasNext()) {
+ // Part part = (Part) parts.get(iterator.next());
+ // //the part name
+ // String elementName = part.getName();
+ // boolean isTyped = true;
+ // //the type name
+ // QName schemaTypeName;
+ // if (part.getTypeName() != null) {
+ // schemaTypeName = part.getTypeName();
+ // } else if (part.getElementName() != null) {
+ // schemaTypeName = part.getElementName();
+ // isTyped = false;
+ // } else {
+ // throw new RuntimeException(" Unqualified Message part!");
+ // }
+ //
+ // child = document.createElementNS(XMLSCHEMA_NAMESPACE_URI,
+ // xsdPrefix + ":" + XML_SCHEMA_ELEMENT_LOCAL_NAME);
+ //
+ // String prefix;
+ // if (XMLSCHEMA_NAMESPACE_URI.equals(schemaTypeName
+ // .getNamespaceURI())) {
+ // prefix = xsdPrefix;
+ // } else {
+ // //this schema is a third party one. So we need to have
+ // // an import statement in our generated schema
+ // String uri = schemaTypeName.getNamespaceURI();
+ // if (!namespaceImportsMap.containsKey(uri)) {
+ // //create Element for namespace import
+ // Element namespaceImport = document.createElementNS(
+ // XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
+ // + XML_SCHEMA_IMPORT_LOCAL_NAME);
+ // namespaceImport.setAttribute("namespace", uri);
+ // //add this to the map
+ // namespaceImportsMap.put(uri, namespaceImport);
+ // //we also need to associate this uri with a prefix
+ // // and include that prefix
+ // //in the schema's namspace declarations. So add
+ // // theis particular namespace to the
+ // //prefix map as well
+ // prefix = getTemporaryNamespacePrefix();
+ // namespacePrefixMap.put(uri, prefix);
+ // } else {
+ // //this URI should be already in the namspace prefix
+ // // map
+ // prefix = (String) namespacePrefixMap.get(uri);
+ // }
+ //
+ // }
+ // // If it's from a type the element we need to add a name and
+ // // the type
+ // //if not it's the element reference
+ // if (isTyped) {
+ // child.setAttribute(XSD_NAME, elementName);
+ // child.setAttribute(XSD_TYPE, prefix + ":"
+ // + schemaTypeName.getLocalPart());
+ // } else {
+ // child.setAttribute(XSD_REF, prefix + ":"
+ // + schemaTypeName.getLocalPart());
+ // }
+ // cmplxContentSequence.appendChild(child);
+ // }
+ // newComplexType.appendChild(cmplxContentSequence);
+ // //add this newly created complextype to the list
+ // complexTypeElementsMap.put(wsdl4jMessage.getQName(),
+ // newComplexType);
+ // resolvedMessageQNames.add(wsdl4jMessage.getQName());
+ // }
+ //
+ // }
+ //
+ // Element elementDeclaration;
+ //
+ // //loop through the input op map and generate the elements
+ // String[] inputOperationtNames = (String[])
+ // inputOperationsMap.keySet()
+ // .toArray(new String[inputOperationsMap.size()]);
+ // for (int j = 0; j < inputOperationtNames.length; j++) {
+ // String inputOpName = inputOperationtNames[j];
+ // elementDeclaration = document.createElementNS(
+ // XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
+ // + XML_SCHEMA_ELEMENT_LOCAL_NAME);
+ // elementDeclaration.setAttribute(XSD_NAME, inputOpName);
+ //
+ // String typeValue = ((Message) inputOperationsMap.get(inputOpName))
+ // .getQName().getLocalPart();
+ // elementDeclaration.setAttribute(XSD_TYPE, AXIS2WRAPPED + ":"
+ // + typeValue);
+ // elementElementsList.add(elementDeclaration);
+ // resolvedRpcWrappedElementMap.put(inputOpName, new QName(
+ // targetNamespaceUri, inputOpName, AXIS2WRAPPED));
+ // }
+ //
+ // //loop through the output op map and generate the elements
+ // String[] outputOperationtNames = (String[]) outputOperationsMap
+ // .keySet().toArray(new String[outputOperationsMap.size()]);
+ // for (int j = 0; j < outputOperationtNames.length; j++) {
+ //
+ // String baseoutputOpName = outputOperationtNames[j];
+ // String outputOpName = baseoutputOpName + "Response";
+ // elementDeclaration = document.createElementNS(
+ // XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
+ // + XML_SCHEMA_ELEMENT_LOCAL_NAME);
+ // elementDeclaration.setAttribute(XSD_NAME, outputOpName);
+ // String typeValue = ((Message) outputOperationsMap
+ // .get(baseoutputOpName)).getQName().getLocalPart();
+ // elementDeclaration.setAttribute(XSD_TYPE, AXIS2WRAPPED + ":"
+ // + typeValue);
+ // elementElementsList.add(elementDeclaration);
+ // resolvedRpcWrappedElementMap.put(outputOpName, new QName(
+ // targetNamespaceUri, outputOpName, AXIS2WRAPPED));
+ //
+ // }
+ //
+ // //loop through the faultoutput op map and generate the elements
+ // String[] faultyOperationtNames = (String[]) faultyOperationsMap
+ // .keySet().toArray(new String[faultyOperationsMap.size()]);
+ // for (int j = 0; j < faultyOperationtNames.length; j++) {
+ //
+ // String baseFaultOpName = faultyOperationtNames[j];
+ // elementDeclaration = document.createElementNS(
+ // XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
+ // + XML_SCHEMA_ELEMENT_LOCAL_NAME);
+ // elementDeclaration.setAttribute(XSD_NAME, baseFaultOpName);
+ // String typeValue = ((Message) faultyOperationsMap
+ // .get(baseFaultOpName)).getQName().getLocalPart();
+ // elementDeclaration.setAttribute(XSD_TYPE, AXIS2WRAPPED + ":"
+ // + typeValue);
+ // elementElementsList.add(elementDeclaration);
+ // resolvedRpcWrappedElementMap.put(baseFaultOpName, new QName(
+ // targetNamespaceUri, baseFaultOpName, AXIS2WRAPPED));
+ //
+ // }
+ //
+ // //////////////////////////////////////////////////////////////////////////////////////////////
+ // // Now we are done with processing the messages and generating the
+ // right
+ // // schema object model
+ // // time to write out the schema
+ // //////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Element schemaElement = document.createElementNS(
+ // XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
+ // + XML_SCHEMA_LOCAL_NAME);
+ //
+ // //loop through the namespace declarations first
+ // String[] nameSpaceDeclarationArray = (String[]) namespacePrefixMap
+ // .keySet().toArray(new String[namespacePrefixMap.size()]);
+ // for (int i = 0; i < nameSpaceDeclarationArray.length; i++) {
+ // String s = nameSpaceDeclarationArray[i];
+ // schemaElement.setAttributeNS("http://www.w3.org/2000/xmlns/",
+ // "xmlns:" + namespacePrefixMap.get(s).toString(), s);
+ //
+ // }
+ //
+ // //add the targetNamespace
+ //
+ // schemaElement.setAttributeNS("http://www.w3.org/2000/xmlns/",
+ // XMLNS_AXIS2WRAPPED, targetNamespaceUri);
+ // schemaElement.setAttribute(XSD_TARGETNAMESPACE, targetNamespaceUri);
+ // schemaElement.setAttribute(XSD_ELEMENT_FORM_DEFAULT,
+ // XSD_UNQUALIFIED);
+ //
+ // Element[] namespaceImports = (Element[]) namespaceImportsMap.values()
+ // .toArray(new Element[namespaceImportsMap.size()]);
+ // for (int i = 0; i < namespaceImports.length; i++) {
+ // schemaElement.appendChild(namespaceImports[i]);
+ //
+ // }
+ //
+ // Element[] complexTypeElements = (Element[]) complexTypeElementsMap
+ // .values().toArray(new Element[complexTypeElementsMap.size()]);
+ // for (int i = 0; i < complexTypeElements.length; i++) {
+ // schemaElement.appendChild(complexTypeElements[i]);
+ //
+ // }
+ //
+ // Element[] elementDeclarations = (Element[]) elementElementsList
+ // .toArray(new Element[elementElementsList.size()]);
+ // for (int i = 0; i < elementDeclarations.length; i++) {
+ // schemaElement.appendChild(elementDeclarations[i]);
+ //
+ // }
-// return schemaElement;
+ // return schemaElement;
return null;
}
- private boolean findWrapForceable
- (BindingElement
- binding) {
+ private boolean findWrapForceable(BindingElement binding) {
boolean retVal = false;
if (RPC.equalsIgnoreCase(binding.getInterfaceElement()
.getStyleDefault().toString())) {
@@ -802,15 +940,13 @@
return false;
}
- private DescriptionElement readInTheWSDLFile
- (String
- wsdlURI)
+ private DescriptionElement readInTheWSDLFile(String wsdlURI)
throws WSDLException {
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
-// TODO : I can not find a constant for this feature in WSDLReader
-// reader.setFeature("javax.wsdl.importDocuments", false);
+ // TODO : I can not find a constant for this feature in WSDLReader
+ // reader.setFeature("javax.wsdl.importDocuments", false);
reader.setFeature(WSDLReader.FEATURE_VERBOSE, false);
return reader.readWSDL(wsdlURI);
Modified: webservices/axis2/trunk/java/modules/integration/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/project.xml?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/project.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/project.xml Tue Jun 6 20:30:30 2006
@@ -309,6 +309,15 @@
<module>true</module>
</properties>
</dependency>
+ <dependency>
+ <groupId>incubator-woden</groupId>
+ <artifactId>woden</artifactId>
+ <version>${woden.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+
</dependencies>
<!-- build information for the project -->
Modified: webservices/axis2/trunk/java/modules/jibx/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jibx/project.xml?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jibx/project.xml (original)
+++ webservices/axis2/trunk/java/modules/jibx/project.xml Tue Jun 6 20:30:30 2006
@@ -161,6 +161,15 @@
<module>true</module>
</properties>
</dependency>
+ <dependency>
+ <groupId>incubator-woden</groupId>
+ <artifactId>woden</artifactId>
+ <version>${woden.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+
</dependencies>
<build/>
<reports/>
Modified: webservices/axis2/trunk/java/modules/security/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/project.xml?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/project.xml (original)
+++ webservices/axis2/trunk/java/modules/security/project.xml Tue Jun 6 20:30:30 2006
@@ -222,6 +222,14 @@
<module>true</module>
</properties>
</dependency>
+ <dependency>
+ <groupId>incubator-woden</groupId>
+ <artifactId>woden</artifactId>
+ <version>${woden.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
</dependencies>
<!-- build information for the project -->
<build>
Modified: webservices/axis2/trunk/java/modules/xmlbeans/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/xmlbeans/project.xml?rev=412266&r1=412265&r2=412266&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/project.xml (original)
+++ webservices/axis2/trunk/java/modules/xmlbeans/project.xml Tue Jun 6 20:30:30 2006
@@ -149,6 +149,15 @@
<module>true</module>
</properties>
</dependency>
+ <dependency>
+ <groupId>incubator-woden</groupId>
+ <artifactId>woden</artifactId>
+ <version>${woden.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+
</dependencies>
<reports/>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org