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 de...@apache.org on 2006/03/31 06:16:45 UTC

svn commit: r390321 [2/2] - in /webservices/axis2/trunk/java/modules: codegen/ codegen/test-resources/ codegen/test/org/apache/axis2/wsdl/ core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/deployment/util/ core/src/org/apache/axis2/descri...

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java Thu Mar 30 20:16:42 2006
@@ -9,6 +9,7 @@
 import org.apache.ws.policy.util.DOMPolicyReader;
 import org.apache.ws.policy.util.PolicyFactory;
 import org.apache.wsdl.WSDLConstants;
+import org.apache.wsdl.WSDLExtensibilityElement;
 import org.apache.wsdl.extensions.DefaultExtensibilityElement;
 import org.apache.wsdl.extensions.ExtensionConstants;
 import org.apache.wsdl.extensions.PolicyExtensibilityElement;
@@ -30,8 +31,6 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.*;
@@ -69,7 +68,6 @@
     private static final String AXIS2WRAPPED = "axis2wrapped";
     private static final String XSD_TYPE = "type";
     private static final String XSD_REF = "ref";
-    private static final String BOUND_INTERFACE_NAME = "BoundInterface";
 
 
     private static int nsCount = 0;
@@ -104,28 +102,32 @@
             this.copyExtensibleElements(wsdl4jTypes.getExtensibilityElements(), dif
                     , axisService, AxisExtensiblityElementWrapper.PORT);
         }
+        Binding binding = findBinding(dif);
         //////////////////(1.2) /////////////////////////////
         // create new Schema extensions element for wrapping
-        Element[] schemaElements = generateWrapperSchema(dif);
+        Element[] schemaElements = generateWrapperSchema(dif, binding);
         if (schemaElements != null && schemaElements.length > 0) {
             for (int i = 0; i < schemaElements.length; i++) {
                 Element schemaElement = schemaElements[i];
                 if (schemaElement != null) {
+                    System.out.println(schemaElement.getNamespaceURI());
                     ExtensionFactoryImpl extensionFactory = new ExtensionFactoryImpl();
-                    org.apache.wsdl.extensions.Schema schemaExtensibilityElement = (org.apache.wsdl.extensions.Schema) extensionFactory.getExtensionElement(
-                            ExtensionConstants.SCHEMA);
+                    org.apache.wsdl.extensions.Schema schemaExtensibilityElement =
+                            (org.apache.wsdl.extensions.Schema) extensionFactory.getExtensionElement(
+                                    ExtensionConstants.SCHEMA);
                     schemaExtensibilityElement.setElement(schemaElement);
                     axisService.setSchema(getXMLSchema(schemaExtensibilityElement.getElement()));
                 }
             }
         }
-        processServices(dif);
+        processBinding(binding, dif);
         return axisService;
     }
 
-    private void processServices(Definition dif) throws AxisFault {
+    private Binding findBinding(Definition dif) throws AxisFault {
         Map services = dif.getServices();
         Service service;
+        Binding binding = null;
         Port port = null;
         if (serviceName != null) {
             service = (Service) services.get(serviceName);
@@ -153,20 +155,77 @@
                 port = (Port) ports.values().toArray()[0];
             }
         }
+        axisService.setName(service.getQName().getLocalPart());
         if (port != null) {
             copyExtensibleElements(port.getExtensibilityElements(),
                     dif, axisService, AxisExtensiblityElementWrapper.PORT);
-            Binding binding = port.getBinding();
-            processBinding(binding, dif);
+            binding = port.getBinding();
         }
-        axisService.setName(service.getQName().getLocalPart());
+        return binding;
     }
 
     private void processBinding(Binding binding, Definition dif) throws AxisFault {
         if (binding != null) {
             PortType portType = binding.getPortType();
+
+
             processPortType(portType, dif);
-            //NOT yet  complte
+
+
+            List list = binding.getBindingOperations();
+            copyExtensibleElements(binding.getExtensibilityElements(),
+                    dif, axisService, AxisExtensiblityElementWrapper.PORT_BINDING);
+            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, AxisExtensiblityElementWrapper.PORT_BINDING);
+                ArrayList extElemntList = operation.getWsdlExtElements();
+                if (extElemntList != null) {
+                    Iterator elements = extElemntList.iterator();
+                    while (elements.hasNext()) {
+                        AxisExtensiblityElementWrapper element = (AxisExtensiblityElementWrapper) elements.next();
+                        WSDLExtensibilityElement wsdlextElement = element.getExtensibilityElement();
+                        if (wsdlextElement instanceof org.apache.wsdl.extensions.SOAPOperation) {
+                            org.apache.wsdl.extensions.SOAPOperation soapOperation =
+                                    (org.apache.wsdl.extensions.SOAPOperation) wsdlextElement;
+                            operation.setSoapAction(soapOperation.getSoapAction());
+                        }
+                    }
+                }
+                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, AxisExtensiblityElementWrapper.PORT_BINDING);
+                    }
+                }
+                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,
+                                AxisExtensiblityElementWrapper.PORT_BINDING);
+                    }
+                }
+            }
+
         }
     }
 
@@ -206,8 +265,7 @@
         //Copy Name Attribute
         String MEP = getMEP(wsdl4jOperation);
         AxisOperation axisOperation = AxisOperationFactory.getOperationDescription(MEP);
-        axisOperation.setName(new QName(nameSpaceOfTheOperation,
-                wsdl4jOperation.getName()));
+        axisOperation.setName(new QName(wsdl4jOperation.getName()));
 
         Input wsdl4jInputMessage = wsdl4jOperation.getInput();
         QName wrappedInputName = axisOperation.getName();
@@ -223,9 +281,9 @@
                         wrappedInputName
                         , message,
                         findWrapppable(message)));
+                inMessage.setName(message.getQName().getLocalPart());
                 copyExtensibleElements(message.getExtensibilityElements(),
                         dif, inMessage, AxisExtensiblityElementWrapper.PORT_TYPE);
-                //TODO : ExtensibilityAttribute have to handle here
             }
         }
         //Create an output message and add
@@ -238,9 +296,9 @@
                         wrappedOutputName
                         , message,
                         findWrapppable(message)));
+                outMessage.setName(message.getQName().getLocalPart());
                 copyExtensibleElements(message.getExtensibilityElements(),
                         dif, outMessage, AxisExtensiblityElementWrapper.PORT_TYPE);
-                //TODO : ExtensibilityAttribute have to handle here
             }
         }
 
@@ -257,7 +315,9 @@
                         faultMessage, findWrapppable(faultMessage)));
                 copyExtensibleElements(faultMessage.getExtensibilityElements(),
                         dif, faultyMessge, AxisExtensiblityElementWrapper.PORT_TYPE);
+                faultyMessge.setName(faultMessage.getQName().getLocalPart());
             }
+
             axisOperation.setFaultMessages(faultyMessge);
         }
         return axisOperation;
@@ -295,7 +355,8 @@
     }
 
 
-    private Element[] generateWrapperSchema(Definition wsdl4jDefinition) {
+    private Element[] generateWrapperSchema(Definition wsdl4jDefinition,
+                                            Binding binding) {
 
 
         List schemaElementList = new ArrayList();
@@ -307,27 +368,9 @@
         // list, in which case we'll generate a schema per porttype
         ////////////////////////////////////////////////////////////////////////////////////////////
 
-        Map bindingsMap = wsdl4jDefinition.getBindings();
-        Map porttypeMap = wsdl4jDefinition.getPortTypes();
-
-        if (bindingsMap != null && !bindingsMap.isEmpty()) {
-            Binding[] bindings = (Binding[]) bindingsMap.values().toArray(new Binding[bindingsMap.size()]);
-            Binding binding;
-            for (int i = 0; i < bindings.length; i++) {
-                binding = bindings[i];
-                schemaElementList.add(
-                        createSchemaForPorttype(binding.getPortType(), targetNamespaceUri,
-                                findWrapForceable(binding)));
-            }
-        } else {
-            PortType[] porttypesArray = (PortType[]) porttypeMap.values().toArray(new PortType[porttypeMap.size()]);
-            for (int i = 0; i < porttypesArray.length; i++) {
-                schemaElementList.add(
-                        createSchemaForPorttype(porttypesArray[i], targetNamespaceUri, false));
-            }
-
-        }
-
+        schemaElementList.add(
+                createSchemaForPorttype(binding.getPortType(), targetNamespaceUri,
+                        findWrapForceable(binding)));
         return (Element[]) schemaElementList.toArray(new Element[schemaElementList.size()]);
     }
 
@@ -338,6 +381,7 @@
         Map messagesMap = new HashMap();
         Map inputOperationsMap = new HashMap();
         Map outputOperationsMap = new HashMap();
+        Map faultyOperationsMap = new HashMap();
         //this contains the required namespace imports. the key in this
         //map would be the namaspace URI
         Map namespaceImportsMap = new HashMap();
@@ -373,7 +417,20 @@
                 messagesMap.put(message.getQName(), message);
                 outputOperationsMap.put(op.getName(), message);
             }
-            //todo also handle the faults here
+
+            Map faultMap = op.getFaults();
+            if (faultMap != null && faultMap.size() > 0) {
+                Iterator keys = faultMap.keySet().iterator();
+                while (keys.hasNext()) {
+                    Object key = keys.next();
+                    Fault fault = (Fault) faultMap.get(key);
+                    if (fault != null) {
+                        message = fault.getMessage();
+                        messagesMap.put(message.getQName(), message);
+                        faultyOperationsMap.put(key, message);
+                    }
+                }
+            }
         }
 
         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -531,6 +588,27 @@
             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
             ));
 

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java Thu Mar 30 20:16:42 2006
@@ -31,7 +31,7 @@
 *
 */
 
-public class Java2OMBuilder implements Constants {
+public class Java2OMBuilder implements Java2WSDLConstants {
 
     private JMethod method [];
     private XmlSchema schema;
@@ -86,7 +86,7 @@
                 DEFAULT_WSDL_NAMESPACE_PREFIX);
         OMElement ele = fac.createOMElement("definitions", wsdl);
         ns1 = ele.declareNamespace(AXIS2_XSD, "ns1");
-        ele.declareNamespace(SCHEMA_NAME_SPACE, DEFAULT_SCHEMA_NAMESPACE_PREFIX);
+        ele.declareNamespace(URI_2001_SCHEMA_XSD, DEFAULT_SCHEMA_NAMESPACE_PREFIX);
         soap = ele.declareNamespace(DEFAULT_SOAP_NAMESPACE, DEFAULT_SOAP_NAMESPACE_PREFIX);
         tns = ele.declareNamespace(DEFAULT_TARGET_NAMESPACE, TARGETNAMESPACE_PREFIX);
         ele.addAttribute("targetNamespace", DEFAULT_TARGET_NAMESPACE, null);

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java Thu Mar 30 20:16:42 2006
@@ -37,9 +37,9 @@
 
     private String schemaTargetNamespace = null;
     private String schemaTargetNamespacePrefix = null;
-    private String style = Constants.DOCUMNT;
-    private String use = Constants.LITERAL;
-    private String locationUri = Constants.DEFAULT_LOCATION_URL;
+    private String style = Java2WSDLConstants.DOCUMNT;
+    private String use = Java2WSDLConstants.LITERAL;
+    private String locationUri = Java2WSDLConstants.DEFAULT_LOCATION_URL;
 
     public String getSchemaTargetNamespace() {
         return schemaTargetNamespace;

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java Thu Mar 30 20:16:42 2006
@@ -27,7 +27,7 @@
 *
 */
 
-public class Java2WSDLCodegenEngine implements Constants {
+public class Java2WSDLCodegenEngine implements Java2WSDLConstants {
     private Java2WSDLBuilder java2WsdlBuilder;
     public static final String WSDL_FILENAME_SUFFIX = ".wsdl";
 

Copied: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java (from r389982, webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Constants.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java?p2=webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java&p1=webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Constants.java&r1=389982&r2=390321&rev=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java Thu Mar 30 20:16:42 2006
@@ -18,39 +18,42 @@
 *
 */
 
-public interface Constants {
+public interface Java2WSDLConstants {
 
     String DEFAULT_SOAP_NAMESPACE_PREFIX = "soap";
     String DEFAULT_WSDL_NAMESPACE_PREFIX = "wsdl";
     String DEFAULT_SCHEMA_NAMESPACE_PREFIX = "xs";
-    String BINDING_NAME_SUFFIX = "Binding";
-    String PORT_TYPE_SUFFIX = "PortType";
-    String PORT_NAME_SUFFIX = "Port";
-    String DEFAULT_TARGET_NAMESPACE = "http://ws.apache.org/axis2";
-    String WSDL_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/";
     String DEFAULT_TARGET_NAMESPACE_PREFIX = "axis2";
+    String TARGETNAMESPACE_PREFIX = "tns";
+    String SCHEMA_NAMESPACE_PRFIX = "ns";
 
+    String DEFAULT_TARGET_NAMESPACE = "http://ws.apache.org/axis2";
+    String WSDL_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/";
     String AXIS2_XSD = "http://org.apache.axis2/xsd";
     String DEFAULT_SOAP_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/soap/";
-    String TARGETNAMESPACE_PREFIX = "tns";
-    String SCHEMA_NAME_SPACE = "http://www.w3.org/2001/XMLSchema";
+    String TRANSPORT_URI = "http://schemas.xmlsoap.org/soap/http";
+    String DEFAULT_LOCATION_URL = "http://localhost:8080/axis2/services/";
+
+    String BINDING_NAME_SUFFIX = "Binding";
+    String PORT_TYPE_SUFFIX = "PortType";
+    String PORT_NAME_SUFFIX = "Port";
     String MESSAGE_LOCAL_NAME = "message";
     String ATTRIBUTE_NAME = "name";
     String REQUEST_MESSAGE = "RequestMessage";
     String RESPONSE_MESSAGE = "ReponseMessage";
     String MESSAGE_SUFFIX = "Message";
     String REQUEST = "Request";
-    String RESPONSE = "Reponse";
+    String RESPONSE = "Response";
     String PORT_TYPE_LOCAL_NAME = "portType";
     String OPERATION_LOCAL_NAME = "operation";
     String IN_PUT_LOCAL_NAME = "input";
     String OUT_PUT_LOCAL_NAME = "output";
     String SERVICE_LOCAL_NAME = "service";
     String BINDING_LOCAL_NAME = "binding";
-    String TRANSPORT_URI = "http://schemas.xmlsoap.org/soap/http";
     String PORT = "port";
     String PART_ATTRIBUTE_NAME = "part";
     String ELEMENT_ATTRIBUTE_NAME = "element";
+    String FAULT_LOCAL_NAME = "fault";
 
     String SOAP_ADDRESS = "address";
     String LOCATION = "location";
@@ -61,97 +64,39 @@
     String SOAP_USE = "use";
     String DOCUMNT = "document";
     String LITERAL = "literal";
-    String DEFAULT_LOCATION_URL = "http://localhost:8080/axis2/services/";
-
-
-    public static final String URI_SOAP11_ENV =
-            "http://schemas.xmlsoap.org/soap/envelope/";
-    public static final String URI_SOAP12_ENV =
-            "http://www.w3.org/2003/05/soap-envelope";
-
-    public static final String URI_LITERAL_ENC = "";
-
-    //
-    // SOAP-ENC Namespaces
-    //
-    public static final String URI_SOAP11_ENC =
-            "http://schemas.xmlsoap.org/soap/encoding/";
-    public static final String URI_SOAP12_ENC =
-            "http://www.w3.org/2003/05/soap-encoding";
-    public static final String URI_SOAP12_NOENC =
-            "http://www.w3.org/2003/05/soap-envelope/encoding/none";
-
-    // Misc SOAP Namespaces / URIs
-    public static final String URI_SOAP11_NEXT_ACTOR =
-            "http://schemas.xmlsoap.org/soap/actor/next";
-    public static final String URI_SOAP12_NEXT_ROLE =
-            "http://www.w3.org/2003/05/soap-envelope/role/next";
-    /**
-     * @deprecated use URI_SOAP12_NEXT_ROLE
-     */
-    public static final String URI_SOAP12_NEXT_ACTOR = URI_SOAP12_NEXT_ROLE;
-
-    public static final String URI_SOAP12_RPC =
-            "http://www.w3.org/2003/05/soap-rpc";
-
-    public static final String URI_SOAP12_NONE_ROLE =
-            "http://www.w3.org/2003/05/soap-envelope/role/none";
-    public static final String URI_SOAP12_ULTIMATE_ROLE =
-            "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver";
-
-    public static final String URI_SOAP11_HTTP =
-            "http://schemas.xmlsoap.org/soap/http";
-    public static final String URI_SOAP12_HTTP =
-            "http://www.w3.org/2003/05/http";
-
-    public static final String NS_URI_XMLNS =
-            "http://www.w3.org/2000/xmlns/";
-
-    public static final String NS_URI_XML =
-            "http://www.w3.org/XML/1998/namespace";
-
     //
     // Schema XSD Namespaces
     //
-    public static final String URI_1999_SCHEMA_XSD =
-            "http://www.w3.org/1999/XMLSchema";
-    public static final String URI_2000_SCHEMA_XSD =
-            "http://www.w3.org/2000/10/XMLSchema";
-    public static final String URI_2001_SCHEMA_XSD =
-            "http://www.w3.org/2001/XMLSchema";
-
-    public static final String URI_DEFAULT_SCHEMA_XSD = URI_2001_SCHEMA_XSD;
-
-    interface Java2WSDLConstants {
-        String OUTPUT_LOCATION_OPTION = "o";
-        String OUTPUT_FILENAME_OPTION = "of";
-        String CLASSNAME_OPTION = "cn";
-        String CLASSPATH_OPTION = "cp";
-        String TARGET_NAMESPACE_OPTION = "tn";
-        String TARGET_NAMESPACE_PREFIX_OPTION = "tp";
-        String SCHEMA_TARGET_NAMESPACE_OPTION = "stn";
-        String SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION = "stp";
-        String SERVICE_NAME_OPTION = "sn";
-        String STYLE_OPTION = "st";
-        String USE_OPTION = "u";
-        String LOCATION_OPTION = "l";
-
-        //long option constants
-        String OUTPUT_LOCATION_OPTION_LONG = "output";
-        String TARGET_NAMESPACE_OPTION_LONG = "targetNamespace";
-        String TARGET_NAMESPACE_PREFIX_OPTION_LONG = "targetNamespacePrefix";
-        String SERVICE_NAME_OPTION_LONG = "serviceName";
-        String CLASSNAME_OPTION_LONG = "className";
-        String CLASSPATH_OPTION_LONG = "classPath";
-        String OUTPUT_FILENAME_OPTION_LONG = "outputFilename";
-        String SCHEMA_TARGET_NAMESPACE_OPTION_LONG = "schemaTargetnamespace";
-        String SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG = "schemaTargetnamespacePrefix";
-        String STYLE_OPTION_LONG = "style";
-        String USE_OPTION_LONG = "use";
-        String LOCATION_OPTION_LONG = "location";
+    String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
 
 
-    }
+    String OUTPUT_LOCATION_OPTION = "o";
+    String OUTPUT_FILENAME_OPTION = "of";
+    String CLASSNAME_OPTION = "cn";
+    String CLASSPATH_OPTION = "cp";
+    String TARGET_NAMESPACE_OPTION = "tn";
+    String TARGET_NAMESPACE_PREFIX_OPTION = "tp";
+    String SCHEMA_TARGET_NAMESPACE_OPTION = "stn";
+    String SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION = "stp";
+    String SERVICE_NAME_OPTION = "sn";
+    String STYLE_OPTION = "st";
+    String USE_OPTION = "u";
+    String LOCATION_OPTION = "l";
+
+    //long option constants
+    String OUTPUT_LOCATION_OPTION_LONG = "output";
+    String TARGET_NAMESPACE_OPTION_LONG = "targetNamespace";
+    String TARGET_NAMESPACE_PREFIX_OPTION_LONG = "targetNamespacePrefix";
+    String SERVICE_NAME_OPTION_LONG = "serviceName";
+    String CLASSNAME_OPTION_LONG = "className";
+    String CLASSPATH_OPTION_LONG = "classPath";
+    String OUTPUT_FILENAME_OPTION_LONG = "outputFilename";
+    String SCHEMA_TARGET_NAMESPACE_OPTION_LONG = "schemaTargetnamespace";
+    String SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG = "schemaTargetnamespacePrefix";
+    String STYLE_OPTION_LONG = "style";
+    String USE_OPTION_LONG = "use";
+    String LOCATION_OPTION_LONG = "location";
+    String AXIS2_NAMESPACE_PREFIX = "ns1";
 
     public static final String SOLE_INPUT = "SOLE_INPUT";
 

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java Thu Mar 30 20:16:42 2006
@@ -26,7 +26,7 @@
 *
 */
 
-public class Java2WSDLTask extends Task implements Constants{
+public class Java2WSDLTask extends Task implements Java2WSDLConstants {
 
         private String className = null;
         private String outputLocation = null;

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java Thu Mar 30 20:16:42 2006
@@ -1,15 +1,15 @@
 package org.apache.ws.java2wsdl;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.ws.commons.schema.*;
 import org.apache.ws.java2wsdl.bytecode.MethodTable;
 import org.apache.ws.java2wsdl.utils.TypeTable;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
 import org.codehaus.jam.*;
 
 import javax.xml.namespace.QName;
-import java.util.Hashtable;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.Locale;
 
 /*
@@ -33,366 +33,360 @@
 
 public class SchemaGenerator {
     protected Log log = LogFactory.getLog(getClass());
-       private ClassLoader classLoader;
-       private String className;
-       private XmlSchema schema;
-       private TypeTable typeTable;
-       // to keep loadded method using JAM
-       private JMethod methods [];
-       //to store byte code method using Axis 1.x codes
-       private MethodTable methodTable;
-
-       public static String METHOD_RESPONSE_WRAPPER = "Response";
-       public static String TARGET_NAMESPACE = "http://org.apache.axis2/";
-       public static String SCHEMA_TARGET_NAMESPACE = "http://org.apache.axis2/xsd";
-       public static String SCHEMA_NAMESPACE_PRFIX = "ns1";
-       public static String TARGET_NAMESPACE_PREFIX = "tns";
-       private String schemaTargetNameSpace;
-       private String schema_namespace_prefix;
-
-       public SchemaGenerator(ClassLoader loader, String className,
-                              String schematargetNamespace,
-                              String schematargetNamespacePrefix)
-               throws Exception {
-           this.classLoader = loader;
-           this.className = className;
-//        TARGET_NAMESPACE = "http://" + className;
-           if (schematargetNamespace != null && !schematargetNamespace.trim().equals("")) {
-               this.schemaTargetNameSpace = schematargetNamespace;
-           } else {
-               this.schemaTargetNameSpace = SCHEMA_TARGET_NAMESPACE;
-           }
-           if (schematargetNamespacePrefix != null && !schematargetNamespacePrefix.trim().equals("")) {
-               this.schema_namespace_prefix = schematargetNamespacePrefix;
-           } else {
-               this.schema_namespace_prefix = SCHEMA_NAMESPACE_PRFIX;
-           }
-           Hashtable prefixmap = new Hashtable();
-           prefixmap.put(this.schema_namespace_prefix, this.schemaTargetNameSpace);
+    private ClassLoader classLoader;
+    private String className;
+    private XmlSchema schema;
+    private TypeTable typeTable;
+    // to keep loadded method using JAM
+    private JMethod methods [];
+    //to store byte code method using Axis 1.x codes
+    private MethodTable methodTable;
+
+    private String schemaTargetNameSpace;
+    private String schema_namespace_prefix;
+
+    public SchemaGenerator(ClassLoader loader, String className,
+                           String schematargetNamespace,
+                           String schematargetNamespacePrefix)
+            throws Exception {
+        this.classLoader = loader;
+        this.className = className;
+        if (schematargetNamespace != null && !schematargetNamespace.trim().equals("")) {
+            this.schemaTargetNameSpace = schematargetNamespace;
+        } else {
+            this.schemaTargetNameSpace = Java2WSDLConstants.AXIS2_XSD;
+        }
+        if (schematargetNamespacePrefix != null && !schematargetNamespacePrefix.trim().equals("")) {
+            this.schema_namespace_prefix = schematargetNamespacePrefix;
+        } else {
+            this.schema_namespace_prefix = Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX;
+        }
+        Hashtable prefixmap = new Hashtable();
+        prefixmap.put(this.schema_namespace_prefix, this.schemaTargetNameSpace);
 
-           XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
+        XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
 
-           schema = new XmlSchema(this.schemaTargetNameSpace, schemaCollection);
+        schema = new XmlSchema(this.schemaTargetNameSpace, schemaCollection);
 //        schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
-           schema.setPrefixToNamespaceMap(prefixmap);
-           this.typeTable = new TypeTable();
+        schema.setPrefixToNamespaceMap(prefixmap);
+        this.typeTable = new TypeTable();
 
-           Class clazz = Class.forName(className, true, loader);
-           methodTable = new MethodTable(clazz);
-       }
-
-       /**
-        * Generates schema for all the parameters in method. First generates schema
-        * for all different parameter type and later refers to them.
-        *
-        * @return Returns XmlSchema.
-        * @throws Exception
-        */
-       public XmlSchema generateSchema() throws Exception {
-
-           JamServiceFactory factory = JamServiceFactory.getInstance();
-           JamServiceParams jam_service_parms = factory.createServiceParams();
-           //setting the classLoder
+        Class clazz = Class.forName(className, true, loader);
+        methodTable = new MethodTable(clazz);
+    }
+
+    /**
+     * Generates schema for all the parameters in method. First generates schema
+     * for all different parameter type and later refers to them.
+     *
+     * @return Returns XmlSchema.
+     * @throws Exception
+     */
+    public XmlSchema generateSchema() throws Exception {
+
+        JamServiceFactory factory = JamServiceFactory.getInstance();
+        JamServiceParams jam_service_parms = factory.createServiceParams();
+        //setting the classLoder
 //        jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader));
-           //it can posible to add the classLoader as well
-           jam_service_parms.addClassLoader(classLoader);
-           jam_service_parms.includeClass(className);
-           JamService service = factory.createService(jam_service_parms);
-
-           JamClassIterator jClassIter = service.getClasses();
-           //all most all the time the ittr will have only one class in it
-           while (jClassIter.hasNext()) {
-               JClass jclass = (JClass) jClassIter.next();
-               // serviceName = jclass.getSimpleName();
-               //todo in the future , when we support annotation we can use this
-               //JAnnotation[] annotations = jclass.getAnnotations();
-
-               /**
-                * Schema genertaion done in two stage
-                *  1. Load all the methods and create type for methods parameters (if the parameters are
-                *     Bean then it will create Complex types for those , and if the parameters are simple
-                *     type which decribe in SimpleTypeTable nothing will happen)
-                *  2. In the next stage for all the methods messages and port types will be
-                *     creteated
-                */
-               methods = jclass.getDeclaredMethods();
-
-               // since we do not support overload
-               HashMap uniqueMethods = new HashMap();
-
-               for (int i = 0; i < methods.length; i++) {
-                   JMethod jMethod = methods[i];
-                   //no need to think abt this method , since that is system config method
-                   if (jMethod.getSimpleName().equals("init"))
-                       continue;
-                   if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
-                       throw new Exception(" Sorry we don't support methods overloading !!!! ");
-                   }
-
-                   if (!jMethod.isPublic()) {
-                       // no need to generate Schema for non public methods
-                       continue;
-                   }
-                   uniqueMethods.put(jMethod.getSimpleName(), jMethod);
+        //it can posible to add the classLoader as well
+        jam_service_parms.addClassLoader(classLoader);
+        jam_service_parms.includeClass(className);
+        JamService service = factory.createService(jam_service_parms);
+
+        JamClassIterator jClassIter = service.getClasses();
+        //all most all the time the ittr will have only one class in it
+        while (jClassIter.hasNext()) {
+            JClass jclass = (JClass) jClassIter.next();
+            // serviceName = jclass.getSimpleName();
+            //todo in the future , when we support annotation we can use this
+            //JAnnotation[] annotations = jclass.getAnnotations();
+
+            /**
+             * Schema genertaion done in two stage
+             *  1. Load all the methods and create type for methods parameters (if the parameters are
+             *     Bean then it will create Complex types for those , and if the parameters are simple
+             *     type which decribe in SimpleTypeTable nothing will happen)
+             *  2. In the next stage for all the methods messages and port types will be
+             *     creteated
+             */
+            methods = jclass.getDeclaredMethods();
+
+            // since we do not support overload
+            HashMap uniqueMethods = new HashMap();
+
+            for (int i = 0; i < methods.length; i++) {
+                JMethod jMethod = methods[i];
+                //no need to think abt this method , since that is system config method
+                if (jMethod.getSimpleName().equals("init"))
+                    continue;
+                if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
+                    throw new Exception(" Sorry we don't support methods overloading !!!! ");
+                }
+
+                if (!jMethod.isPublic()) {
+                    // no need to generate Schema for non public methods
+                    continue;
+                }
+                uniqueMethods.put(jMethod.getSimpleName(), jMethod);
 
-                   //it can easily get the annotations
+                //it can easily get the annotations
 //                jMethod.getAnnotations();
-                   JParameter [] paras = jMethod.getParameters();
-                   for (int j = 0; j < paras.length; j++) {
-                       JParameter methodParameter = paras[j];
-                       JClass paraType = methodParameter.getType();
-                       String classTypeName = paraType.getQualifiedName();
-                       if (paraType.isArrayType()) {
-                           classTypeName = paraType.getArrayComponentType().getQualifiedName();
-                           if (!typeTable.isSimpleType(classTypeName)) {
-                               generateSchema(paraType.getArrayComponentType());
-                           }
-                       } else {
-                           if (!typeTable.isSimpleType(classTypeName)) {
-                               generateSchema(methodParameter.getType());
-                           }
-                       }
-                       /**
-                        * 1. have to check whethet its a simple type
-                        * 2. then to check whther its a simple type array
-                        * 3. OM elemney
-                        * 4. Bean
-                        */
-
-                   }
-                   // for its return type
-                   JClass retuenType = jMethod.getReturnType();
-                   if (!retuenType.isVoidType()) {
-                       if (retuenType.isArrayType()) {
-                           String returnTypeName = retuenType.getArrayComponentType().getQualifiedName();
-                           if (!typeTable.isSimpleType(returnTypeName)) {
-                               generateSchema(retuenType.getArrayComponentType());
-                           }
-                       } else {
-                           if (!typeTable.isSimpleType(retuenType.getQualifiedName())) {
-                               generateSchema(retuenType);
-                           }
-                       }
-                   }
-
-               }
-               generateWrapperElements(methods);
-           }
-           return schema;
-       }
-
-       /**
-        * Generates wrapper element. If a method takes more than one parameter
-        * e.g. foo(Type1 para1, Type2 para2){} creates a Wrapper element like
-        * <element name="fooInParameter type="tns:fooInParameterElement"">
-        * <complexType name="fooInParameterElement">
-        * <sequnce>
-        * <element name="para1" type="tns:Type1">
-        * <element name="para2" type="tns:Type2">
-        * </sequnce>
-        * </complexType>
-        * </element>
-        */
-       private void generateWrapperElements(JMethod methods[]) {
-           for (int i = 0; i < methods.length; i++) {
-               JMethod method = methods[i];
-               if (method.getSimpleName().equals("init"))
-                   continue;
-               if (!method.isPublic())
-                   continue;
-               genereteWrapperElementforMethod(method);
-           }
-       }
-
-       private void genereteWrapperElementforMethod(JMethod method) {
-           String methodName = method.getSimpleName();
-           XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema);
-           XmlSchemaSequence sequence = new XmlSchemaSequence();
+                JParameter [] paras = jMethod.getParameters();
+                for (int j = 0; j < paras.length; j++) {
+                    JParameter methodParameter = paras[j];
+                    JClass paraType = methodParameter.getType();
+                    String classTypeName = paraType.getQualifiedName();
+                    if (paraType.isArrayType()) {
+                        classTypeName = paraType.getArrayComponentType().getQualifiedName();
+                        if (!typeTable.isSimpleType(classTypeName)) {
+                            generateSchema(paraType.getArrayComponentType());
+                        }
+                    } else {
+                        if (!typeTable.isSimpleType(classTypeName)) {
+                            generateSchema(methodParameter.getType());
+                        }
+                    }
+                    /**
+                     * 1. have to check whethet its a simple type
+                     * 2. then to check whther its a simple type array
+                     * 3. OM elemney
+                     * 4. Bean
+                     */
+
+                }
+                // for its return type
+                JClass retuenType = jMethod.getReturnType();
+                if (!retuenType.isVoidType()) {
+                    if (retuenType.isArrayType()) {
+                        String returnTypeName = retuenType.getArrayComponentType().getQualifiedName();
+                        if (!typeTable.isSimpleType(returnTypeName)) {
+                            generateSchema(retuenType.getArrayComponentType());
+                        }
+                    } else {
+                        if (!typeTable.isSimpleType(retuenType.getQualifiedName())) {
+                            generateSchema(retuenType);
+                        }
+                    }
+                }
+
+            }
+            generateWrapperElements(methods);
+        }
+        return schema;
+    }
+
+    /**
+     * Generates wrapper element. If a method takes more than one parameter
+     * e.g. foo(Type1 para1, Type2 para2){} creates a Wrapper element like
+     * <element name="fooInParameter type="tns:fooInParameterElement"">
+     * <complexType name="fooInParameterElement">
+     * <sequnce>
+     * <element name="para1" type="tns:Type1">
+     * <element name="para2" type="tns:Type2">
+     * </sequnce>
+     * </complexType>
+     * </element>
+     */
+    private void generateWrapperElements(JMethod methods[]) {
+        for (int i = 0; i < methods.length; i++) {
+            JMethod method = methods[i];
+            if (method.getSimpleName().equals("init"))
+                continue;
+            if (!method.isPublic())
+                continue;
+            genereteWrapperElementforMethod(method);
+        }
+    }
+
+    private void genereteWrapperElementforMethod(JMethod method) {
+        String methodName = method.getSimpleName();
+        XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema);
+        XmlSchemaSequence sequence = new XmlSchemaSequence();
 
-           XmlSchemaElement eltOuter = new XmlSchemaElement();
-           eltOuter.setName(methodName);
+        XmlSchemaElement eltOuter = new XmlSchemaElement();
+        eltOuter.setName(methodName);
 //        String complexTypeName = methodName + METHOD_REQUEST_WRAPPER;
 //        complexType.setName(complexTypeName);
-           schema.getItems().add(eltOuter);
+        schema.getItems().add(eltOuter);
 //        schema.getItems().add(complexType);
 //        eltOuter.setSchemaTypeName(complexType.getQName());
-           eltOuter.setSchemaType(complexType);
-           // adding this type to the table
-           QName elementName = new QName(this.schemaTargetNameSpace,
-                   eltOuter.getName(), this.schema_namespace_prefix);
-           typeTable.addComplexSchema(methodName, elementName);
-
-           JParameter [] paras = method.getParameters();
-           if (paras.length > 0) {
-               complexType.setParticle(sequence);
-           }
-           String parameterNames [] = null;
-           if (paras.length > 0) {
-               parameterNames = methodTable.getParameterNames(methodName);
-           }
-           for (int j = 0; j < paras.length; j++) {
-               JParameter methodParameter = paras[j];
-               String paraName = methodParameter.getSimpleName();
-               String classTypeName = methodParameter.getType().getQualifiedName();
-               boolean isArryType = methodParameter.getType().isArrayType();
-               if (isArryType) {
-                   classTypeName = methodParameter.getType().getArrayComponentType().getQualifiedName();
-               }
-
-               if (parameterNames != null) {
-                   paraName = parameterNames[j];
-               }
-
-               if (typeTable.isSimpleType(classTypeName)) {
-                   XmlSchemaElement elt1 = new XmlSchemaElement();
-                   elt1.setName(paraName);
-                   elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(classTypeName));
-                   sequence.getItems().add(elt1);
-                   if (isArryType) {
-                       elt1.setMaxOccurs(Long.MAX_VALUE);
-                       elt1.setMinOccurs(0);
-                   }
-               } else {
-                   XmlSchemaElement elt1 = new XmlSchemaElement();
-                   elt1.setName(paraName);
-                   elt1.setSchemaTypeName(typeTable.getComplexSchemaType(classTypeName));
-                   sequence.getItems().add(elt1);
-                   if (isArryType) {
-                       elt1.setMaxOccurs(Long.MAX_VALUE);
-                       elt1.setMinOccurs(0);
-                   }
-               }
-           }
-
-           //generating wrapper element for retuen element
-           JClass methodReturnType = method.getReturnType();
-           generateWrapperforReturnType(methodReturnType, methodName);
-
-       }
-
-       private void generateWrapperforReturnType(JClass retuenType, String methodName) {
-           if (!retuenType.isVoidType()) {
-               XmlSchemaComplexType retuen_com_type = new XmlSchemaComplexType(schema);
-               XmlSchemaElement ret_eltOuter = new XmlSchemaElement();
-               ret_eltOuter.setName(methodName + METHOD_RESPONSE_WRAPPER);
-               schema.getItems().add(ret_eltOuter);
-               ret_eltOuter.setSchemaType(retuen_com_type);
-               QName ret_comTypeName = new QName(this.schemaTargetNameSpace,
-                       ret_eltOuter.getName(), this.schema_namespace_prefix);
-               typeTable.addComplexSchema(methodName + METHOD_RESPONSE_WRAPPER, ret_comTypeName);
-               String classTypeName = retuenType.getQualifiedName();
-               boolean isArryType = retuenType.isArrayType();
-               XmlSchemaSequence sequence = new XmlSchemaSequence();
-               retuen_com_type.setParticle(sequence);
-               if (isArryType) {
-                   classTypeName = retuenType.getArrayComponentType().getQualifiedName();
-               }
-               if (typeTable.isSimpleType(classTypeName)) {
-                   XmlSchemaElement elt1 = new XmlSchemaElement();
-                   elt1.setName("return");
-                   elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(classTypeName));
-                   sequence.getItems().add(elt1);
-                   if (isArryType) {
-                       elt1.setMaxOccurs(Long.MAX_VALUE);
-                       elt1.setMinOccurs(0);
-                   }
-               } else {
-                   XmlSchemaElement elt1 = new XmlSchemaElement();
-                   elt1.setName("return");
-                   elt1.setSchemaTypeName(typeTable.getComplexSchemaType(classTypeName));
-                   sequence.getItems().add(elt1);
-                   if (isArryType) {
-                       elt1.setMaxOccurs(Long.MAX_VALUE);
-                       elt1.setMinOccurs(0);
-                   }
-               }
-           }
-       }
-
-       /**
-        * JAM convert first name of an attribute into UpperCase as an example
-        * if there is a instance variable called foo in a bean , then Jam give that as Foo
-        * so this method is to correct that error
-        *
-        * @param wrongName
-        * @return the right name, using english as the locale for case conversion
-        */
-       public static String getCorrectName(String wrongName) {
-           if (wrongName.length() > 1) {
-               return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH)
-                       + wrongName.substring(1, wrongName.length());
-           } else {
-               return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH);
-           }
-       }
-
-       private void generateSchema(JClass javaType) {
-           String name = javaType.getQualifiedName();
-           if (typeTable.getComplexSchemaType(name) == null) {
-               String simpleName = javaType.getSimpleName();
-
-               XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema);
-               XmlSchemaSequence sequence = new XmlSchemaSequence();
-
-               XmlSchemaElement eltOuter = new XmlSchemaElement();
-               QName elemntName = new QName(this.schemaTargetNameSpace, simpleName, this.schema_namespace_prefix);
-               eltOuter.setName(simpleName);
-               eltOuter.setQName(elemntName);
-               complexType.setParticle(sequence);
-               complexType.setName(simpleName);
-
-               schema.getItems().add(eltOuter);
-               schema.getItems().add(complexType);
-               eltOuter.setSchemaTypeName(complexType.getQName());
+        eltOuter.setSchemaType(complexType);
+        // adding this type to the table
+        QName elementName = new QName(this.schemaTargetNameSpace,
+                eltOuter.getName(), this.schema_namespace_prefix);
+        typeTable.addComplexSchema(methodName, elementName);
+
+        JParameter [] paras = method.getParameters();
+        if (paras.length > 0) {
+            complexType.setParticle(sequence);
+        }
+        String parameterNames [] = null;
+        if (paras.length > 0) {
+            parameterNames = methodTable.getParameterNames(methodName);
+        }
+        for (int j = 0; j < paras.length; j++) {
+            JParameter methodParameter = paras[j];
+            String paraName = methodParameter.getSimpleName();
+            String classTypeName = methodParameter.getType().getQualifiedName();
+            boolean isArryType = methodParameter.getType().isArrayType();
+            if (isArryType) {
+                classTypeName = methodParameter.getType().getArrayComponentType().getQualifiedName();
+            }
+
+            if (parameterNames != null) {
+                paraName = parameterNames[j];
+            }
+
+            if (typeTable.isSimpleType(classTypeName)) {
+                XmlSchemaElement elt1 = new XmlSchemaElement();
+                elt1.setName(paraName);
+                elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(classTypeName));
+                sequence.getItems().add(elt1);
+                if (isArryType) {
+                    elt1.setMaxOccurs(Long.MAX_VALUE);
+                    elt1.setMinOccurs(0);
+                }
+            } else {
+                XmlSchemaElement elt1 = new XmlSchemaElement();
+                elt1.setName(paraName);
+                elt1.setSchemaTypeName(typeTable.getComplexSchemaType(classTypeName));
+                sequence.getItems().add(elt1);
+                if (isArryType) {
+                    elt1.setMaxOccurs(Long.MAX_VALUE);
+                    elt1.setMinOccurs(0);
+                }
+            }
+        }
+
+        //generating wrapper element for retuen element
+        JClass methodReturnType = method.getReturnType();
+        generateWrapperforReturnType(methodReturnType, methodName);
+
+    }
+
+    private void generateWrapperforReturnType(JClass retuenType, String methodName) {
+        if (!retuenType.isVoidType()) {
+            XmlSchemaComplexType retuen_com_type = new XmlSchemaComplexType(schema);
+            XmlSchemaElement ret_eltOuter = new XmlSchemaElement();
+            ret_eltOuter.setName(methodName + Java2WSDLConstants.RESPONSE);
+            schema.getItems().add(ret_eltOuter);
+            ret_eltOuter.setSchemaType(retuen_com_type);
+            QName ret_comTypeName = new QName(this.schemaTargetNameSpace,
+                    ret_eltOuter.getName(), this.schema_namespace_prefix);
+            typeTable.addComplexSchema(methodName + Java2WSDLConstants.RESPONSE, ret_comTypeName);
+            String classTypeName = retuenType.getQualifiedName();
+            boolean isArryType = retuenType.isArrayType();
+            XmlSchemaSequence sequence = new XmlSchemaSequence();
+            retuen_com_type.setParticle(sequence);
+            if (isArryType) {
+                classTypeName = retuenType.getArrayComponentType().getQualifiedName();
+            }
+            if (typeTable.isSimpleType(classTypeName)) {
+                XmlSchemaElement elt1 = new XmlSchemaElement();
+                elt1.setName("return");
+                elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(classTypeName));
+                sequence.getItems().add(elt1);
+                if (isArryType) {
+                    elt1.setMaxOccurs(Long.MAX_VALUE);
+                    elt1.setMinOccurs(0);
+                }
+            } else {
+                XmlSchemaElement elt1 = new XmlSchemaElement();
+                elt1.setName("return");
+                elt1.setSchemaTypeName(typeTable.getComplexSchemaType(classTypeName));
+                sequence.getItems().add(elt1);
+                if (isArryType) {
+                    elt1.setMaxOccurs(Long.MAX_VALUE);
+                    elt1.setMinOccurs(0);
+                }
+            }
+        }
+    }
+
+    /**
+     * JAM convert first name of an attribute into UpperCase as an example
+     * if there is a instance variable called foo in a bean , then Jam give that as Foo
+     * so this method is to correct that error
+     *
+     * @param wrongName
+     * @return the right name, using english as the locale for case conversion
+     */
+    public static String getCorrectName(String wrongName) {
+        if (wrongName.length() > 1) {
+            return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH)
+                    + wrongName.substring(1, wrongName.length());
+        } else {
+            return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH);
+        }
+    }
+
+    private void generateSchema(JClass javaType) {
+        String name = javaType.getQualifiedName();
+        if (typeTable.getComplexSchemaType(name) == null) {
+            String simpleName = javaType.getSimpleName();
+
+            XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema);
+            XmlSchemaSequence sequence = new XmlSchemaSequence();
+
+            XmlSchemaElement eltOuter = new XmlSchemaElement();
+            QName elemntName = new QName(this.schemaTargetNameSpace, simpleName, this.schema_namespace_prefix);
+            eltOuter.setName(simpleName);
+            eltOuter.setQName(elemntName);
+            complexType.setParticle(sequence);
+            complexType.setName(simpleName);
+
+            schema.getItems().add(eltOuter);
+            schema.getItems().add(complexType);
+            eltOuter.setSchemaTypeName(complexType.getQName());
 //            System.out.println("QNAme: " + eltOuter.getQName().getPrefix());
 
-               // adding this type to the table
-               //  typeTable.addComplexScheam(name, complexType.getQName());
-               typeTable.addComplexSchema(name, eltOuter.getQName());
-
-               JProperty [] properties = javaType.getDeclaredProperties();
-               for (int i = 0; i < properties.length; i++) {
-                   JProperty property = properties[i];
-                   String propertyName = property.getType().getQualifiedName();
-                   boolean isArryType = property.getType().isArrayType();
-                   if (isArryType) {
-                       propertyName = property.getType().getArrayComponentType().getQualifiedName();
-                   }
-                   if (typeTable.isSimpleType(propertyName)) {
-                       XmlSchemaElement elt1 = new XmlSchemaElement();
-                       elt1.setName(getCorrectName(property.getSimpleName()));
-                       elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName));
-                       sequence.getItems().add(elt1);
-                       if (isArryType) {
-                           elt1.setMaxOccurs(Long.MAX_VALUE);
-                           elt1.setMinOccurs(0);
-                       }
-                   } else {
-                       if (isArryType) {
-                           generateSchema(property.getType().getArrayComponentType());
-                       } else {
-                           generateSchema(property.getType());
-                       }
-                       XmlSchemaElement elt1 = new XmlSchemaElement();
-                       elt1.setName(getCorrectName(property.getSimpleName()));
-                       elt1.setSchemaTypeName(typeTable.getComplexSchemaType(propertyName));
-                       sequence.getItems().add(elt1);
-                       if (isArryType) {
-                           elt1.setMaxOccurs(Long.MAX_VALUE);
-                           elt1.setMinOccurs(0);
-                       }
-                   }
-               }
-           }
-       }
-
-       public TypeTable getTypeTable() {
-           return typeTable;
-       }
-
-       public JMethod[] getMethods() {
-           return methods;
-       }
+            // adding this type to the table
+            //  typeTable.addComplexScheam(name, complexType.getQName());
+            typeTable.addComplexSchema(name, eltOuter.getQName());
+
+            JProperty [] properties = javaType.getDeclaredProperties();
+            for (int i = 0; i < properties.length; i++) {
+                JProperty property = properties[i];
+                String propertyName = property.getType().getQualifiedName();
+                boolean isArryType = property.getType().isArrayType();
+                if (isArryType) {
+                    propertyName = property.getType().getArrayComponentType().getQualifiedName();
+                }
+                if (typeTable.isSimpleType(propertyName)) {
+                    XmlSchemaElement elt1 = new XmlSchemaElement();
+                    elt1.setName(getCorrectName(property.getSimpleName()));
+                    elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName));
+                    sequence.getItems().add(elt1);
+                    if (isArryType) {
+                        elt1.setMaxOccurs(Long.MAX_VALUE);
+                        elt1.setMinOccurs(0);
+                    }
+                } else {
+                    if (isArryType) {
+                        generateSchema(property.getType().getArrayComponentType());
+                    } else {
+                        generateSchema(property.getType());
+                    }
+                    XmlSchemaElement elt1 = new XmlSchemaElement();
+                    elt1.setName(getCorrectName(property.getSimpleName()));
+                    elt1.setSchemaTypeName(typeTable.getComplexSchemaType(propertyName));
+                    sequence.getItems().add(elt1);
+                    if (isArryType) {
+                        elt1.setMaxOccurs(Long.MAX_VALUE);
+                        elt1.setMinOccurs(0);
+                    }
+                }
+            }
+        }
+    }
+
+    public TypeTable getTypeTable() {
+        return typeTable;
+    }
+
+    public JMethod[] getMethods() {
+        return methods;
+    }
 
-   }
+}
 

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOption.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOption.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOption.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOption.java Thu Mar 30 20:16:42 2006
@@ -1,6 +1,6 @@
 package org.apache.ws.java2wsdl.utils;
 
-import org.apache.ws.java2wsdl.Constants;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
 
 import java.util.ArrayList;
 /*
@@ -21,7 +21,7 @@
 *
 */
 
-public class Java2WSDLCommandLineOption implements Constants {
+public class Java2WSDLCommandLineOption implements Java2WSDLConstants {
 
     private String type;
        private ArrayList optionValues;

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java Thu Mar 30 20:16:42 2006
@@ -1,7 +1,7 @@
 package org.apache.ws.java2wsdl.utils;
 
 import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
-import org.apache.ws.java2wsdl.Constants;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
 
 import java.util.*;
 /*
@@ -22,7 +22,7 @@
 *
 */
 
-public class Java2WSDLCommandLineOptionParser implements Constants {
+public class Java2WSDLCommandLineOptionParser implements Java2WSDLConstants {
     private static int STARTED = 0;
     private static int NEW_OPTION = 1;
     private static int SUB_PARAM_OF_OPTION = 2;

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java Thu Mar 30 20:16:42 2006
@@ -1,7 +1,7 @@
 package org.apache.ws.java2wsdl.utils;
 
 import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
-import org.apache.ws.java2wsdl.Constants;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
 *
@@ -21,7 +21,7 @@
 *
 */
 
-public class Java2WSDLOptionsValidator implements Constants {
+public class Java2WSDLOptionsValidator implements Java2WSDLConstants {
     public boolean isInvalid(Java2WSDLCommandLineOption option) {
         boolean invalid;
         String optionType = option.getOptionType();

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/TypeTable.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/TypeTable.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/TypeTable.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/TypeTable.java Thu Mar 30 20:16:42 2006
@@ -1,7 +1,7 @@
 package org.apache.ws.java2wsdl.utils;
 
 import org.apache.axiom.om.OMElement;
-import org.apache.ws.java2wsdl.Constants;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
 
 import javax.xml.namespace.QName;
 import java.util.*;
@@ -36,56 +36,56 @@
     private void populateSimpleTypes() {
         //todo pls use the types from org.apache.ws.commons.schema.constants.Constants
         simpleTypetoxsd.put("int",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "int", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "int", "xs"));
         simpleTypetoxsd.put("java.lang.String",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "string", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "string", "xs"));
         simpleTypetoxsd.put("boolean",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "boolean", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "boolean", "xs"));
         simpleTypetoxsd.put("float",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "float", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "float", "xs"));
         simpleTypetoxsd.put("double",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "double", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "double", "xs"));
         simpleTypetoxsd.put("short",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "short", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "short", "xs"));
         simpleTypetoxsd.put("long",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "long", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "long", "xs"));
         simpleTypetoxsd.put("byte",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "byte", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "byte", "xs"));
         simpleTypetoxsd.put("char",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
         simpleTypetoxsd.put("java.lang.Integer",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "int", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "int", "xs"));
         simpleTypetoxsd.put("java.lang.Double",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "double", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "double", "xs"));
         simpleTypetoxsd.put("java.lang.Float",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "float", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "float", "xs"));
         simpleTypetoxsd.put("java.lang.Long",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "long", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "long", "xs"));
         simpleTypetoxsd.put("java.lang.Character",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
         simpleTypetoxsd.put("java.lang.Boolean",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "boolean", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "boolean", "xs"));
         simpleTypetoxsd.put("java.lang.Byte",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "byte", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "byte", "xs"));
         simpleTypetoxsd.put("java.lang.Short",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "short", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "short", "xs"));
         simpleTypetoxsd.put("java.util.Date",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "dateTime", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "dateTime", "xs"));
         simpleTypetoxsd.put("java.util.Calendar",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "dateTime", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "dateTime", "xs"));
 
         simpleTypetoxsd.put("java.lang.Object",
-                new QName(Constants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
 
         // Any types
         simpleTypetoxsd.put(OMElement.class.getName(),
-                new QName(Constants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
         simpleTypetoxsd.put(ArrayList.class.getName(),
-                new QName(Constants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
         simpleTypetoxsd.put(Vector.class.getName(),
-                new QName(Constants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
         simpleTypetoxsd.put(List.class.getName(),
-                new QName(Constants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
+                new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "anyType", "xs"));
     }
 
     public QName getSimpleSchemaTypeName(String typename) {