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 am...@apache.org on 2007/03/12 07:07:26 UTC
svn commit: r517108 - in /webservices/axis2/trunk/java/modules:
adb-codegen/src/org/apache/axis2/schema/
codegen/src/org/apache/axis2/wsdl/codegen/
codegen/src/org/apache/axis2/wsdl/codegen/emitter/
codegen/src/org/apache/axis2/wsdl/codegen/extension/ ...
Author: amilas
Date: Sun Mar 11 23:07:24 2007
New Revision: 517108
URL: http://svn.apache.org/viewvc?view=rev&rev=517108
Log:
Added multi service support for codegen. this feature only works if the user does not
specify a pirticular service and port.
for jibx, since I could find a simple way to add the feature, set it to get the axis service from the
configuration.
Modified:
webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
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/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JAXBRIExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JaxMeExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl
webservices/axis2/trunk/java/modules/integration/maven.xml
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java
webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java Sun Mar 11 23:07:24 2007
@@ -15,10 +15,7 @@
import javax.xml.namespace.QName;
import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -42,7 +39,12 @@
public static void invoke(CodeGenConfiguration configuration) throws Exception {
- List schemaList = configuration.getAxisService().getSchema();
+ List schemaList = new ArrayList();
+ // add all the schemas to the list
+ List services = configuration.getAxisServices();
+ for (Iterator iter = services.iterator();iter.hasNext();){
+ schemaList.addAll(((AxisService)iter.next()).getSchema());
+ }
//hashmap that keeps the targetnamespace and the xmlSchema object
//this is a convenience to locate the relevant schema quickly
@@ -127,50 +129,57 @@
//process the unwrapped parameters
if (!configuration.isParametersWrapped()) {
//figure out the unwrapped operations
- AxisService axisService = configuration.getAxisService();
-
- for (Iterator operations = axisService.getOperations();
- operations.hasNext();) {
- AxisOperation op = (AxisOperation) operations.next();
- if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) {
- walkSchema(op.getMessage(
- WSDLConstants.MESSAGE_LABEL_IN_VALUE),
- mapper,
- schemaMap,
- op.getName().getLocalPart(),
- WSDLConstants.INPUT_PART_QNAME_SUFFIX);
+ List axisServices = configuration.getAxisServices();
+ AxisService axisService;
+ for (Iterator servicesIter = axisServices.iterator(); servicesIter.hasNext();) {
+ axisService = (AxisService) servicesIter.next();
+ for (Iterator operations = axisService.getOperations();
+ operations.hasNext();) {
+ AxisOperation op = (AxisOperation) operations.next();
+ if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) {
+ walkSchema(op.getMessage(
+ WSDLConstants.MESSAGE_LABEL_IN_VALUE),
+ mapper,
+ schemaMap,
+ op.getName().getLocalPart(),
+ WSDLConstants.INPUT_PART_QNAME_SUFFIX);
+ }
+
+ if (WSDLUtil.isOutputPresentForMEP(op.getMessageExchangePattern())) {
+ walkSchema(op.getMessage(
+ WSDLConstants.MESSAGE_LABEL_OUT_VALUE),
+ mapper,
+ schemaMap,
+ op.getName().getLocalPart(),
+ WSDLConstants.OUTPUT_PART_QNAME_SUFFIX);
+ }
}
-
- if (WSDLUtil.isOutputPresentForMEP(op.getMessageExchangePattern())) {
- walkSchema(op.getMessage(
- WSDLConstants.MESSAGE_LABEL_OUT_VALUE),
- mapper,
- schemaMap,
- op.getName().getLocalPart(),
- WSDLConstants.OUTPUT_PART_QNAME_SUFFIX);
- }
-
-
}
+
}
//put the complext types for the top level elements having them
// this is needed in unwrapping and to provide backwordCompatibility
- if(!configuration.isParametersWrapped() || configuration.isBackwordCompatibilityMode()){
- AxisService axisService = configuration.getAxisService();
- AxisOperation axisOperation;
- AxisMessage axisMessage;
- for (Iterator operators = axisService.getOperations(); operators.hasNext();){
- axisOperation = (AxisOperation) operators.next();
- if (WSDLUtil.isInputPresentForMEP(axisOperation.getMessageExchangePattern())){
- axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- setComplexTypeName(axisMessage);
- }
- if (WSDLUtil.isOutputPresentForMEP(axisOperation.getMessageExchangePattern())){
- axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- setComplexTypeName(axisMessage);
- }
- }
+ if (!configuration.isParametersWrapped() || configuration.isBackwordCompatibilityMode()) {
+ List axisServices = configuration.getAxisServices();
+ AxisService axisService;
+ for (Iterator servicesIter = axisServices.iterator(); servicesIter.hasNext();) {
+ axisService = (AxisService) servicesIter.next();
+ AxisOperation axisOperation;
+ AxisMessage axisMessage;
+ for (Iterator operators = axisService.getOperations(); operators.hasNext();) {
+ axisOperation = (AxisOperation) operators.next();
+ if (WSDLUtil.isInputPresentForMEP(axisOperation.getMessageExchangePattern())) {
+ axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ setComplexTypeName(axisMessage);
+ }
+ if (WSDLUtil.isOutputPresentForMEP(axisOperation.getMessageExchangePattern())) {
+ axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ setComplexTypeName(axisMessage);
+ }
+ }
+ }
+
}
//set the type mapper to the config
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Sun Mar 11 23:07:24 2007
@@ -170,8 +170,7 @@
schema = (XmlSchema) schemalist.get(i);
availableSchemaMap.put(
schema.getTargetNamespace(),
- schema
- );
+ schema);
}
//set a mapper package if not avaialable
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java Sun Mar 11 23:07:24 2007
@@ -23,13 +23,16 @@
import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
public class CodeGenConfiguration implements CommandLineOptionConstants {
- /** Axis Service reference*/
+ /** Axis Services reference*/
+ private List axisServices;
+
+ /** Axis service to use */
private AxisService axisService;
+
/** Base URI */
private String baseURI;
/** path to the repository - used for evaluating policy */
@@ -73,7 +76,7 @@
this.uri2PackageNameMap.putAll(uri2PackageNameMap);
}
}
-
+
/** Full path and name of XMLBeans xsdconfig file to use */
private String xsdConfigFile = null;
@@ -378,18 +381,9 @@
*
* @param optionMap
*/
- public CodeGenConfiguration(AxisService service, Map optionMap) {
- this.axisService = service;
- CodegenConfigLoader.loadConfig(this,optionMap);
- }
-
- /**
- * Constructor for the configuration. It populates the values using the options map.
- *
- * @param optionMap
- */
public CodeGenConfiguration(Map optionMap) {
CodegenConfigLoader.loadConfig(this,optionMap);
+ this.axisServices = new ArrayList();
}
@@ -463,27 +457,46 @@
return repositoryPath;
}
+ public List getAxisServices() {
+ return axisServices;
+ }
+
+ public void setAxisServices(List axisServices) {
+ this.axisServices = axisServices;
+ }
+
+ public void addAxisService(AxisService axisService){
+ this.axisServices.add(axisService);
+ }
+
public AxisService getAxisService() {
- return axisService;
+ // return the first element of the axis services
+ if (axisService != null){
+ return axisService;
+ } else if ((axisServices != null) && (axisServices.size() > 0)){
+ return (AxisService) axisServices.get(0);
+ } else {
+ return null;
+ }
}
public void setAxisService(AxisService axisService) {
this.axisService = axisService;
}
-
- /**
- * This flag determines whether the generated classes are expected to be
- * backword compatible with Axis 1.x
- */
- private boolean backwordCompatibilityMode = false;
-
- public boolean isBackwordCompatibilityMode() {
- return backwordCompatibilityMode;
- }
-
- public void setBackwordCompatibilityMode(boolean backwordCompatibilityMode) {
- this.backwordCompatibilityMode = backwordCompatibilityMode;
- }
+
+ /**
+ * This flag determines whether the generated classes are expected to be
+ * backword compatible with Axis 1.x
+ */
+ private boolean backwordCompatibilityMode = false;
+
+ public boolean isBackwordCompatibilityMode() {
+ return backwordCompatibilityMode;
+ }
+
+ public void setBackwordCompatibilityMode(boolean backwordCompatibilityMode) {
+ this.backwordCompatibilityMode = backwordCompatibilityMode;
+ }
/**
* Should we suppress namespace prefixes
@@ -496,5 +509,23 @@
public void setSuppressPrefixesMode(boolean suppressPrefixesMode) {
this.suppressPrefixesMode = suppressPrefixesMode;
+ }
+
+ public String getTargetNamespace(){
+ String targetNamespace = null;
+ if ((this.axisServices != null) && (this.axisServices.size() > 0)){
+ targetNamespace = ((AxisService)this.axisServices.get(0)).getTargetNamespace();
+ }
+ return targetNamespace;
+ }
+
+ public List getSchemaListForAllServices(){
+ List schemas = new ArrayList();
+ AxisService axisService;
+ for (Iterator iter = this.axisServices.iterator();iter.hasNext();){
+ axisService = (AxisService) iter.next();
+ schemas.addAll(axisService.getSchema());
+ }
+ return schemas;
}
}
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?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- 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 Sun Mar 11 23:07:24 2007
@@ -20,6 +20,7 @@
import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
import org.apache.axis2.description.WSDL20ToAxisServiceBuilder;
import org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder;
+import org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder;
import org.apache.axis2.util.CommandLineOption;
import org.apache.axis2.util.CommandLineOptionConstants;
import org.apache.axis2.util.CommandLineOptionParser;
@@ -36,6 +37,7 @@
import javax.wsdl.Definition;
import javax.wsdl.WSDLException;
+import javax.wsdl.Service;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
@@ -46,6 +48,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Iterator;
public class CodeGenerationEngine {
@@ -84,7 +87,7 @@
get(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION);
wsdlUri = option.getOptionValue();
configuration = new CodeGenConfiguration(allOptions);
-
+
if(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2.
equals(configuration.getWSDLVersion())){
@@ -92,24 +95,37 @@
configuration.getServiceName(),
configuration.getPortName());
builder.setCodegen(true);
- configuration.setAxisService(builder.populateService());
+ configuration.addAxisService(builder.populateService());
}else{
//It'll be WSDL 1.1
Definition wsdl4jDef = readInTheWSDLFile(wsdlUri);
+ // we generate the code for one service and one port if the
+ // user has specified them.
+ // otherwise generate the code for every service.
+ // TODO: find out a permanant solution for this.
+
QName serviceQname = null;
- if (configuration.getServiceName()!=null){
+
+ if (configuration.getServiceName() != null) {
serviceQname = new QName(wsdl4jDef.getTargetNamespace(), configuration.getServiceName());
}
- WSDL11ToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(
- wsdl4jDef,
- serviceQname,
- configuration.getPortName());
- builder.setCodegen(true);
- configuration.setAxisService(builder.populateService());
+ WSDL11ToAxisServiceBuilder builder = null;
+ if (serviceQname != null) {
+ builder = new WSDL11ToAxisServiceBuilder(
+ wsdl4jDef,
+ serviceQname,
+ configuration.getPortName());
+ builder.setCodegen(true);
+ configuration.addAxisService(builder.populateService());
+ } else {
+ builder = new WSDL11ToAllAxisServicesBuilder(wsdl4jDef);
+ builder.setCodegen(true);
+ configuration.setAxisServices(((WSDL11ToAllAxisServicesBuilder) builder).populateAllServices());
+ }
}
-
+
} catch (AxisFault axisFault) {
throw new CodeGenerationException(CodegenMessages.getMessage("engine.wsdlParsingException"), axisFault);
} catch (WSDLException e) {
@@ -136,7 +152,7 @@
addPreExtension((CodeGenExtension) getObjectFromClassName(extensions[i].trim()));
}
}
-
+
//load post extensions
String[] postExtensions = ConfigPropertyFileLoader.getPostExtensionClassNames();
if (postExtensions!=null){
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Sun Mar 11 23:07:24 2007
@@ -185,6 +185,8 @@
protected AxisService axisService;
+ protected List axisServices;
+
//a map to keep the fault classNames
protected Map fullyQualifiedFaultClassNameMap = new HashMap();
protected Map faultClassNameMap = new HashMap();
@@ -209,8 +211,7 @@
*/
public void setCodeGenConfiguration(CodeGenConfiguration configuration) {
this.codeGenConfiguration = configuration;
- this.axisService = codeGenConfiguration.getAxisService();
- this.axisBinding = axisService.getEndpoint(axisService.getEndpointName()).getBinding();
+ this.axisServices = codeGenConfiguration.getAxisServices();
resolver = new XSLTIncludeResolver(codeGenConfiguration);
}
@@ -378,51 +379,58 @@
*/
public void emitStub() throws CodeGenerationException {
try {
- // see the comment at updateMapperClassnames for details and reasons for
- // calling this method
- if (mapper.isObjectMappingPresent()) {
- updateMapperForStub();
- } else {
- copyToFaultMap();
- }
- //generate and populate the fault names before hand. We need that for
- //the smooth opration of the thing
- //first reset the fault names and recreate it
- resetFaultNames();
- generateAndPopulateFaultNames();
- updateFaultPackageForStub();
-
- // write the inteface
- // feed the binding information also
- // note that we do not create this interface if the user switched on the wrap classes mode
- if (!codeGenConfiguration.isPackClasses()) {
- writeInterface(false);
- }
-
- // write the call back handlers
- writeCallBackHandlers();
-
- // write the Exceptions
- writeExceptions();
-
- // write interface implementations
- writeInterfaceImplementation();
-
- // write the test classes
- writeTestClasses();
-
- // write an ant build file
- // Note that ant build is generated only once
- // and that has to happen here only if the
- // client side code is required
- if (!codeGenConfiguration.isGenerateAll()) {
- //our logic for the build xml is that it will
- //only be written when not flattened
- if (!codeGenConfiguration.isFlattenFiles()) {
- writeAntBuild();
+ for (Iterator axisServicesIter = this.axisServices.iterator(); axisServicesIter.hasNext();) {
+ this.axisService = (AxisService) axisServicesIter.next();
+ this.axisBinding = axisService.getEndpoint(axisService.getEndpointName()).getBinding();
+ // see the comment at updateMapperClassnames for details and reasons for
+ // calling this method
+ if (mapper.isObjectMappingPresent()) {
+ updateMapperForStub();
+ } else {
+ copyToFaultMap();
+ }
+
+ //generate and populate the fault names before hand. We need that for
+ //the smooth opration of the thing
+ //first reset the fault names and recreate it
+ resetFaultNames();
+ generateAndPopulateFaultNames();
+ updateFaultPackageForStub();
+
+ // write the inteface
+ // feed the binding information also
+ // note that we do not create this interface if the user switched on the wrap classes mode
+ if (!codeGenConfiguration.isPackClasses()) {
+ writeInterface(false);
+ }
+
+ // write the call back handlers
+ writeCallBackHandlers();
+
+ // write the Exceptions
+ writeExceptions();
+
+ // write interface implementations
+ writeInterfaceImplementation();
+
+ // write the test classes
+ writeTestClasses();
+
+ // write an ant build file
+ // Note that ant build is generated only once
+ // and that has to happen here only if the
+ // client side code is required
+ if (!codeGenConfiguration.isGenerateAll()) {
+ //our logic for the build xml is that it will
+ //only be written when not flattened
+ if (!codeGenConfiguration.isFlattenFiles()) {
+ writeAntBuild();
+ }
}
+
}
+
} catch (CodeGenerationException ce) {
throw ce;
} catch (Exception e) {
@@ -1073,39 +1081,51 @@
public void emitSkeleton() throws CodeGenerationException {
try {
- // see the comment at updateMapperClassnames for details and reasons for
- // calling this method
- if (mapper.isObjectMappingPresent()) {
- updateMapperForMessageReceiver();
- } else {
- copyToFaultMap();
- }
- //handle faults
- generateAndPopulateFaultNames();
+ // we are going to generate following files seperately per service
+ for (Iterator axisServicesIter = this.axisServices.iterator(); axisServicesIter.hasNext();) {
+ this.axisService = (AxisService) axisServicesIter.next();
+ this.axisBinding = axisService.getEndpoint(axisService.getEndpointName()).getBinding();
+
+ // see the comment at updateMapperClassnames for details and reasons for
+ // calling this method
+ if (mapper.isObjectMappingPresent()) {
+ updateMapperForMessageReceiver();
+ } else {
+ copyToFaultMap();
+ }
- //
- if (codeGenConfiguration.isServerSideInterface()) {
- //write skeletonInterface
- writeSkeletonInterface();
- }
+ //handle faults
+ generateAndPopulateFaultNames();
- // write skeleton only if the used has
- // asked for the deployment descriptor in the interface mode
- // else write it anyway :)
- if (codeGenConfiguration.isServerSideInterface()) {
- if (codeGenConfiguration.isGenerateDeployementDescriptor()) {
+ //
+ if (codeGenConfiguration.isServerSideInterface()) {
+ //write skeletonInterface
+ writeSkeletonInterface();
+ }
+
+ // write skeleton only if the used has
+ // asked for the deployment descriptor in the interface mode
+ // else write it anyway :)
+ if (codeGenConfiguration.isServerSideInterface()) {
+ if (codeGenConfiguration.isGenerateDeployementDescriptor()) {
+ writeSkeleton();
+ }
+ } else {
writeSkeleton();
}
- } else {
- writeSkeleton();
- }
- // write a MessageReceiver for this particular service.
- writeMessageReceiver();
+ // write a MessageReceiver for this particular service.
+ writeMessageReceiver();
+
+ // write the Exceptions
+ writeExceptions();
+
+ //for the server side codegen
+ //we need to serialize the WSDL's
+ writeWSDLFiles();
+ }
- // write the Exceptions
- writeExceptions();
// write service xml
// if asked
@@ -1119,9 +1139,7 @@
writeAntBuild();
}
- //for the server side codegen
- //we need to serialize the WSDL's
- writeWSDLFiles();
+
} catch (CodeGenerationException cgExp) {
throw cgExp;
@@ -1144,7 +1162,7 @@
axisService.setCustomSchemaNameSuffix(".xsd");//suffix with .xsd - the file name extension
//force the mappings to be reconstructed
axisService.setSchemaLocationsAdjusted(false);
- axisService.populateSchemaMappings();
+ Map changedMap = axisService.populateSchemaMappings();
// add these two attribute to use the user defined wsdl to use.
try {
@@ -1172,6 +1190,10 @@
);
}
+ //we should have a catch here
+ // we have to change the imports in the wsdl schemas
+
+
//switch between the correct writer
if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2.
equals(codeGenConfiguration.getWSDLVersion())) {
@@ -1188,7 +1210,7 @@
// wait till Woden implements it.
} else {
-
+ axisService.adjustWSDLSchemaLocatins(changedMap);
WSDL11Writer wsdl11Writer = new WSDL11Writer(
codeGenConfiguration.isFlattenFiles() ?
getOutputDirectory(codeGenConfiguration.getOutputLocation(), null) :
@@ -1644,16 +1666,25 @@
protected Document createDOMDocumentForServiceXML() {
Document doc = getEmptyDocument();
String className = null;
- String serviceName = axisService.getName();
- if (this.codeGenConfiguration.isBackwordCompatibilityMode()) {
- className = makeJavaClassName(axisService.getBindingName());
- } else {
- className = makeJavaClassName(serviceName);
+ String serviceName = null;
+
+ Element rootElement = doc.createElement("interfaces");
+ doc.appendChild(rootElement);
+
+ for (Iterator iter = this.axisServices.iterator(); iter.hasNext();) {
+ this.axisService = (AxisService) iter.next();
+ this.axisBinding = axisService.getEndpoint(axisService.getEndpointName()).getBinding();
+ serviceName = axisService.getName();
+ if (this.codeGenConfiguration.isBackwordCompatibilityMode()) {
+ className = makeJavaClassName(axisService.getBindingName());
+ } else {
+ className = makeJavaClassName(serviceName);
+ }
+
+ rootElement.appendChild(getServiceElement(serviceName, className, doc));
}
- doc.appendChild(getServiceElement(serviceName, className, doc));
return doc;
-
}
/**
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JAXBRIExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JAXBRIExtension.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JAXBRIExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JAXBRIExtension.java Sun Mar 11 23:07:24 2007
@@ -20,6 +20,7 @@
import org.apache.axis2.wsdl.databinding.TypeMapper;
import org.apache.axis2.wsdl.i18n.CodegenMessages;
import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
+import org.apache.axis2.description.AxisService;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -30,9 +31,10 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
+import java.util.Iterator;
public class JAXBRIExtension extends AbstractDBProcessingExtension {
-
+
public static final String SCHEMA_FOLDER = "schemas";
public static String MAPPINGS = "mappings";
@@ -43,15 +45,15 @@
public static final String MAPPING_FOLDER = "Mapping";
public static final String MAPPER_FILE_NAME = "mapper";
public static final String SCHEMA_PATH = "/org/apache/axis2/wsdl/codegen/schema/";
-
+
public static final String JAXB_RI_API_CLASS = "javax.xml.bind.JAXBContext";
public static final String JAXB_RI_IMPL_CLASS = "com.sun.xml.bind.Util";
public static final String JAXB_RI_XJC_CLASS = "com.sun.tools.xjc.api.XJC";
-
+
public static final String JAXB_RI_UTILITY_CLASS = "org.apache.axis2.jaxbri.CodeGenerationUtility";
public static final String JAXB_RI_PROCESS_METHOD = "processSchemas";
-
+
public void engage(CodeGenConfiguration configuration) {
@@ -59,19 +61,19 @@
if (testFallThrough(configuration.getDatabindingType())) {
return;
}
-
+
try {
// try dummy load of framework classes first to check missing jars
try {
- ClassLoader cl = getClass().getClassLoader();
- cl.loadClass(JAXB_RI_API_CLASS);
+ ClassLoader cl = getClass().getClassLoader();
+ cl.loadClass(JAXB_RI_API_CLASS);
cl.loadClass(JAXB_RI_IMPL_CLASS);
cl.loadClass(JAXB_RI_XJC_CLASS);
} catch (ClassNotFoundException e) {
throw new RuntimeException("JAX-B RI JARs not on classpath");
}
-
+
// load the actual utility class
Class clazz = null;
try {
@@ -79,11 +81,17 @@
} catch (ClassNotFoundException e) {
throw new RuntimeException("JAX-B RI binding extension not in classpath");
}
-
+
// invoke utility class method for actual processing
Method method = clazz.getMethod(JAXB_RI_PROCESS_METHOD,
new Class[] { List.class, Element[].class, CodeGenConfiguration.class });
- ArrayList schemas = configuration.getAxisService().getSchema();
+ List schemas = new ArrayList();
+ List axisServices = configuration.getAxisServices();
+ AxisService axisService = null;
+ for (Iterator iter = axisServices.iterator();iter.hasNext();){
+ axisService = (AxisService) iter.next();
+ schemas.addAll(axisService.getSchema());
+ }
Element[] additionalSchemas = loadAdditionalSchemas();
TypeMapper mapper = (TypeMapper)method.invoke(null,
new Object[] { schemas, additionalSchemas, configuration });
@@ -98,7 +106,7 @@
throw new RuntimeException(e);
}
}
-
+
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JaxMeExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JaxMeExtension.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JaxMeExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JaxMeExtension.java Sun Mar 11 23:07:24 2007
@@ -22,6 +22,7 @@
import org.apache.axis2.wsdl.databinding.TypeMapper;
import org.apache.axis2.wsdl.i18n.CodegenMessages;
import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
+import org.apache.axis2.description.AxisService;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.jaxme.generator.impl.GeneratorImpl;
import org.apache.ws.jaxme.generator.sg.GroupSG;
@@ -46,6 +47,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
+import java.util.Iterator;
public class JaxMeExtension extends AbstractDBProcessingExtension {
public static final String SCHEMA_FOLDER = "schemas";
@@ -70,7 +72,13 @@
try {
//get the types from the types section
- List typesList = configuration.getAxisService().getSchema();
+ List typesList = new ArrayList();
+ List axisServices = configuration.getAxisServices();
+ AxisService axisService = null;
+ for (Iterator iter = axisServices.iterator();iter.hasNext();){
+ axisService = (AxisService) iter.next();
+ typesList.addAll(axisService.getSchema());
+ }
//check for the imported types. Any imported types are supposed to be here also
if (typesList == null || typesList.isEmpty()) {
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java Sun Mar 11 23:07:24 2007
@@ -27,7 +27,8 @@
if (packageName == null || URLProcessor.DEFAULT_PACKAGE.equals(packageName)) {
//use the target namespace from the axis service to form a package name
- String targetNameSpace = configuration.getAxisService().getTargetNamespace();
+ // since all the services are in same name space
+ String targetNameSpace = configuration.getTargetNamespace();
// if this target name space exists in the ns2p then we have to get that package
if ((configuration.getUri2PackageNameMap() != null) &&
@@ -35,7 +36,7 @@
packageName = (String) configuration.getUri2PackageNameMap().get(targetNameSpace);
} else {
// i.e. user have not given any ns2p information for this name space
- packageName = URLProcessor.makePackageName(configuration.getAxisService().getTargetNamespace());
+ packageName = URLProcessor.makePackageName(configuration.getTargetNamespace());
}
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java Sun Mar 11 23:07:24 2007
@@ -120,19 +120,25 @@
PolicyInclude policyInclude;
Policy policy;
+ List axisServices = configuration.getAxisServices();
+ AxisService axisService;
+ for (Iterator servicesIter = axisServices.iterator(); servicesIter.hasNext();) {
+ axisService = (AxisService) servicesIter.next();
+ for (Iterator iterator = axisService.getOperations(); iterator.hasNext();) {
+ axisOperation = (AxisOperation) iterator.next();
+ opName = axisOperation.getName();
- for (Iterator iterator = configuration.getAxisService().getOperations(); iterator.hasNext(); ) {
- axisOperation = (AxisOperation) iterator.next();
- opName = axisOperation.getName();
+ policyInclude = axisOperation.getPolicyInclude();
+ policy = policyInclude.getEffectivePolicy();
- policyInclude = axisOperation.getPolicyInclude();
- policy = policyInclude.getEffectivePolicy();
-
- if (policy != null) {
- processPolicies(document, rootElement, policy, opName,namespace2ExtMap);
+ if (policy != null) {
+ processPolicies(document, rootElement, policy, opName, namespace2ExtMap);
+ }
}
}
+
+ // TODO: think about this how can we support this
configuration.putProperty("module-codegen-policy-extensions", rootElement);
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java Sun Mar 11 23:07:24 2007
@@ -77,22 +77,26 @@
contains(configuration.getDatabindingType())) {
//walk the schema and find the top level elements
- AxisService axisService = configuration.getAxisService();
+ List services = configuration.getAxisServices();
+ AxisService axisService;
- for (Iterator operations = axisService.getOperations();
- operations.hasNext();) {
- AxisOperation op = (AxisOperation) operations.next();
+ for (Iterator servicesIter = services.iterator(); servicesIter.hasNext();) {
+ axisService = (AxisService) servicesIter.next();
+ for (Iterator operations = axisService.getOperations();
+ operations.hasNext();) {
+ AxisOperation op = (AxisOperation) operations.next();
- if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) {
- walkSchema(op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE),
- WSDLConstants.INPUT_PART_QNAME_SUFFIX);
- }
- // get the out put parameter details as well to unwrap the responses
- if (WSDLUtil.isOutputPresentForMEP(op.getMessageExchangePattern())){
- walkSchema(op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE),
- WSDLConstants.OUTPUT_PART_QNAME_SUFFIX);
- }
+ if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) {
+ walkSchema(op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE),
+ WSDLConstants.INPUT_PART_QNAME_SUFFIX);
+ }
+ // get the out put parameter details as well to unwrap the responses
+ if (WSDLUtil.isOutputPresentForMEP(op.getMessageExchangePattern())) {
+ walkSchema(op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE),
+ WSDLConstants.OUTPUT_PART_QNAME_SUFFIX);
+ }
+ }
}
}
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java Sun Mar 11 23:07:24 2007
@@ -27,7 +27,7 @@
public void engage(CodeGenConfiguration configuration) throws CodeGenerationException {
//WSDLDescription wom = this.configuration.getWom();
- List schemaList = configuration.getAxisService().getSchema();
+ List schemaList = configuration.getSchemaListForAllServices();
if (schemaList == null || schemaList.isEmpty()) {
//there are no types to be considered
return;
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java Sun Mar 11 23:07:24 2007
@@ -20,6 +20,7 @@
import org.apache.axis2.wsdl.databinding.TypeMapper;
import org.apache.axis2.wsdl.i18n.CodegenMessages;
import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
+import org.apache.axis2.description.AxisService;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -30,6 +31,7 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
+import java.util.Iterator;
public class XMLBeansExtension extends AbstractDBProcessingExtension {
public static final String SCHEMA_FOLDER = "schemas";
@@ -42,7 +44,7 @@
public static final String MAPPING_FOLDER = "Mapping";
public static final String MAPPER_FILE_NAME = "mapper";
public static final String SCHEMA_PATH = "/org/apache/axis2/wsdl/codegen/schema/";
-
+
public static final String XMLBEANS_CONFIG_CLASS =
"org.apache.xmlbeans.BindingConfig";
public static final String XMLBEANS_UTILITY_CLASS =
@@ -65,7 +67,7 @@
} catch (ClassNotFoundException e) {
throw new RuntimeException("XMLBeans framework jars not in classpath");
}
-
+
// load the actual utility class
Class clazz = null;
try {
@@ -73,11 +75,18 @@
} catch (ClassNotFoundException e) {
throw new RuntimeException("XMLBeans binding extension not in classpath");
}
-
+
// invoke utility class method for actual processing
Method method = clazz.getMethod(XMLBEANS_PROCESS_METHOD,
new Class[] { List.class, Element[].class, CodeGenConfiguration.class });
- ArrayList schemas = configuration.getAxisService().getSchema();
+ List schemas = new ArrayList();
+ List axisServices = configuration.getAxisServices();
+ AxisService axisService = null;
+ for (Iterator iter = axisServices.iterator();iter.hasNext();){
+ axisService = (AxisService) iter.next();
+ schemas.addAll(axisService.getSchema());
+ }
+
Element[] additionalSchemas = loadAdditionalSchemas();
TypeMapper mapper = (TypeMapper)method.invoke(null,
new Object[] { schemas, additionalSchemas, configuration });
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl Sun Mar 11 23:07:24 2007
@@ -9,7 +9,7 @@
</serviceGroup>
</xsl:template>
- <xsl:template match="interface">
+ <xsl:template match="interfaces/interface">
<xsl:variable name="package"><xsl:value-of select="@classpackage"/></xsl:variable>
<service>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl Sun Mar 11 23:07:24 2007
@@ -26,8 +26,11 @@
<property name="maven.class.path">
<xsl:attribute name="value"></xsl:attribute>
</property>
+ <!--<property name="name">-->
+ <!--<xsl:attribute name="value"><xsl:value-of select="@servicename"/></xsl:attribute>-->
+ <!--</property>-->
<property name="name">
- <xsl:attribute name="value"><xsl:value-of select="@servicename"/></xsl:attribute>
+ <xsl:attribute name="value">Services</xsl:attribute>
</property>
<property name="src">
<xsl:attribute name="value">${project.base.dir}/<xsl:value-of select="$src"/></xsl:attribute>
Modified: webservices/axis2/trunk/java/modules/integration/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/maven.xml?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/maven.xml Sun Mar 11 23:07:24 2007
@@ -89,7 +89,7 @@
target="make.repo"/>
<ant:ant antfile="build.xml" inheritall="true" inheritrefs="true" dir="target/perf2"
target="jar.client"/>
- <ant:move file="target/perf2/build/lib/PerfPortType-test-client.jar"
+ <ant:move file="target/perf2/build/lib/Services-test-client.jar"
tofile="target/perf2/build/lib/PerfSoapService2-test-client.jar" />
<ant:path id="samples.wsdl.perf2.client.jar"
location="target/perf2/build/lib/PerfSoapService2-test-client.jar"/>
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java Sun Mar 11 23:07:24 2007
@@ -104,7 +104,7 @@
}
}
- log.info("AARBasedWSDLLocator: Unable to resolve" + lastImportLocation);
+ log.info("AARBasedWSDLLocator: Unable to resolve " + lastImportLocation);
return null;
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Sun Mar 11 23:07:24 2007
@@ -61,14 +61,13 @@
import org.apache.ws.java2wsdl.utils.TypeTable;
import org.codehaus.jam.JAnnotation;
import org.codehaus.jam.JMethod;
-import org.w3c.dom.Document;
+import org.w3c.dom.*;
import org.xml.sax.SAXException;
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.WSDLException;
+import javax.wsdl.*;
import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.schema.SchemaImport;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.wsdl.xml.WSDLWriter;
@@ -80,17 +79,7 @@
import java.net.SocketException;
import java.net.URL;
import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
/**
* Class AxisService
@@ -185,6 +174,7 @@
*/
private Map schemaMappingTable = null;
+
/**
* counter variable for naming the schemas
*/
@@ -1852,21 +1842,71 @@
* it is best that this logic be in the axis service since one can
* call the axis service to populate the schema mappings
*/
- public void populateSchemaMappings() {
+ public Map populateSchemaMappings() {
//populate the axis service with the necessary schema references
ArrayList schema = this.schemaList;
+ Map changedScheamLocations = null;
if (!this.schemaLocationsAdjusted) {
Hashtable nameTable = new Hashtable();
//calculate unique names for the schemas
calcualteSchemaNames(schema, nameTable);
//adjust the schema locations as per the calculated names
- adjustSchemaNames(schema, nameTable);
+ changedScheamLocations = adjustSchemaNames(schema, nameTable);
//reverse the nametable so that there is a mapping from the
//name to the schemaObject
setSchemaMappingTable(swapMappingTable(nameTable));
setSchemaLocationsAdjusted(true);
}
+ return changedScheamLocations;
+ }
+
+ /**
+ * adjust the schema locations in the original wsdl
+ * @param changedScheamLocations
+ */
+ public void adjustWSDLSchemaLocatins(Map changedScheamLocations) {
+ Parameter wsld4jdefinition = getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
+ Definition definition = (Definition) wsld4jdefinition.getValue();
+ Types wsdlTypes = definition.getTypes();
+ List extensibilityElements = wsdlTypes.getExtensibilityElements();
+ Object currentObject;
+ Schema schema;
+ for (Iterator iter = extensibilityElements.iterator(); iter.hasNext();) {
+ currentObject = iter.next();
+ if (currentObject instanceof Schema) {
+ schema = (Schema) currentObject;
+ changeLocations(schema.getElement(), changedScheamLocations);
+ }
+ }
+
+ }
+
+ private void changeLocations(Element element, Map changedScheamLocations) {
+ NodeList nodeList = element.getChildNodes();
+ String tagName;
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ tagName = nodeList.item(i).getNodeName();
+ if (tagName.equals("import") || tagName.equals("include")) {
+ processImport(nodeList.item(i), changedScheamLocations);
+ }
+ }
+ }
+
+ private void processImport(Node importNode, Map changedScheamLocations) {
+ NamedNodeMap nodeMap = importNode.getAttributes();
+ Node attribute;
+ String attributeValue;
+ for (int i = 0; i < nodeMap.getLength(); i++) {
+ attribute = nodeMap.item(i);
+ if (attribute.getNodeName().equals("schemaLocation")) {
+ attributeValue = attribute.getNodeValue();
+ if (changedScheamLocations.get(attributeValue) != null) {
+ attribute.setNodeValue(
+ (String) changedScheamLocations.get(attributeValue));
+ }
+ }
+ }
}
/**
@@ -1916,7 +1956,7 @@
/**
* Run 2 - adjust the names
*/
- private void adjustSchemaNames(List schemas, Hashtable nameTable) {
+ private Map adjustSchemaNames(List schemas, Hashtable nameTable) {
Hashtable importedSchemas = new Hashtable();
//process the schemas in the main schema list
for (int i = 0; i < schemas.size(); i++) {
@@ -1928,6 +1968,7 @@
adjustSchemaName((XmlSchema) nameTableKeys.nextElement(), nameTable, importedSchemas);
}
+ return importedSchemas;
}
/**
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java Sun Mar 11 23:07:24 2007
@@ -23,6 +23,8 @@
import javax.wsdl.Port;
import javax.wsdl.Service;
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
@@ -53,6 +55,12 @@
axisServices = new ArrayList(); // create an empty ArrayList
}
+ public WSDL11ToAllAxisServicesBuilder(Definition def) {
+ super(def, null, null);
+ axisServices = new ArrayList(); // create an empty ArrayList
+ }
+
+
/**
* Public method to access the wsdl 1.1 file and create a List of AxisService objects.
* For each port on each service in the wsdl, an AxisService object is created and
@@ -77,44 +85,22 @@
}
return null; // can't go any further without the wsdl
}
- Iterator wsdlServIter = wsdl4jDefinition.getServices().entrySet().iterator();
+ Iterator wsdlServIter = wsdl4jDefinition.getServices().values().iterator();
+ // let the wsdlToservice builder to decide the port to generate binding
+ portName = null;
while (wsdlServIter.hasNext()) {
- Entry entry = (Entry) wsdlServIter.next();
- Service service = (Service) entry.getValue();
+ Service service = (Service) wsdlServIter.next();
// set the serviceName on the parent to setup call to populateService
serviceName = service.getQName();
- Iterator wsdlPortIter = service.getPorts().entrySet().iterator();
- while (wsdlPortIter.hasNext()) {
- Entry portEntry = (Entry) wsdlPortIter.next();
- Port port = (Port) portEntry.getValue();
- portName = port.getName();
- // start with a fresh axisService
- this.axisService = new AxisService();
- // now that serviceName and portName are set, call up to the
- // parent class to populate this service.
- AxisService retAxisService = populateService();
- if (retAxisService != null) {
- // save off the wsdl service QName as a parameter.
- Parameter serviceNameParameter = new Parameter();
- serviceNameParameter.setName(WSDL_SERVICE_QNAME);
- serviceNameParameter.setValue(serviceName);
- retAxisService.addParameter(serviceNameParameter);
- // Also save off the javax.wsdl.Port object that this AxisService
- // represents.
- Parameter portParameter = new Parameter();
- portParameter.setName(WSDL_PORT);
- portParameter.setValue(port);
- retAxisService.addParameter(portParameter);
- // since this AxisService really represents the wsdl
- // port, change the name
- // from wsdl service name to port name.
- retAxisService.setName(portName); // TODO: mangle name????
-
- axisServices.add(retAxisService);
- } // end if axisService was returned
- } // end for all ports of a service
- } // end for all services in the wsdl
+ this.axisService = new AxisService();
+ // now that serviceName and portName are set, call up to the
+ // parent class to populate this service.
+ AxisService retAxisService = populateService();
+ if (retAxisService != null) {
+ axisServices.add(retAxisService);
+ }
+ }
if (log.isDebugEnabled()) {
log.debug("Exit: populateAllServices.");
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Sun Mar 11 23:07:24 2007
@@ -292,6 +292,7 @@
log.error(e);
throw new AxisFault(e);
} catch (Exception e) {
+ e.printStackTrace();
log.error(e);
throw new AxisFault(e);
}
@@ -597,6 +598,8 @@
return schemaMap;
}
+
+
/**
* return the service to process
* if user has specified we check whether it exists
@@ -1867,6 +1870,7 @@
// ones
axisService.addSchema(getXMLSchema(schema.getElement(), schema
.getDocumentBaseURI()));
+
} else if (wsdl4jExtensibilityElement instanceof SOAP12Operation) {
SOAP12Operation soapOperation = (SOAP12Operation) wsdl4jExtensibilityElement;
AxisBindingOperation axisBindingOperation = (AxisBindingOperation) description;
@@ -2317,6 +2321,8 @@
}
}
}
+
+
/**
* Inner class declaration for the processing exceptions
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java Sun Mar 11 23:07:24 2007
@@ -199,4 +199,12 @@
public void setCodegen(boolean codegen) {
isCodegen = codegen;
}
+
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(QName serviceName) {
+ this.serviceName = serviceName;
+ }
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java Sun Mar 11 23:07:24 2007
@@ -20,11 +20,9 @@
import javax.wsdl.Definition;
import javax.wsdl.Import;
import javax.wsdl.Types;
+import javax.wsdl.PortType;
import javax.wsdl.extensions.ExtensibilityElement;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
+import java.util.*;
/**
* This class provides support for processing a WSDL4J defintion which includes imports.
@@ -49,6 +47,7 @@
Map imported_defs = new HashMap();
getImportedDefinitions(wsdl4JDefinition, imported_defs);
+
for (Iterator iterator = imported_defs.values().iterator(); iterator.hasNext();) {
Definition imported_def = (Definition) iterator.next();
@@ -92,6 +91,7 @@
// add portTypes
wsdl4JDefinition.getPortTypes().putAll(imported_def.getPortTypes());
+
// add bindings
wsdl4JDefinition.getBindings().putAll(imported_def.getBindings());
@@ -101,6 +101,25 @@
// add ExtensibilityElements
wsdl4JDefinition.getExtensibilityElements()
.addAll(imported_def.getExtensibilityElements());
+
+ }
+
+ // after putting the imports we going to remove them to avoid any confilicts
+ List importsList = new ArrayList();
+ Map imports = wsdl4JDefinition.getImports();
+ Import wsdlImport;
+ Vector wsdlImportVector;
+ for (Iterator importsVectorIter = imports.values().iterator(); importsVectorIter.hasNext();) {
+ wsdlImportVector = (Vector) importsVectorIter.next();
+ for (Iterator importsIter = wsdlImportVector.iterator(); importsIter.hasNext();) {
+ wsdlImport = (Import) importsIter.next();
+ importsList.add(wsdlImport);
+ }
+ }
+
+ for (Iterator importsListIter = importsList.iterator();importsListIter.hasNext();){
+ wsdlImport = (Import) importsListIter.next();
+ wsdl4JDefinition.removeImport(wsdlImport);
}
}
Modified: webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java?view=diff&rev=517108&r1=517107&r2=517108
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java (original)
+++ webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java Sun Mar 11 23:07:24 2007
@@ -112,7 +112,13 @@
//xmlbeans specific XMLObject
mapper.setDefaultMappingName(XmlObject.class.getName());
- Map nameSpacesMap = cgconfig.getAxisService().getNameSpacesMap();
+ Map nameSpacesMap = new HashMap();
+ List axisServices = cgconfig.getAxisServices();
+ AxisService axisService = null;
+ for (Iterator iter = axisServices.iterator();iter.hasNext();){
+ axisService = (AxisService) iter.next();
+ nameSpacesMap.putAll(axisService.getNameSpacesMap());
+ }
// process all the schemas and make a list of all of them for
// resolving entities
@@ -193,82 +199,83 @@
//process the unwrapped parameters
if (!cgconfig.isParametersWrapped()) {
//figure out the unwrapped operations
- AxisService axisService = cgconfig.getAxisService();
- for (Iterator operations = axisService.getOperations();
- operations.hasNext();) {
- AxisOperation op = (AxisOperation) operations.next();
-
- if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) {
- AxisMessage message = op.getMessage(
- WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- if (message != null && message.getParameter(Constants.UNWRAPPED_KEY) != null) {
- SchemaGlobalElement xmlbeansElement = sts.findElement(message.getElementQName());
- SchemaType sType = xmlbeansElement.getType();
-
- SchemaProperty[] elementProperties = sType.getElementProperties();
- for (int i = 0; i < elementProperties.length; i++) {
- SchemaProperty elementProperty = elementProperties[i];
-
- QName partQName = WSDLUtil.getPartQName(op.getName().getLocalPart(),
- WSDLConstants.INPUT_PART_QNAME_SUFFIX,
- elementProperty.getName().getLocalPart());
-
- //this type is based on a primitive type- use the
- //primitive type name in this case
- String fullJaveName = elementProperty.getType().getFullJavaName();
- if (elementProperty.extendsJavaArray()) {
- fullJaveName = fullJaveName.concat("[]");
- }
- mapper.addTypeMappingName(partQName, fullJaveName);
- SchemaType primitiveType = elementProperty.getType().getPrimitiveType();
-
-
- if (primitiveType != null) {
- mapper.addTypeMappingStatus(partQName, Boolean.TRUE);
- }
- if (elementProperty.extendsJavaArray()) {
- mapper.addTypeMappingStatus(partQName, Constants.ARRAY_TYPE);
+ axisServices = cgconfig.getAxisServices();
+ for (Iterator servicesIter = axisServices.iterator(); servicesIter.hasNext();) {
+ axisService = (AxisService) servicesIter.next();
+ for (Iterator operations = axisService.getOperations();
+ operations.hasNext();) {
+ AxisOperation op = (AxisOperation) operations.next();
+
+ if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) {
+ AxisMessage message = op.getMessage(
+ WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ if (message != null && message.getParameter(Constants.UNWRAPPED_KEY) != null) {
+ SchemaGlobalElement xmlbeansElement = sts.findElement(message.getElementQName());
+ SchemaType sType = xmlbeansElement.getType();
+
+ SchemaProperty[] elementProperties = sType.getElementProperties();
+ for (int i = 0; i < elementProperties.length; i++) {
+ SchemaProperty elementProperty = elementProperties[i];
+
+ QName partQName = WSDLUtil.getPartQName(op.getName().getLocalPart(),
+ WSDLConstants.INPUT_PART_QNAME_SUFFIX,
+ elementProperty.getName().getLocalPart());
+
+ //this type is based on a primitive type- use the
+ //primitive type name in this case
+ String fullJaveName = elementProperty.getType().getFullJavaName();
+ if (elementProperty.extendsJavaArray()) {
+ fullJaveName = fullJaveName.concat("[]");
+ }
+ mapper.addTypeMappingName(partQName, fullJaveName);
+ SchemaType primitiveType = elementProperty.getType().getPrimitiveType();
+
+
+ if (primitiveType != null) {
+ mapper.addTypeMappingStatus(partQName, Boolean.TRUE);
+ }
+ if (elementProperty.extendsJavaArray()) {
+ mapper.addTypeMappingStatus(partQName, Constants.ARRAY_TYPE);
+ }
}
}
}
- }
- if (WSDLUtil.isOutputPresentForMEP(op.getMessageExchangePattern())) {
- AxisMessage message = op.getMessage(
- WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- if (message != null && message.getParameter(Constants.UNWRAPPED_KEY) != null) {
- SchemaGlobalElement xmlbeansElement = sts.findElement(message.getElementQName());
- SchemaType sType = xmlbeansElement.getType();
-
- SchemaProperty[] elementProperties = sType.getElementProperties();
- for (int i = 0; i < elementProperties.length; i++) {
- SchemaProperty elementProperty = elementProperties[i];
-
- QName partQName = WSDLUtil.getPartQName(op.getName().getLocalPart(),
- WSDLConstants.OUTPUT_PART_QNAME_SUFFIX,
- elementProperty.getName().getLocalPart());
-
- //this type is based on a primitive type- use the
- //primitive type name in this case
- String fullJaveName = elementProperty.getType().getFullJavaName();
- if (elementProperty.extendsJavaArray()) {
- fullJaveName = fullJaveName.concat("[]");
- }
- mapper.addTypeMappingName(partQName, fullJaveName);
- SchemaType primitiveType = elementProperty.getType().getPrimitiveType();
-
-
- if (primitiveType != null) {
- mapper.addTypeMappingStatus(partQName, Boolean.TRUE);
- }
- if (elementProperty.extendsJavaArray()) {
- mapper.addTypeMappingStatus(partQName, Constants.ARRAY_TYPE);
+ if (WSDLUtil.isOutputPresentForMEP(op.getMessageExchangePattern())) {
+ AxisMessage message = op.getMessage(
+ WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ if (message != null && message.getParameter(Constants.UNWRAPPED_KEY) != null) {
+ SchemaGlobalElement xmlbeansElement = sts.findElement(message.getElementQName());
+ SchemaType sType = xmlbeansElement.getType();
+
+ SchemaProperty[] elementProperties = sType.getElementProperties();
+ for (int i = 0; i < elementProperties.length; i++) {
+ SchemaProperty elementProperty = elementProperties[i];
+
+ QName partQName = WSDLUtil.getPartQName(op.getName().getLocalPart(),
+ WSDLConstants.OUTPUT_PART_QNAME_SUFFIX,
+ elementProperty.getName().getLocalPart());
+
+ //this type is based on a primitive type- use the
+ //primitive type name in this case
+ String fullJaveName = elementProperty.getType().getFullJavaName();
+ if (elementProperty.extendsJavaArray()) {
+ fullJaveName = fullJaveName.concat("[]");
+ }
+ mapper.addTypeMappingName(partQName, fullJaveName);
+ SchemaType primitiveType = elementProperty.getType().getPrimitiveType();
+
+
+ if (primitiveType != null) {
+ mapper.addTypeMappingStatus(partQName, Boolean.TRUE);
+ }
+ if (elementProperty.extendsJavaArray()) {
+ mapper.addTypeMappingStatus(partQName, Constants.ARRAY_TYPE);
+ }
}
}
}
}
-
-
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org