You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mirae-dev@ws.apache.org by da...@apache.org on 2005/02/03 13:41:12 UTC

svn commit: r151149 [9/19] - in webservices/mirae/trunk: ./ bin/ bin/linux/ bin/windows/ build/ docs/ docs/images/ docs/images/CVS/ docs/javadoc/ genstub/ genstub/example8/ genstub/lk/ genstub/lk/opensource/ genstub/lk/opensource/wsmobile/ genstub/org/ genstub/org/apache/ genstub/org/apache/mirae/ genstub/org/apache/mirae/builtin/ genstub/org/apache/mirae/builtin/simpletypes/ genstub/uk/ genstub/uk/co/ genstub/uk/co/dsdata/ genstub/uk/co/dsdata/ws/ genstub/uk/co/dsdata/ws/travel/ genstub/uk/co/dsdata/ws/travel/sbg/ genstub/uk/co/dsdata/ws/travel/sbg/SBGAirFareQuotes/ genstub/ws_mobile_point/ lib/ logs/ samples/ samples/documentsamples/ samples/documentsamples/calculator/ samples/documentsamples/calculator/calculator/ samples/documentsamples/calculator/calculator/axis/ samples/documentsamples/calculator/calculator/axis/localhost/ samples/documentsamples/calculator/org/ samples/documentsamples/calculator/org/apache/ samples/documentsamples/calculator/org/apache/mirae/ samples/documentsamples/calculator/org/apache/mirae/builtin/ samples/documentsamples/calculator/org/apache/mirae/builtin/simpletypes/ samples/documentsamples/echo/ samples/documentsamples/echo/org/ samples/documentsamples/echo/org/apache/ samples/documentsamples/echo/org/apache/mirae/ samples/documentsamples/echo/org/apache/mirae/builtin/ samples/documentsamples/echo/org/apache/mirae/builtin/simpletypes/ samples/documentsamples/echo/org/soapinterop/ samples/documentsamples/employee/ samples/documentsamples/employee/jSR172UseCases/ samples/documentsamples/employee/jSR172UseCases/com/ samples/documentsamples/employee/jSR172UseCases/com/sun/ samples/documentsamples/employee/jSR172UseCases/com/sun/www/ samples/documentsamples/employee/org/ samples/documentsamples/employee/org/apache/ samples/documentsamples/employee/org/apache/mirae/ samples/documentsamples/employee/org/apache/mirae/builtin/ samples/documentsamples/employee/org/apache/mirae/builtin/simpletypes/ samples/documentsamples/employee/xsd/ samples/documentsamples/employee/xsd/JSR172AppendixA/ samples/documentsamples/employee/xsd/JSR172AppendixA/com/ samples/documentsamples/employee/xsd/JSR172AppendixA/com/sun/ samples/documentsamples/employee/xsd/JSR172AppendixA/com/sun/www/ samples/rpcsamples/ samples/rpcsamples/airfarequote/ samples/rpcsamples/airfarequote/org/ samples/rpcsamples/airfarequote/org/apache/ samples/rpcsamples/airfarequote/org/apache/mirae/ samples/rpcsamples/airfarequote/org/apache/mirae/builtin/ samples/rpcsamples/airfarequote/org/apache/mirae/builtin/simpletypes/ samples/rpcsamples/airfarequote/uk/ samples/rpcsamples/airfarequote/uk/co/ samples/rpcsamples/airfarequote/uk/co/dsdata/ samples/rpcsamples/airfarequote/uk/co/dsdata/ws/ samples/rpcsamples/airfarequote/uk/co/dsdata/ws/travel/ samples/rpcsamples/airfarequote/uk/co/dsdata/ws/travel/sbg/ samples/rpcsamples/airfarequote/uk/co/dsdata/ws/travel/sbg/SBGAirFareQuotes/ samples/rpcsamples/calculator/ samples/rpcsamples/calculator/lk/ samples/rpcsamples/calculator/lk/opensource/ samples/rpcsamples/calculator/lk/opensource/wsmobile/ samples/rpcsamples/calculator/org/ samples/rpcsamples/calculator/org/apache/ samples/rpcsamples/calculator/org/apache/mirae/ samples/rpcsamples/calculator/org/apache/mirae/builtin/ samples/rpcsamples/calculator/org/apache/mirae/builtin/simpletypes/ samples/rpcsamples/distance/ samples/rpcsamples/distance/org/ samples/rpcsamples/distance/org/apache/ samples/rpcsamples/distance/org/apache/mirae/ samples/rpcsamples/distance/org/apache/mirae/builtin/ samples/rpcsamples/distance/org/apache/mirae/builtin/simpletypes/ samples/rpcsamples/distance/wsdl/ samples/rpcsamples/distance/wsdl/DistanceService/ samples/rpcsamples/distance/wsdl/DistanceService/sd/ samples/rpcsamples/distance/wsdl/DistanceService/sd/net/ samples/rpcsamples/distance/wsdl/DistanceService/sd/net/xmethods/ samples/rpcsamples/distance/wsdl/DistanceService/sd/net/xmethods/www/ samples/rpcsamples/point/ samples/rpcsamples/point/org/ samples/rpcsamples/point/org/apache/ samples/rpcsamples/point/org/apache/mirae/ samples/rpcsamples/point/org/apache/mirae/builtin/ samples/rpcsamples/point/org/apache/mirae/builtin/simpletypes/ samples/rpcsamples/point/ws_mobile_point/ samples/rpcsamples/student/ samples/rpcsamples/student/example8/ samples/rpcsamples/student/org/ samples/rpcsamples/student/org/apache/ samples/rpcsamples/student/org/apache/mirae/ samples/rpcsamples/student/org/apache/mirae/builtin/ samples/rpcsamples/student/org/apache/mirae/builtin/simpletypes/ src/ src/mirae/ src/mirae/jaxp/ src/mirae/jaxp/javax/ src/mirae/jaxp/javax/xml/ src/mirae/jaxp/javax/xml/parsers/ src/mirae/jaxp/org/ src/mirae/jaxp/org/apache/ src/mirae/jaxp/org/apache/mirae/ src/mirae/jaxp/org/apache/mirae/j2me/ src/mirae/jaxp/org/apache/mirae/j2me/xml/ src/mirae/jaxp/org/apache/mirae/j2me/xml/sax/ src/mirae/jaxp/org/xml/ src/mirae/jaxp/org/xml/sax/ src/mirae/jaxp/org/xml/sax/helpers/ src/mirae/jaxrpc/ src/mirae/jaxrpc/javax/ src/mirae/jaxrpc/javax/xml/ src/mirae/jaxrpc/javax/xml/namespace/ src/mirae/jaxrpc/javax/xml/rpc/ src/mirae/jaxrpc/org/ src/mirae/jaxrpc/org/apache/ src/mirae/jaxrpc/org/apache/mirae/ src/mirae/jaxrpc/org/apache/mirae/util/ src/mirae/jaxrpc/org/apache/mirae/xml/ src/mirae/jaxrpc/org/apache/mirae/xml/rpc/ src/tools/ src/tools/simpletypes/ src/tools/wsdl2ws_j2me/ src/tools/wsdl2ws_j2me/org/ src/tools/wsdl2ws_j2me/org/apache/ src/tools/wsdl2ws_j2me/org/apache/axis/ src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/ src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/ src/tools/wsdl2ws_j2me/org/apache/mirae/ src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/ src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/ src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/ src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/j2me/ src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/j2me/client/ src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/rpc/ tests/ tests/functional/ tests/functional/client/ tests/functional/client/SBGGetAirFareQuote-client1/ tests/functional/client/SBGGetAirFareQuote-client2/ tests/functional/client/calculator/ tests/functional/client/point/ tests/functional/client/wst/ tests/functional/wsdl/ tests/unit/ tests/unit/inmessage/ tests/unit/mirae/ tests/unit/outmessage/ tests/unit/wsdl2ws/ wsdl/ wsdltests/ wsdltests/calculator/ wsdltests/calculator/client/ wsdltests/calculator/server/ wsdltests/exceptiontest/ wsdltests/exceptiontest/client/ wsdltests/exceptiontest/server/ wsdltests/interoptestround1/ wsdltests/interoptestround1/client/ wsdltests/interoptestround1/server/

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WSDL2WsException.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WSDL2WsException.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WSDL2WsException.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WSDL2WsException.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+
+/**
+ * The <code>j2me.wsdl2ws.WSDL2WsException</code> is thrown from
+ * the core wsdl2ws j2me APIs to indicate an exception related to the
+ * wsdl2ws runtime.
+ *
+ * @author damitha kumarage (damitha@hsenid.lk, damitha@opensource.lk)
+ */
+public class WSDL2WsException extends RuntimeException {
+
+    /** Field cause */
+    Throwable cause;
+
+    /**
+     * Constructs a new exception with <code>null</code> as its
+     * detail message. The cause is not initialized.
+     */
+    public WSDL2WsException() {}
+
+    /**
+     * Constructs a new exception with the specified detail
+     * message.  The cause is not initialized.
+     *
+     * @param message The detail message which is later
+     *            retrieved using the getMessage method
+     */
+    public WSDL2WsException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a new exception with the specified detail
+     * message and cause.
+     *
+     * @param message The detail message which is later retrieved
+     *            using the getMessage method
+     * @param cause The cause which is saved for the later
+     *            retrieval throw by the getCause method
+     */
+    public WSDL2WsException(String message, Throwable cause) {
+
+        super(message);
+
+        this.cause = cause;
+    }
+
+    /**
+     * Constructs a new WSDL2WsException with the specified cause
+     * and a detail message of <tt>(cause==null ? null :
+     * cause.toString())</tt> (which typically contains the
+     * class and detail message of <tt>cause</tt>).
+     *
+     * @param cause The cause which is saved for the later
+     *            retrieval throw by the getCause method.
+     *            (A <tt>null</tt> value is permitted, and
+     *            indicates that the cause is nonexistent or
+     *          unknown.)
+     */
+    public WSDL2WsException(Throwable cause) {
+        this.cause = cause;
+    }
+
+    /**
+     * Gets the Linked cause
+     *
+     * @return The cause of this Exception or <code>null</code>
+     *     if the cause is noexistent or unknown
+     */
+    public Throwable getLinkedCause() {
+        return cause;
+    }
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WebServiceGenarator.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WebServiceGenarator.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WebServiceGenarator.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WebServiceGenarator.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+
+/**
+ * Abstract webservice Generator 
+ */
+public interface WebServiceGenarator {
+    public void genarate() throws WrapperFault;
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WebServiceGenaratorFactory.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WebServiceGenaratorFactory.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WebServiceGenaratorFactory.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WebServiceGenaratorFactory.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+
+import org.apache.mirae.wsdl2ws.doclit.DocLitWebServiceGenarator;
+import org.apache.mirae.wsdl2ws.info.WebServiceContext;
+import org.apache.mirae.wsdl2ws.rpc.RPCWebServiceGenarator;
+
+
+/**
+ * Create the concreate WebService Genarator depends on the options. 
+ */
+public class WebServiceGenaratorFactory {
+    public static WebServiceGenarator createWebServiceGenarator(WebServiceContext wscontext) {
+        if (wscontext.getWrapInfo().getWrapperStyle() == WrapperConstants.STYLE_RPC)
+            return new RPCWebServiceGenarator(wscontext);
+        if (wscontext.getWrapInfo().getWrapperStyle() == WrapperConstants.STYLE_DOCUMENT)
+		    return new DocLitWebServiceGenarator(wscontext);
+        return null;
+    }
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperConstants.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperConstants.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperConstants.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperConstants.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+
+public interface WrapperConstants {
+    public static final String DEFAULT_SIMPLETYPE_PACKAGE =
+        "org.apache.mirae.builtin.simpletypes.";
+    public static final String SCHEMA_NAMESPACE = "http://www.w3.org/2001/XMLSchema";
+    public static final String SOAPENC_NAMESPACE =
+        "http://schemas.xmlsoap.org/soap/encoding/";
+    //wsdl constants
+    public static final String ELEMENT_COMPLEX_TYPE = "ComplexType";
+    public static final String ELEMENT_SEQUENCE = "sequence";
+    public static final String ELEMENT_ALL = "all";
+    public static final String ELEMENT_ELEMENT = "element";
+
+    public static final String ATTRIBUTE_NAME = "name";
+    public static final String ATTRIBUTE_TYPE = "type";
+    //parameter type
+    public static final int INPUT_PARM = 0;
+    public static final int RETURN_PARM = 1;
+    public static final int COMMAN_PARM = 2;  
+    //service style 
+    public static final String STYLE_RPC = "rpc";
+    public static final String STYLE_DOCUMENT = "document";
+    public static final String STYLE_WRAPPED = "wrapped";
+    public static final String STYLE_MESSAGE = "message";
+
+    public static final String ENCODING_STYLE_SOAP =
+        "http://schemas.xmlsoap.org/soap/encoding/";
+
+    public static final String TRANSPORT_HTTP = "http://schemas.xmlsoap.org/soap/http";
+
+    public static final String DEFAULT_TARGET_ENDPOINT_URI = "http//127.0.0.1/8080";
+    //wrapper genarator type
+    
+    //j2me constants
+	public static final int GENERATOR_WRAPPER_J2ME = 39;
+	public static final int GENERATOR_CLIENT_WRAPPER_J2ME = 40;
+	public static final int GENERATOR_PARAM_J2ME = 41;
+	public static final int GENERATOR_SERVICE_J2ME = 42;
+	public static final int GENERATOR_STUB_LOCATOR_J2ME = 48;
+	public static final int GENERATOR_STUB_J2ME = 49;
+	public static final int GENERATOR_STUB_SERVICE_INTERFACE_J2ME = 50;
+
+    public static final int GENERATOR_DEPLOYMENT_DISCRIPTOR = 33;
+    public static final int GENERATOR_UNDEPLOYMENT_DISCRIPTOR = 34;
+	public static final int GENERATOR_DOCLIT_WRAPPER_JAVA = 35;
+	public static final int GENERATOR_DOCLIT_SERVICE_JAVA = 36;
+	public static final int GENERATOR_DOCLIT_PARAM_JAVA = 37;
+	public static final int GENERATOR_DOCLIT_STUB_JAVA = 38;
+    //implementation type
+    public static final String IMPL_STYLE_STRUCT = "struct";
+    public static final String IMPL_STYLE_VALUEORDER = "order";
+    public static final String IMPL_STYLE_SIMPLE = "simple";
+    
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperFault.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperFault.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperFault.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperFault.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+/**
+ * This is specialized exceptions .... 
+ */
+public class WrapperFault extends Exception {
+    public WrapperFault() {
+    }
+
+    public WrapperFault(String message) {
+        super(message);
+    }
+
+    public WrapperFault(String message, Throwable cause) {
+        super(message);
+    }
+
+    public WrapperFault(Throwable cause) {
+        super(cause.getMessage());
+    }
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperUtils.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperUtils.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperUtils.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WrapperUtils.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,295 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+
+
+import java.util.Enumeration;
+import java.util.Stack;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+
+import org.apache.mirae.wsdl2ws.info.ParameterInfo;
+import org.apache.mirae.wsdl2ws.info.Type;
+import org.apache.mirae.wsdl2ws.info.TypeMap;
+import org.apache.mirae.wsdl2ws.info.WebServiceContext;
+import org.apache.mirae.wsdl2ws.j2me.SimpleTypeWriter;
+
+
+/**
+ * Utility Classes 
+ */
+public class WrapperUtils {
+    private static int nscount = 0;
+    
+    /**
+     * translation fullyqualifiedname -> packagename
+     *      
+     * @param fullyQualifiedName
+     * @return
+     */     
+    public static String getPackegeName4QualifiedName(String fullyQualifiedName) {
+        int index = fullyQualifiedName.indexOf('.');
+        int lastIndex = 0;
+        while (index != -1) {
+            lastIndex = index;
+            index = fullyQualifiedName.indexOf('.', lastIndex + 1);
+        }
+        if (lastIndex == 0)
+            return fullyQualifiedName;
+
+        return fullyQualifiedName.substring(0, lastIndex);
+
+    }
+
+    /**
+     * extract the parameter name from the fully qualified name
+     * @param fullyQualifiedName
+     * @return only the class name 
+     */
+    public static String getClassNameFromFullyQualifiedName(String fullyQualifiedName) {
+        int index = fullyQualifiedName.indexOf('.');
+        int lastIndex = 0;
+        while (index != -1) {
+            lastIndex = index;
+            index = fullyQualifiedName.indexOf('.', lastIndex + 1);
+        }
+        if (lastIndex == 0)
+            return fullyQualifiedName;
+
+        return fullyQualifiedName.substring(lastIndex + 1);
+    }
+
+    /**
+     *  get classpart of the class and if name happen to be a Simple type return 
+     *  the Wrapper Class name(service.0 wrapper class name) eg int -> Int ect
+     *  @deprecated this method is not required and should be removed 
+     */
+    public static String getWrapperClassName4QualifiedName(String fullyQualifiedName) {
+        String classname = getClassNameFromFullyQualifiedName(fullyQualifiedName);
+        String paramclass;
+        if (classname.equals("boolean")) {
+            paramclass = "Boolean";
+        } else if (classname.equals("byte")) {
+            paramclass = "Byte";
+        } else if (classname.equals("char")) {
+            paramclass = "Char";
+        } else if (classname.equals("short")) {
+            paramclass = "Short";
+        } else if (classname.equals("int")) {
+            paramclass = "Int";
+        } else if (classname.equals("long")) {
+            paramclass = "Long";
+        } else if (classname.equals("float")) {
+            paramclass = "Float";
+        } else if (classname.equals("double")) {
+            paramclass = "Double";
+        } else
+            paramclass = classname;
+        return paramclass;
+    }
+
+    /**
+     * Capitalize the first Character of a given String. 
+     * @param value String 
+     * @return changed String 
+     */
+    public static String capitalizeFirstCaractor(String value) {
+        char[] chars = value.toCharArray();
+        chars[0] = Character.toUpperCase(value.charAt(0));
+        return new String(chars);
+    }
+    /**
+     * Take the first character to lower case 
+     * @param value
+     * @return string first charactor is in lowercse.
+     */
+    public static String firstCharacterToLowercase(String value) {
+        char[] chars = value.toCharArray();
+        chars[0] = Character.toLowerCase(value.charAt(0));
+        return new String(chars);
+    }
+
+    /**
+     * Method for getting wrappername for simple types
+     * @param fullyQualifiedName
+     * @param wscontext
+     * @return
+     */
+    public static String getWrapperName4FullyQualifiedName(String fullyQualifiedName,WebServiceContext wscontext) {
+        //this means it is one of the wrappers so no need to change the name 
+        if (fullyQualifiedName.startsWith("org.apache.mirae.builtin.simpletypes")){
+        	SimpleTypeWriter.copyClass(fullyQualifiedName,wscontext);
+        	return fullyQualifiedName;
+            }
+        if ("byte[]".equals(fullyQualifiedName)){
+        	SimpleTypeWriter.copyClass(WrapperConstants.DEFAULT_SIMPLETYPE_PACKAGE + "ByteArrayParam",wscontext);
+            return WrapperConstants.DEFAULT_SIMPLETYPE_PACKAGE + "ByteArrayParam";
+        }
+        //if simple type capitalize firstcharactor and add param
+        if (TypeMap.isSimpleType(fullyQualifiedName)){
+        	SimpleTypeWriter.copyClass(WrapperConstants.DEFAULT_SIMPLETYPE_PACKAGE
+                    + capitalizeFirstCaractor(
+                            getClassNameFromFullyQualifiedName(fullyQualifiedName))
+                        + "Param",wscontext);
+            return WrapperConstants.DEFAULT_SIMPLETYPE_PACKAGE
+                + capitalizeFirstCaractor(
+                    getClassNameFromFullyQualifiedName(fullyQualifiedName))
+                + "Param";
+            }
+        else
+            return fullyQualifiedName;
+    }
+    
+    /**
+     * This return the string that represents the xsi type using the QName  
+     * e.g. xsi:type ="xsd:int"
+     * @return String represents the xsi type 
+     */
+    public static String getParamTypeString(QName name) {
+        nscount++;
+        return " xsi:type=\\\"ns"
+            + nscount
+            + ":"
+            + name.getLocalPart()
+            + "\\\"  xmlns:ns"
+            + nscount
+            + " = \\\""
+            + name.getNamespaceURI()
+            + "\\\"";
+    }
+
+    /**
+     * create package name using name space URI
+     * @param nsuri
+     * @return
+     */
+    public static String nsURI2packageName(String nsuri) {
+        int index;
+
+        //gard agien if nsuri is urn | http and nothing return		
+        if (("urn".equals(nsuri) || "http".equals(nsuri)))
+            return nsuri;
+
+        StringTokenizer tokenizer = new StringTokenizer(nsuri, ":/.", false);
+        String token;
+        Stack stack = new Stack();
+
+        //first ine may be urn: or http: remove it
+        if (tokenizer.hasMoreTokens()) {
+            token = tokenizer.nextToken();
+            if (!("urn".equals(token) || "http".equals(token)))
+                stack.push(token);
+        }
+
+        while (tokenizer.hasMoreTokens()) {
+            token = tokenizer.nextToken();
+            if (!(token == null || "".equals(token))) {
+                char c = token.charAt(0);
+                //if name start with a number add _ to the name 
+                if (c == '0'
+                    || c == '1'
+                    || c == '2'
+                    || c == '3'
+                    || c == '4'
+                    || c == '5'
+                    || c == '6'
+                    || c == '7'
+                    || c == '8'
+                    || c == '9')
+                    token = "_" + token;
+
+                stack.push(token);
+            }
+
+        }
+
+        // create the String from the stack
+        StringBuffer buff = new StringBuffer(150);
+        if (!stack.isEmpty())
+            buff.append((String) stack.pop());
+        while (!stack.isEmpty()) {
+            buff.append('.');
+            buff.append((String) stack.pop());
+
+        }
+
+        String changednsuri = buff.toString();
+        //remove any unexpected charactors		
+        changednsuri = changednsuri.replaceAll("[^(a-zA-z0-9|.|_)]", "_");
+        return changednsuri;
+    }
+
+    /**
+     * get the class name given a ParameterInfo. 
+     * if the type is not a array type it returns the language Name.
+     * if the type is a array type it returns a array e.g. int[] lang.String[]
+     * @param param
+     * @param wscontext
+     * @return
+     * @throws WrapperFault
+     */
+    public static String getClassNameFromParamInfoConsideringArrays(
+        ParameterInfo param,
+        WebServiceContext wscontext)
+        throws WrapperFault {
+        if (param == null)
+            return "void";
+        Type type = param.getType();
+        if (type != null && type.isArray()) {
+            Enumeration e = type.getElementnames();
+            
+            if (e.hasMoreElements()) {
+ 
+                Type t = type.getElementForElementName((String) e.nextElement()).getType();
+				QName qname = t.getName();
+                String name;
+
+                if (t != null)
+                    name = t.getLanguageSpecificName() + "[]";
+                else {                    
+                    name = TypeMap.getBasicTypeClass4qname(qname) + "[]";
+                   
+                    if (name == null)
+                        throw new WrapperFault(
+                            "if not inbuild or not in type map what is this type "
+                                + qname);
+                }
+                return name;
+            } else
+                throw new WrapperFault("enumeration no type is given ?????");
+        } else
+            return type.getLanguageSpecificName();
+    }
+    
+    /**
+     * Method for getting the array type for an array element
+     * @param type
+     * @return
+     * @throws WrapperFault
+     */
+    public static Type getArrayType(Type type)throws WrapperFault{
+    	if(!type.isArray())
+    		return null;
+    	Enumeration elements = type.getElementnames();
+    	if(elements.hasMoreElements()){
+    		return type.getElementForElementName(
+    			(String)elements.nextElement()).getType();
+    	}
+    	throw new WrapperFault("Array type do not have any attibutes");
+    }
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/AllDocLitParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/AllDocLitParamWriter.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/AllDocLitParamWriter.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/AllDocLitParamWriter.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws.doclit;
+
+
+import java.util.Iterator;
+
+import org.apache.mirae.wsdl2ws.SourceWriter;
+import org.apache.mirae.wsdl2ws.WrapperConstants;
+import org.apache.mirae.wsdl2ws.WrapperFault;
+import org.apache.mirae.wsdl2ws.info.Type;
+import org.apache.mirae.wsdl2ws.info.TypeMap;
+import org.apache.mirae.wsdl2ws.info.WebServiceContext;
+
+
+
+/**
+ * Geberates all parmeter classes for document literal web service.
+ */
+public class AllDocLitParamWriter implements SourceWriter {
+
+	private WebServiceContext wscontext;
+
+		public AllDocLitParamWriter(WebServiceContext wscontext) {			
+			this.wscontext = wscontext;
+		}
+
+		/**
+		 * Calls the DocLit BeanParam writer for all parameters.		
+		 * 
+		 * @throws WrapperFault 		 
+		 */
+		public void writeSource() throws WrapperFault {
+						
+			Iterator allTypes = wscontext.getTypemap().getTypes().iterator();
+			String generator = wscontext.getWrapInfo().getImplStyle();
+			Type type;
+        
+			while (allTypes.hasNext()) {
+				try {
+					type = (Type) allTypes.next();	
+					
+					System.out.println("\n**"+type.getName());
+					if(TypeMap.isSimpleType(type.getName()))
+						System.out.println("\t+++++++++++++ simple type met ");						
+										
+					if (wscontext.getWrapInfo().getImplStyle().equals(WrapperConstants.IMPL_STYLE_STRUCT)) {
+						System.out.println("\t+++++++++++++ IMPL_STYLE_STRUCT type met ");
+						
+						if(type.getEnumerationdata() != null){
+                             System.out.println("\tEnumeration not supported yet ... in docLit");                   
+
+						} else if (!type.isArray()) {
+							System.out.println("\tDocLitBeanWriter is called ......");
+							(new DocLitBeanWriter(wscontext, type)).writeSource();
+						}
+				    
+				    }
+				} catch (Exception e) {
+					System.out.println(
+						"Error occured yet we continue to genarate other classes ... you should check the error");
+					e.printStackTrace();
+				}
+			} 
+		}
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitBeanWriter.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitBeanWriter.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitBeanWriter.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitBeanWriter.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,913 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws.doclit;
+
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+import javax.xml.namespace.QName;
+
+import org.apache.mirae.wsdl2ws.WrapperFault;
+import org.apache.mirae.wsdl2ws.WrapperUtils;
+import org.apache.mirae.wsdl2ws.info.ElementInfo;
+import org.apache.mirae.wsdl2ws.info.Type;
+import org.apache.mirae.wsdl2ws.info.TypeMap;
+import org.apache.mirae.wsdl2ws.info.WebServiceContext;
+import org.apache.mirae.wsdl2ws.j2me.JavaClassWriterJ2ME;
+import org.apache.mirae.wsdl2ws.j2me.JavaUtilsJ2ME;
+
+
+
+/**
+ * 
+ * Handles the deserialization and serialization of in and out parameters.  
+ *
+ */
+public class DocLitBeanWriter extends JavaClassWriterJ2ME {
+    WebServiceContext wscontext;
+    Type type; // type of this param
+    String[][] attribs;
+
+  	public DocLitBeanWriter(WebServiceContext wscontext, Type type) throws WrapperFault {
+		super(WrapperUtils.getPackegeName4QualifiedName(type.getLanguageSpecificName()),
+            WrapperUtils.getClassNameFromFullyQualifiedName(
+                type.getLanguageSpecificName()),wscontext.getWrapInfo().getTargetOutputLocation());
+        this.wscontext = wscontext;
+        this.type = type;
+        if (type.isArray())
+            throw new WrapperFault("I am doclit in, out param writer. I do not write arrays");
+
+        this.attribs =
+				 this.getAttribList(wscontext.getSerInfo().getQualifiedServiceName());
+    }
+  	  	
+
+    /**
+    	  * This method handle the logic of deserialization.
+    	  * @throws WrapperFault
+    	  */
+    public void writeDesireializeCode() throws WrapperFault {
+        try {
+            if (attribs.length == 0) {
+                //nothing to print if this is simple type we have inbuild types
+                System.out.println(
+                    "possible error calss with no attributes....................");
+                return;
+            }
+          
+            //if part
+            writer.write(
+                "\t\t\t\tif(qName.equals(\""
+                    + attribs[0][0]
+                    + "\")) {\n");            
+            
+            Type t;
+
+            if (TypeMap.isSimpleType(attribs[0][1])) {
+                if (JavaUtilsJ2ME.isUnwrapperdSimpleType(attribs[0][1]))
+                    writer.write(
+                        "\t\t\t\t\tthis."
+                            + attribs[0][0]
+                            + "= new "
+                            + WrapperUtils.getWrapperName4FullyQualifiedName(
+                                attribs[0][1],this.wscontext)
+                            + "(value).getParam();\n");
+                else {
+                    writer.write(
+                        "\t\t\t\t\tthis."
+                            + attribs[0][0]
+                            + "= new "
+                            + WrapperUtils.getWrapperName4FullyQualifiedName(
+                                attribs[0][1],this.wscontext)
+							+ "(value).getParam();\n");
+                }
+            } else if (attribs[0][1].endsWith("[]")) {
+            	String attrib = attribs[0][1].substring(0,attribs[0][1].indexOf('['));
+            	boolean isSimpleType=false;
+            	
+            	if (TypeMap.isSimpleType(attrib)){
+            		isSimpleType=true;
+            	}
+            	 	
+            	 
+            	 if(!isSimpleType){
+            	 	writer.write(
+                            "\t\t\t\t\t\t\t return;\n");   
+            	 }
+            	 
+            	 else{
+            	 	writer.write(
+                            "\t\t\t\t\t\t\tthis."
+                                + attribs[0][0]
+								+ "["
+				    			+ attribs[0][0]+"length-1]= new "
+                                +WrapperUtils.getWrapperName4FullyQualifiedName(
+                                        attrib,this.wscontext)                        
+                                + "(value).getParam();\n");            	 	
+            	 }
+            	      	
+            	
+                
+            } else {         
+                writer.write(
+                    "\t\t\t\t\t return;\n");               
+
+            }
+
+            //else if part
+            for (int i = 1; i < attribs.length; i++) {
+                writer.write(
+                    "\t\t\t\t}else if (qName.equals(\""
+                        + attribs[i][0]
+                        + "\")) {\n");
+                if (TypeMap.isSimpleType(attribs[i][1])) {
+                    if (JavaUtilsJ2ME.isUnwrapperdSimpleType(attribs[i][1]))
+                        writer.write(
+                            "\t\t\t\t\tthis."
+                                + attribs[i][0]
+                                + "= new "
+                                + WrapperUtils.getWrapperName4FullyQualifiedName(
+                                    attribs[i][1],this.wscontext)
+								+ "(value).getParam();\n");
+                    else
+                        writer.write(
+                            "\t\t\t\t\tthis."
+                                + attribs[i][0]
+                                + "= new "
+                                + WrapperUtils.getWrapperName4FullyQualifiedName(
+                                    attribs[i][1],this.wscontext)
+								+ "(value).getParam();\n");
+                } else if (attribs[i][1].endsWith("[]")) {
+                	String attrib = attribs[i][1].substring(0,attribs[i][1].indexOf('['));
+                	                	
+                	boolean isSimpleType=false;
+                	
+                	if (TypeMap.isSimpleType(attrib)){
+                		isSimpleType=true;
+                	}
+                	
+                	 if(!isSimpleType){
+                	 	writer.write(
+                                "\t\t\t\t\t\t\t return;\n");
+                    }
+                	 
+                	 else{
+                	 	writer.write(
+                                "\t\t\t\t\t\t\tthis."
+                                    + attribs[i][0]
+    								+ "["
+    				    			+ attribs[i][0]+"length-1]= new "
+                                    +WrapperUtils.getWrapperName4FullyQualifiedName(
+                                            attrib,this.wscontext)                        
+                                    + "(value).getParam();\n");            	 	
+                	 }
+                	 
+                	 writer.write(
+                     "\t\t\t\t\t\t}\n");
+                } else {
+                    writer.write(
+                        "\t\t\t\t\t return;\n");                 
+
+                }
+            }
+            //end of conditions
+            writer.write(
+                "\t\t\t\t}else if (childObj!=null)\n\t\t\t\t\t  childObj.decode(uri,localName,qName,attributes,value);\n");
+           
+            writer.write(
+            "\t\t\t\telse\n\t\t\t\t\t\t throw new SAXException(\"unknown tag find \"+ qName);\n");
+       
+            
+            writer.write("\t\t}\n");
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new WrapperFault(e);
+        }
+
+    }
+    
+    /**
+     * This method is not be used in doc literal parameters    
+     */
+    public void writeEndElementCode() throws WrapperFault {       
+    }
+    
+    /**
+       * This method handle the logic of serialization.
+       * @throws WrapperFault
+       */
+    public void writeSerialieCode() throws WrapperFault {
+        try {
+            if (attribs.length == 0) {
+                //nothing to print if this is simple type we have inbuild types
+                System.out.println(
+                    "possible error calss with no attributes....................");
+                return;
+            }
+
+            writer.write("\t\t//write the parameters\n\n");
+            for (int i = 0; i < attribs.length; i++) {
+                
+                Type t;
+                boolean check4null;// = !JavaUtilsJ2ME.isJavaSimpleType(attribs[i][1]);
+                
+                if (TypeMap.isSimpleType(attribs[i][1])) {
+                    //for simple type
+                	check4null = !JavaUtilsJ2ME.isJavaSimpleType(attribs[i][1]);
+                    writer.write(
+							"\t\tbuffer.append(\"<" + attribs[i][0] + ">\");\n");
+                    writer.write(
+                        check4null
+                            ? "\t\tif(this." + attribs[i][0] + "!=null)\n"
+                            : "");
+                    if (JavaUtilsJ2ME.isUnwrapperdSimpleType(attribs[i][1]))
+                        writer.write(
+                            "\t\t\tbuffer.append(String.valueOf("
+                                + attribs[i][0]
+                                + ".getParam()));\n");
+                    else
+                        writer.write(
+                            "\t\t\tbuffer.append(String.valueOf("
+                                + attribs[i][0]
+                                + "));\n");
+                    writer.write(
+							"\t\tbuffer.append(\"</" + attribs[i][0] + ">\");\n");
+
+                } else if (attribs[i][1].endsWith("[]")) { 
+
+                	String attrib = attribs[i][1].substring(0,attribs[i][1].indexOf('['));
+                	check4null = !JavaUtilsJ2ME.isJavaSimpleType(attrib);
+                	
+                    writer.write("\t\tfor (int i = 0; i <"+ attribs[i][0]+".length; i++) {\n");  
+                    
+                    writer.write(
+    						"\t\tbuffer.append(\"<" + attribs[i][0] + ">\");\n");
+                    writer.write(
+                        check4null
+                            ? "\t\tif(this."+attribs[i][0]+"[i]!=null){\n"
+                            : "");
+
+                   
+                	
+                    if(!TypeMap.isSimpleType(attrib)){                    
+                    	writer.write("\t\t\t"+ attribs[i][0]+"[i].serialize(buffer);\n");
+                    
+                    }else if (JavaUtilsJ2ME.isUnwrapperdSimpleType(attrib)){
+                        writer.write(
+                                "\t\t\tbuffer.append(String.valueOf("
+                                    + attribs[i][0]
+                                    + "[i].getParam()));\n");
+                    }else{
+	                    writer.write(
+	                        "\t\t\tbuffer.append(String.valueOf("
+	                            + attribs[i][0]
+	                            + "[i]));\n");
+                    }
+                   
+                    writer.write(
+    						"\t\tbuffer.append(\"</" + attribs[i][0] + ">\\n\");\n");
+                 
+                    writer.write(check4null ? "\t\t}\n" : "");
+                    writer.write("\t}\n");
+                    
+                
+                } else {
+                    //for complex type 
+                	check4null = !JavaUtilsJ2ME.isJavaSimpleType(attribs[i][1]);
+                    writer.write(
+							"\t\tbuffer.append(\"<" + attribs[i][0] + ">\");\n");
+                    writer.write(
+                        check4null
+                            ? "\t\tif(this." + attribs[i][0] + "!=null)\n"
+                            : "");
+                    	writer.write("\t\t\t" + attribs[i][0] + ".serialize(buffer);\n");                    	
+                    	
+                        writer.write(
+        						"\t\tbuffer.append(\"</" + attribs[i][0] + ">\\n\");\n\n");
+                   
+                }
+            }
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new WrapperFault(e);
+        }
+    }
+
+    /**
+     * returns implementation part
+     */
+    protected String getimplementsPart() {
+        return " implements org.apache.mirae.xml.rpc.InOutParameter";
+    }
+
+    /**
+     * this method writes the comments in the generated param class
+     */
+    protected void writeClassComment() throws WrapperFault {
+        try {
+			  writer.write("/**\n * <p>This class is genarated by the tool WSDL2WS_J2ME.\n" +
+				  " * It take care of the serialization and the desirialization of\n" +
+				  " * the in and out parameters of document literal web service.\n" +
+				  " */ \n");
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new WrapperFault(e);
+        }
+    }
+
+    /**
+     * this method writes the import statement
+     */
+    protected void writeImportStatements() throws WrapperFault {
+        try {
+			writer.write("import org.apache.mirae.xml.rpc.InOutParameter;\n");			
+			writer.write("import org.xml.sax.Attributes;\n");
+            writer.write("import org.xml.sax.SAXException;\n");
+			
+        } catch (IOException e) {
+            throw new WrapperFault(e);
+        }
+    }
+
+    /**
+     * method for writing attributes
+     */
+    protected void writeAttributes() throws WrapperFault {
+        try {
+        	writer.write("\tprivate org.apache.mirae.xml.rpc.InOutParameter childObj;\n");
+         	 
+            for (int i = 0; i < attribs.length; i++) {
+                
+                writer.write(
+                    "\tprivate " + attribs[i][1] + " " + attribs[i][0] + ";\n");
+                
+                if(attribs[i][1].endsWith("[]")){
+                	 writer.write("\tprivate int "+ attribs[i][0] + "length=0;\n");
+                }
+            }
+                              
+            writer.write("\n");
+        } catch (IOException e) {
+            throw new WrapperFault(e);
+        }
+    }
+    
+    /**
+     * method for writing constructor
+     */
+    protected void writeConstructors() throws WrapperFault {
+        try {
+        	       	
+            if (attribs.length > 0) {
+                writer.write(
+                    "\tpublic "
+                        + WrapperUtils.getClassNameFromFullyQualifiedName(
+                            type.getLanguageSpecificName())
+                        + "(){\n");
+
+                writer.write("\t}\n");
+            }
+            writeAttributesConstructor();
+            writer.write("\n");
+        } catch (IOException e) {
+            throw new WrapperFault(e);
+        }
+    }
+    
+    /**
+     * This method calls all other methods for writing dofferent methods
+     */
+    protected void writeMethods() throws WrapperFault {
+        try {
+            writer.write("\n");
+            writeDesirializeMethod();
+            writer.write("\n");
+            writeEndElementMethod();
+            writer.write("\n");
+            writeStartElementMethod();
+            writer.write("\n");
+            writeCreateArrayMethod();
+            writer.write("\n");
+            writeSerializeMethod();
+            writer.write("\n");
+            writeGettersAndSetter();
+            //writeEqual();
+        } catch (IOException e) {
+            throw new WrapperFault(e);
+        }
+    }
+
+    /**
+     * calls writeDesireializeCode method
+     * @throws WrapperFault
+     */
+    public void writeDesirializeMethod() throws WrapperFault {
+        try {
+            writer.write(
+                "\tpublic void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {\n");
+            this.writeDesireializeCode();
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new WrapperFault(e);
+        }
+
+    }
+    
+    /**
+     * calls writeEndElementCode method
+     * @throws WrapperFault
+     */
+    public void writeEndElementMethod() throws WrapperFault {
+        try {
+            writer.write(
+                "\tpublic void endElement(String uri, String localName, String qName) throws SAXException {\n");
+            this.writeEndElementCode();
+            writer.write("\t}\n");
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new WrapperFault(e);
+        }
+
+    }
+
+    /**
+     * calls writeSerialieCode method
+     * @throws WrapperFault
+     */
+    public void writeSerializeMethod() throws WrapperFault {
+        try {
+            writer.write(
+                "\tpublic void serialize(StringBuffer buffer)throws java.io.IOException, Exception{\n");
+            this.writeSerialieCode();
+            writer.write("\t}\n");
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new WrapperFault(e);
+        }
+    }
+    
+    /**
+     * calls writeCreateArrayCode
+     * @throws WrapperFault
+     */
+    public void writeCreateArrayMethod() throws WrapperFault {
+        try {
+            writer.write(
+                "\tpublic void createArray() throws SAXException {\n");
+            this.writeCreateArrayCode();
+            writer.write("\t}\n");
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new WrapperFault(e);
+        }
+    }
+    
+    /**
+     * calls writeStartElementCode method
+     * @throws WrapperFault
+     */
+    public void writeStartElementMethod() throws WrapperFault {
+        try {
+            writer.write(
+                "\tpublic void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {\n");
+            this.writeStartElementCode();
+            writer.write("\t}\n");
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new WrapperFault(e);
+        }
+    }
+
+    /** genarate the arrtibs into an array 
+     * Odd numbers for names.
+     * Even numbers for types.
+     * */
+    public String[][] getAttribList(String Qualifiedname) throws WrapperFault {
+        String[][] attribs;
+        ArrayList attribfeilds = new ArrayList();
+        ArrayList elementfeilds = new ArrayList();
+
+        //this is for encoded stuff afford to consider the 
+        //attributes and elemnts equal
+
+        Enumeration names = type.getAttributeNames();
+        while (names.hasMoreElements()) {
+            attribfeilds.add(names.nextElement());
+        }
+        names = type.getElementnames();
+        while (names.hasMoreElements()) {
+            elementfeilds.add(names.nextElement());
+        }
+
+        //get all the fields
+
+        attribs = new String[attribfeilds.size() + elementfeilds.size()][];
+        for (int i = 0; i < attribfeilds.size(); i++) {
+            attribs[i] = new String[7];
+            attribs[i][0] = ((String) attribfeilds.get(i));
+
+            Type t = type.getTypForAttribName(attribs[i][0]);            
+            attribs[i][1] = t.getLanguageSpecificName();           
+            
+            QName name = t.getName();
+
+            attribs[i][2] = name.getNamespaceURI();
+            attribs[i][3] = name.getLocalPart();
+            attribs[i][4] = attribs[i][1];
+            attribs[i][5] = null;
+            attribs[i][6] = null;
+        }
+
+        
+		  for (int i = attribfeilds.size(); i < attribfeilds.size()+elementfeilds.size(); i++) {
+            attribs[i] = new String[7];
+			  attribs[i][0] = ((String) elementfeilds.get(i - attribfeilds.size()));
+
+            ElementInfo element = type.getElementForElementName(attribs[i][0]);
+            Type t = element.getType();
+            attribs[i][1] = t.getLanguageSpecificName();
+            QName name = t.getName();
+
+            attribs[i][2] = name.getNamespaceURI();
+            attribs[i][3] = name.getLocalPart();
+
+            attribs[i][4] = attribs[i][1];
+
+            if (t.isArray()) {
+                attribs[i][4] = attribs[i][1];
+                Type arrayType = WrapperUtils.getArrayType(t);
+                attribs[i][1] = arrayType.getLanguageSpecificName() + "[]";
+                attribs[i][5] = arrayType.getName().getNamespaceURI();
+                attribs[i][6] = arrayType.getName().getLocalPart();
+
+            }
+
+            if (element.getMaxOccurs() > 1) {
+                attribs[i][1] = attribs[i][1] + "[]";
+				  Type typedata = new Type(new QName(name.getNamespaceURI(),name.getLocalPart()+"Array")
+					  ,null,false);
+				  typedata.setTypeNameForElementName(new ElementInfo(new QName("item"),t));
+                typedata.setArray(true);
+                attribs[i][4] = TypeMap.regestorArrayTypeToCreate(typedata);
+                attribs[i][5] = t.getName().getNamespaceURI();
+                attribs[i][6] = t.getName().getLocalPart();
+
+            }
+        }
+
+        return attribs;
+    }
+
+    /**
+     * writes get and set methods for attributes
+     * @throws IOException
+     * @throws WrapperFault
+     */
+    private void writeGettersAndSetter() throws IOException, WrapperFault {
+        for (int i = 0; i < this.attribs.length; i++) {
+            writer.write(
+                "\tpublic void set"
+                    + WrapperUtils.capitalizeFirstCaractor(attribs[i][0])
+                    + "("
+                    + attribs[i][1]
+                    + " "
+                    + attribs[i][0]
+                    + "){\n\t\tthis."
+                    + attribs[i][0]
+                    + " = "
+                    + attribs[i][0]
+                    + ";\n\t}\n");
+            writer.write(
+                "\tpublic "
+                    + attribs[i][1]
+                    + " get"
+                    + WrapperUtils.capitalizeFirstCaractor(attribs[i][0])
+                    + "(){\n\t\treturn "
+                    + attribs[i][0]
+                    + ";\n\t}\n");
+        }
+    }
+    
+    /**
+     * writes constructors for initialising attributes
+     * @throws WrapperFault
+     */
+    protected void writeAttributesConstructor() throws WrapperFault {
+        try {
+            writer.write(
+                "\tpublic "
+                    + WrapperUtils.getClassNameFromFullyQualifiedName(
+                        type.getLanguageSpecificName())
+                    + "(");
+            if (attribs.length > 0) {
+				  writer.write(attribs[0][1]
+						  + " "
+						  + attribs[0][0]);
+                for (int i = 1; i < this.attribs.length; i++)
+					  writer.write(", "+attribs[i][1]
+							  + " "
+							  + attribs[i][0]);
+            }
+            writer.write("){\n");
+            
+            for (int i = 0; i < this.attribs.length; i++)
+				  writer.write("\t\tthis." + attribs[i][0] + " = " + attribs[i][0] + ";\n");
+            writer.write("\t}\n");
+        } catch (IOException e) {
+            throw new WrapperFault(e);
+        }
+    }
+
+
+    public void writeCreateArrayCode() throws WrapperFault {
+		// TODO Auto-generated method stub		
+	}
+    
+    public void writeStartElementCode() throws WrapperFault {
+    	try {
+            if (attribs.length == 0) {
+                //nothing to print if this is simple type we have inbuild types
+                System.out.println(
+                    "possible error calss with no attributes....................");
+                return;
+            }
+          
+            //if part
+            writer.write(
+                "\t\t\t\tif(qName.equals(\""
+                    + attribs[0][0]
+                    + "\")) {\n");            
+            
+            Type t;
+
+            if (TypeMap.isSimpleType(attribs[0][1])) {
+                if (JavaUtilsJ2ME.isUnwrapperdSimpleType(attribs[0][1]))
+                    writer.write(
+                        "\t\t\t\t\t return;\n");
+                else {
+                    writer.write(
+                        "\t\t\t\t\t return;\n");
+                }
+            } else if (attribs[0][1].endsWith("[]")) {
+            	String attrib = attribs[0][1].substring(0,attribs[0][1].indexOf('['));
+            	boolean isSimpleType=false;
+            	
+            	if (TypeMap.isSimpleType(attrib)){
+            		isSimpleType=true;
+            	}
+            	
+            	writer.write(
+            			"\t\t\t\t\t"
+            			+ attribs[0][0]+"length+=1;\n");
+            			
+            	
+            	writer.write(
+                        "\t\t\t\t\tif("+attribs[0][0]+"length==1){\n");
+            	
+            	
+            	 writer.write(
+                        "\t\t\t\t\t\t\tthis."
+                            + attribs[0][0]
+                            + "= (new "
+                            + attrib							
+                            + "[1]);\n");
+            	 
+            	 if(!isSimpleType){
+            	 	writer.write(
+                            "\t\t\t\t\t\t\tthis."
+                                + attribs[0][0]
+                                + "[0]= (new "
+                                + attrib                           
+                                + "());\n");
+            	 	
+            	 	 writer.write(
+                            "\t\t\t\t\t\t\t"
+                	 			+ "childObj="
+    							+attribs[0][0]										
+                                + "[0];\n");
+            	 }
+          	
+            	
+            	 writer.write(
+                 "\t\t\t\t\t\t}else{\n");
+            	 
+            	 writer.write(
+                        "\t\t\t\t\t\t\t"
+            	 			+attrib
+                            + "[] newParam"
+                            + "= new "
+                            + attrib
+                            + "["
+							+attribs[0][0]+"length];\n");
+            	 
+            	 writer.write(
+                        "\t\t\t\t\t\t\t"
+                            + "System.arraycopy("
+							+attribs[0][0]
+							+",0,newParam,0,"
+							+ attribs[0][0]
+							+".length);\n ");
+                           
+            	 writer.write(
+                        "\t\t\t\t\t\t\t"
+            	 			+attribs[0][0]
+                            + "= newParam;\n");
+            	 
+            	 if(!isSimpleType){
+            	 	writer.write(
+                            "\t\t\t\t\t\t\tthis."
+                                + attribs[0][0]
+                                + "["
+    							+ attribs[0][0]+"length-1]= (new "
+                                + attrib
+                                + "());\n");
+            	 	
+            	 	 writer.write(
+                            "\t\t\t\t\t\t\t"
+                	 			+ "childObj="
+    							+attribs[0][0]										
+                                + "["
+    							+ attribs[0][0]+"length-1];\n");
+            	 }
+        	      	
+            	 
+            	 writer.write(
+                 "\t\t\t\t\t\t}\n");
+                
+            } else {            	
+            	
+                writer.write(
+                    "\t\t\t\t\tthis."
+                        + attribs[0][0]
+                        + "= (new "
+                        + WrapperUtils.getWrapperName4FullyQualifiedName(
+                            attribs[0][1],this.wscontext)
+                        + "());\n");
+                writer.write("\t\t\t\t\tchildObj="+ attribs[0][0]  +";\n");
+
+            }
+
+            //else if part
+            for (int i = 1; i < attribs.length; i++) {
+                writer.write(
+                    "\t\t\t\t}else if (qName.equals(\""
+                        + attribs[i][0]
+                        + "\")) {\n");
+                if (TypeMap.isSimpleType(attribs[i][1])) {
+                    if (JavaUtilsJ2ME.isUnwrapperdSimpleType(attribs[i][1]))
+                        writer.write(
+                            "\t\t\t\t\t return;\n");
+                    else
+                        writer.write(
+                            "\t\t\t\t\t return;\n");
+                } else if (attribs[i][1].endsWith("[]")) {
+                	String attrib = attribs[i][1].substring(0,attribs[i][1].indexOf('['));
+                	                	
+                	boolean isSimpleType=false;
+                	
+                	if (TypeMap.isSimpleType(attrib)){
+                		isSimpleType=true;
+                	}
+                	
+                	writer.write(
+                			"\t\t\t\t\t"
+                			+ attribs[i][0]+"length+=1;\n");
+                	
+                	writer.write(
+                            "\t\t\t\t\tif("+attribs[i][0]+"length==1){\n");
+                	
+                	
+                	 writer.write(
+                            "\t\t\t\t\t\t\tthis."
+                                + attribs[i][0]
+                                + "= (new "
+                                + attrib
+                                + "[1]);\n");
+                	 
+                	 if(!isSimpleType){
+                	 	writer.write(
+                                "\t\t\t\t\t\t\tthis."
+                                    + attribs[i][0]
+                                    + "[0]= (new "
+                                    + attrib                           
+                                    + "());\n");
+                	 	writer.write(
+                                "\t\t\t\t\t\t\t"
+                    	 			+ "childObj="
+        							+attribs[i][0]										
+                                    + "[0];\n");
+                	 }
+    	 
+                	                 	
+                	 writer.write(
+                     "\t\t\t\t\t\t}else{\n");
+                	 
+                	 writer.write(
+                            "\t\t\t\t\t\t\t"
+                	 			+attrib
+                                + "[] newParam"
+                                + "= new "
+                                + attrib
+                                + "["
+								+attribs[i][0]+"length];\n");
+                	 
+                	 writer.write(
+                            "\t\t\t\t\t\t\t"
+                                + "System.arraycopy("
+    							+attribs[i][0]
+    							+",0,newParam,0,"
+    							+ attribs[i][0]
+    							+".length);\n ");
+                               
+                	 writer.write(
+                            "\t\t\t\t\t\t\t"
+                	 			+attribs[i][0]
+                                + "= newParam;\n");
+                	 
+                	 if(!isSimpleType){
+                	 	writer.write(
+                                "\t\t\t\t\t\t\tthis."
+                                    + attribs[i][0]
+                                    + "["
+        							+ attribs[i][0]+"length-1]= (new "
+                                    + attrib
+                                    + "());\n");
+                	 	
+                	 	 writer.write(
+                                "\t\t\t\t\t\t\t"
+                    	 			+ "childObj="
+        							+attribs[i][0]										
+                                    + "["
+        							+ attribs[i][0]+"length-1];\n");
+                	 }
+                	 
+//                	 else{
+//                	 	writer.write(
+//                                "\t\t\t\t\t\t\tthis."
+//                                    + attribs[i][0]
+//    								+ "["
+//    				    			+ attribs[i][0]+"length-1]= new "
+//                                    +WrapperUtils.getWrapperName4FullyQualifiedName(
+//                                            attrib,this.wscontext)                        
+//                                    + "(value).getParam();\n");            	 	
+//                	 }
+                	 
+                	 writer.write(
+                     "\t\t\t\t\t\t}\n");
+                } else {
+                    writer.write(
+                        "\t\t\t\t\tthis."
+                            + attribs[i][0]
+                            + "= (new "
+                            + WrapperUtils.getWrapperName4FullyQualifiedName(
+                                attribs[i][1],this.wscontext)
+                            + "());\n");
+                    
+                    writer.write("\t\t\t\t\tchildObj="+ attribs[i][0]  +";\n");
+
+                }
+            }
+            //end of conditions
+            writer.write(
+                "\t\t\t\t}else if (childObj!=null)\n\t\t\t\t\t  childObj.startElement(uri,localName,qName,attributes);\n");
+           
+            writer.write(
+            "\t\t\t\telse\n\t\t\t\t\t\t throw new SAXException(\"unknown tag find \"+ qName);\n");
+       
+            
+//            writer.write("\t\t}\n");
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new WrapperFault(e);
+        }
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis.wsdl.toJava.JavaWriter#writeFileBody(java.io.PrintWriter)
+	 */
+	protected void writeFileBody(PrintWriter arg0) throws IOException {
+		// TODO Auto-generated method stub		
+	}
+
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitStubWriter.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitStubWriter.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitStubWriter.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitStubWriter.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,359 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws.doclit;
+
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.mirae.wsdl2ws.WrapperFault;
+import org.apache.mirae.wsdl2ws.WrapperUtils;
+import org.apache.mirae.wsdl2ws.info.MethodInfo;
+import org.apache.mirae.wsdl2ws.info.ParameterInfo;
+import org.apache.mirae.wsdl2ws.info.Type;
+import org.apache.mirae.wsdl2ws.info.TypeMap;
+import org.apache.mirae.wsdl2ws.info.WebServiceContext;
+import org.apache.mirae.wsdl2ws.j2me.JavaUtilsJ2ME;
+import org.apache.mirae.wsdl2ws.j2me.client.J2MEStubWriter;
+
+
+/** 
+ * This class generates the stub class for the doc literal
+ * web service 
+ */
+public class DocLitStubWriter extends J2MEStubWriter {
+	private WebServiceContext wscontext;
+	private ArrayList methods;	
+	
+	/**
+	 * @param packagename
+	 * @param classname
+	 * @throws WrapperFault
+	 */
+	public DocLitStubWriter(WebServiceContext wscontext) throws WrapperFault {
+		super(wscontext);
+		this.wscontext = wscontext;
+		this.methods = wscontext.getSerInfo().getMethods();
+	}
+
+	/**
+	 * this method writes all the methos for invoking the 
+	 * web service
+	 * @throws WrapperFault
+	 */
+	protected void writeMethods() throws WrapperFault {
+		MethodInfo minfo;
+		QName paramQName;
+		Type paramType;
+		Object obj;
+		try {
+			for (int i = 0; i < methods.size(); i++) {
+				minfo = (MethodInfo) this.methods.get(i);
+                
+				this.writeMethodSignature(minfo);
+
+				ParameterInfo returnType = (ParameterInfo) minfo.getReturnType();
+				writer.write(
+					"\n\t\tjavax.xml.namespace.QName methodName = new javax.xml.namespace.QName(\""
+						+ returnType.getElementName().getNamespaceURI()
+						+"\",\""
+						+ minfo.getMethodname()
+						+ "\");");
+				String ops = "";
+				writer.write("\n\t\torg.apache.mirae.xml.rpc.Call call = new org.apache.mirae.xml.rpc.Call();");
+				writer.write("\n\t\tcall.setOperationName(methodName);");
+				writer.write("\n\t\tcall.setTargetEndpointAddress(this.enduri);");
+				writer.write("\n\t\tcall.setStyle(org.apache.mirae.util.Constants.STYLE_DOCUMENT);");
+				
+				writer.write("\n\t\tcall.setSoapActonURI(SOAPAction);");
+			    
+				// add paramters to the call object .........
+				Iterator params = minfo.getParameterTypes().iterator();
+				if (params.hasNext()) {
+					obj = params.next();
+					paramType =
+						wscontext.getTypemap().getType(
+							((ParameterInfo) obj).getSchemaName());
+					paramQName = ((ParameterInfo) obj).getSchemaName();
+									
+					if (TypeMap.isSimpleType(paramQName)&& !JavaUtilsJ2ME.isUnwrapperdSimpleType(paramType.getLanguageSpecificName())) {
+                    String paramName =
+                        WrapperUtils.getWrapperName4FullyQualifiedName(
+                            ((ParameterInfo) obj).getType().getLanguageSpecificName(),this.wscontext);
+                    
+                    writer.write(
+                        "\n\t\t"
+                            + paramName
+                            + " op0 = new "
+                            + paramName
+                            + "(param0);");
+                   
+                    writer.write(
+                        "\n\t\tcall.addParameter("
+                    		+"op0,"
+							+"\"param0\",new javax.xml.namespace.QName(\""
+                            + paramQName.getNamespaceURI()
+                            + "\",\""
+                            + paramQName.getLocalPart()                                
+							+ "\"));");
+                    ops = "op0";
+                
+                } else if (paramType != null && paramType.isArray()) {
+                    writer.write(
+                        "\n\t\t"
+                            + ((ParameterInfo) obj).getType().getLanguageSpecificName()
+                            + " op0 = new "
+                            + ((ParameterInfo) obj).getType().getLanguageSpecificName()
+                            + "();");
+                    writer.write("\n\t\top0.setParam(param0);");
+                    paramQName = ((ParameterInfo) obj).getType().getName();
+                    writer.write(
+                        "\n\t\tcall.addParameter(op0,\"param0\",new javax.xml.namespace.QName(\""
+                            + paramQName.getNamespaceURI()
+                            + "\",\""
+                            + paramQName.getLocalPart()                              
+							+ "\"));");
+                    ops = "op0";
+                
+                } else {                        
+                    paramQName = ((ParameterInfo) obj).getType().getName();
+                    writer.write(
+                        "\n\t\tcall.addParameter(param0,\"param0\",new javax.xml.namespace.QName(\""
+                            + paramQName.getNamespaceURI()
+                            + "\",\""
+                            + paramQName.getLocalPart()
+                            + "\"));");
+                    ops = "param0";
+                }
+            }
+            for (int j = 1; params.hasNext(); j++) {
+                obj = params.next();
+                paramType = ((ParameterInfo) obj).getType();
+				paramQName = paramType.getName();
+				
+                if (TypeMap.isSimpleType(paramQName) && !JavaUtilsJ2ME.isUnwrapperdSimpleType(paramType.getLanguageSpecificName())) {
+                    String paramName =
+                        WrapperUtils.getWrapperName4FullyQualifiedName(
+							paramType.getLanguageSpecificName(),this.wscontext);
+
+                    writer.write(
+                        "\n\t\t"
+                            + paramName
+                            + " op"
+                            + j
+                            + " = new "
+                            + paramName
+                            + "(param"
+                            + j
+                            + ");");
+                    
+                    writer.write(
+                        "\n\t\tcall.addParameter("
+                    		+"op"
+							+j
+							+","
+                    		+"\"param"
+                            + j
+                            + "\",new javax.xml.namespace.QName(\""
+                            + paramQName.getNamespaceURI()
+                            + "\",\""
+                            + paramQName.getLocalPart()
+                            + "\"));");
+                    ops = ops + ",op" + j;
+                
+                } else if (paramType != null && paramType.isArray()) {
+                    writer.write(
+                        "\n\t\t "
+                            + ((ParameterInfo) obj).getType().getLanguageSpecificName()
+                            + " op"
+                            + j
+                            + " = new "
+                            + ((ParameterInfo) obj).getType().getLanguageSpecificName()
+                            + "();\n");
+                    writer.write("\n\t\top" + j + ".setParam(param" + j + ");");
+                    
+                    paramQName = ((ParameterInfo) obj).getType().getName();
+                    
+                    writer.write(
+                    	"\n\t\tcall.addParameter("
+                    		+"op"
+							+j
+							+","
+                    		+"\"param"
+                            + j
+                            + "\",new javax.xml.namespace.QName(\""
+                            + paramQName.getNamespaceURI()
+                            + "\",\""
+                            + paramQName.getLocalPart()
+                            + "\"));");
+                    ops = ops + ",op" + j;
+                
+                } else {
+                    paramQName = ((ParameterInfo) obj).getType().getName();
+                    writer.write(
+                        "\n\t\tcall.addParameter("
+                    		+"param"
+							+j
+							+","
+                    		+"\"param"
+                            + j
+                            + "\",new javax.xml.namespace.QName(\""
+                            + paramQName.getNamespaceURI()
+                            + "\",\""
+                            + paramQName.getLocalPart()
+                            + "\"));");
+                    ops = ops + ",param" + j;
+                }
+            }				
+
+				// adding return types to the call object.......
+				
+					if (returnType != null) {
+					paramQName = returnType.getSchemaName();
+					paramType =
+						wscontext.getTypemap().getType(
+							((ParameterInfo) minfo.getReturnType()).getSchemaName());
+					
+					writer.write("\n\t\tcall.setReturnCategory(org.apache.mirae.util.Constants.TYPE_DOCLIT);");						
+					
+					String paramName = minfo.getReturnType().getType().getLanguageSpecificName();                    
+					String wrappedparamName = WrapperUtils.getWrapperName4FullyQualifiedName(paramName,this.wscontext);
+                    
+					 writer.write("\n\t\tcall.setReturnType( new "
+                    		+ wrappedparamName
+							+ "());");
+					 
+					writer.write("\n\t\tcall.setValidationCode(\""+returnType.getElementName().getLocalPart()+"\");\n");
+
+					 					
+					 if (TypeMap.isSimpleType(paramQName)) {
+                    	writer.write(
+                            "\n\t\t" + wrappedparamName + " res = (" + wrappedparamName 
+							+ ")call.invoke();");                                     
+                        
+                        if(!JavaUtilsJ2ME.isUnwrapperdSimpleType(paramName))
+                        	if(paramName.startsWith("java.lang"))
+								writer.write("\n\t\treturn new "+paramName+"(res.getParam());\n");
+                        	else	
+                        		writer.write("\n\t\treturn res.getParam();\n");
+                        	
+                        else    
+							writer.write("\n\t\treturn res;");
+                    } else if (paramType != null && paramType.isArray()) {
+                        
+                    	writer.write(
+                    			"\n\t\t " 
+                    			+ wrappedparamName
+								+ " res =("
+								+ wrappedparamName
+								+ ")call.invoke();");                                  
+                    	
+                        writer.write(
+                            "\n\t\t return ("
+                                + WrapperUtils.getClassNameFromParamInfoConsideringArrays(
+                                    minfo.getReturnType(),
+                                    wscontext)
+                                + ")res.getParam();\n");
+                    } else {
+                        writer.write(
+                            "\n\t\t"
+                                + paramType.getLanguageSpecificName()
+                                + " res = ("
+                                + paramType.getLanguageSpecificName()
+								+ ")call.invoke();");                           
+                                
+                        writer.write("\n\t\t return res;\n");
+                    }
+								
+					
+				} else { // if return type is null
+					 writer.write(
+                     "\n\t\tcall.invoke();"); 
+				}
+				writer.write("\n\t\t}\n");
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new WrapperFault(e);
+		}
+
+	}
+
+	/**
+	 * method for write method signature
+	 * @param minfo
+	 * @throws WrapperFault
+	 * @throws IOException
+	 */
+	private void writeMethodSignature(MethodInfo minfo) throws WrapperFault, IOException{
+		writer.write("\n\tpublic ");
+		ParameterInfo returnType =(ParameterInfo)minfo.getReturnType();
+        
+        if (returnType == null
+            || returnType.getType().getLanguageSpecificName() == null
+            || returnType.getType().getLanguageSpecificName() == "void")
+            writer.write("void ");
+        else
+            writer.write(
+                WrapperUtils.getClassNameFromParamInfoConsideringArrays(
+                    minfo.getReturnType(),
+                    wscontext)
+                    + " ");
+		
+		// writing the method Name
+		writer.write(" "+minfo.getMethodname() + "(");
+
+		//write parameter - only one parameter is writen. 
+		Iterator params = minfo.getParameterTypes().iterator();
+							
+		if (params.hasNext())
+						writer.write(
+							WrapperUtils.getClassNameFromParamInfoConsideringArrays(
+								(ParameterInfo) params.next(),
+								wscontext)
+								+ " param"
+								+ 0);
+				
+		writer.write(")throws Exception{");								
+									
+	}
+
+	/**
+	 * empty method for writing import statements
+	 */
+	protected void writeImportStatements() throws WrapperFault{
+	}
+
+	/**
+	 * this method writes comments
+	 */
+	protected void writeClassComment() throws WrapperFault {
+		try {
+			writer.write("/*This class is automatically generated by \n");
+			writer.write("*WSDL2WS_J2ME tool\n");
+			writer.write("*The client side stub of the document literal web service. \n");
+			writer.write("*/\n\n");
+		} catch (IOException e) {
+			e.printStackTrace();
+			throw new WrapperFault(e);
+		}
+	}
+}
+

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitWebServiceGenarator.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitWebServiceGenarator.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitWebServiceGenarator.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/DocLitWebServiceGenarator.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws.doclit;
+
+import org.apache.mirae.wsdl2ws.Genarator;
+import org.apache.mirae.wsdl2ws.WebServiceGenarator;
+import org.apache.mirae.wsdl2ws.WrapperConstants;
+import org.apache.mirae.wsdl2ws.WrapperFault;
+import org.apache.mirae.wsdl2ws.info.WebServiceContext;
+
+
+public class DocLitWebServiceGenarator implements WebServiceGenarator {
+	private WebServiceContext wscontext;
+	public DocLitWebServiceGenarator(WebServiceContext wscontext) {
+		this.wscontext = wscontext;
+	}
+
+	/**
+	 * Genarate the wrapper genarator, Serivce genatator,Param Genarator and called
+	 * Genarate on it. 	
+	 */
+	public void genarate() throws WrapperFault {
+		(new Genarator(WrapperConstants.GENERATOR_DOCLIT_PARAM_JAVA, wscontext))
+				.genarate();
+
+		(new Genarator(WrapperConstants.GENERATOR_DOCLIT_STUB_JAVA,
+							wscontext))
+							.genarate();
+		(new Genarator(WrapperConstants.GENERATOR_STUB_SERVICE_INTERFACE_J2ME, wscontext)).genarate();
+			
+		System.out.println("generated");
+
+
+	} // generate
+
+}
\ No newline at end of file

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/ElementInfo.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/ElementInfo.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/ElementInfo.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/ElementInfo.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws.info;
+
+import javax.xml.namespace.QName;
+
+public class ElementInfo {
+	public static int UNBOUNDED = 999999999; 
+	private QName name; 
+	private Type type;
+	private int maxOccurs = 1;
+	private int minOccurs = 1;
+
+	public ElementInfo(QName name,Type type){
+		this.name = name;
+		this.type = type;
+		
+		if(this.name == null || this.type == null)
+			throw new RuntimeException("name or type of the ElementInfo can not be null ");
+	}
+	
+	/**
+	 * @return int
+	 */
+	public int getMaxOccurs() {
+		return maxOccurs;
+	}
+
+	/**
+	 * @return int
+	 */
+	public int getMinOccurs() {
+		return minOccurs;
+	}
+
+	/**
+	 * @return QName
+	 */
+	public QName getName() {
+		return name;
+	}
+
+	/**
+	 * @return QName
+	 */
+	public Type getType() {
+		return type;
+	}
+
+	/**
+	 * Sets the maxOccurs.
+	 * @param maxOccurs The maxOccurs to set
+	 */
+	public void setMaxOccurs(int maxOccurs) {
+		this.maxOccurs = maxOccurs;
+	}
+
+	/**
+	 * Sets the minOccurs.
+	 * @param minOccurs The minOccurs to set
+	 */
+	public void setMinOccurs(int minOccurs) {
+		this.minOccurs = minOccurs;
+	}
+
+	/**
+	 * Sets the name.
+	 * @param name The name to set
+	 */
+	public void setName(QName name) {
+		this.name = name;
+	}
+
+	/**
+	 * Sets the type.
+	 * @param type The type to set
+	 */
+	public void setType(Type type) {
+		this.type = type;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	public String toString() {
+		String str = "("+name+","+type.getName()+"| max = "+maxOccurs+" min ="+minOccurs+"|)\n";
+		return str;
+	}
+
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/FaultInfo.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/FaultInfo.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/FaultInfo.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/FaultInfo.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws.info;
+
+import java.util.ArrayList;
+
+public class FaultInfo {
+	private String name;
+	private ArrayList params = new ArrayList();
+	
+	public FaultInfo(String name){
+		this.name = name; 	
+	}
+	
+	public void addParam(ParameterInfo paraminfo){
+		params.add(paraminfo);
+	}
+	
+	public ArrayList getParams(){
+		return params;
+	}
+
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/MethodInfo.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/MethodInfo.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/MethodInfo.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/MethodInfo.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.wsdl2ws.info;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * This Class represents a method (operation is wsdl) in a web service 
+ * class.
+ *
+ */
+public class MethodInfo {
+		
+    private String methodname;
+    private ArrayList parameters;
+    private ParameterInfo returnType;
+    private String soapAction;
+    private List inputEncoding;
+    private List outputEncoding;
+    private String inputUse;
+    private String outputUse;
+
+    public MethodInfo() {
+        this.returnType = null;
+        this.methodname = null;
+        parameters = new ArrayList(101);
+    }
+
+    public MethodInfo(ParameterInfo returnType, String methodname) {
+        this.returnType = returnType;
+        this.methodname = methodname;
+        parameters = new ArrayList(101);
+    }
+
+    public String getMethodname() {
+        return methodname;
+    }
+
+    public void setMethodname(String methodname) {
+        this.methodname = methodname;
+    }
+
+    public ParameterInfo getReturnType() {
+        return returnType;
+    }
+
+    public void setReturnType(ParameterInfo returnType) {
+        this.returnType = returnType;
+    }
+
+    public Collection getParameterTypes() {
+        return this.parameters;
+    }
+
+    public void addParameter(ParameterInfo type) {
+        this.parameters.add(type);
+    }
+
+    /**
+     * @return
+     */
+    public List getInputEncoding() {
+        return inputEncoding;
+    }
+
+    /**
+     * @return
+     */
+    public List getOutputEncoding() {
+        return outputEncoding;
+    }
+
+    /**
+     * @return
+     */
+    public String getSoapAction() {
+        return soapAction;
+    }
+
+    /**
+     * @param string
+     */
+    public void setInputEncoding(List string) {
+        inputEncoding = string;
+    }
+
+    /**
+     * @param string
+     */
+    public void setOutputEncoding(List string) {
+        outputEncoding = string;
+    }
+
+    /**
+     * @param string
+     */
+    public void setSoapAction(String string) {
+        soapAction = string;
+    }
+
+    /**
+     * @return
+     */
+    public String getInputUse() {
+        return inputUse;
+    }
+
+    /**
+     * @return
+     */
+    public String getOutputUse() {
+        return outputUse;
+    }
+
+    /**
+     * @param string
+     */
+    public void setInputUse(String string) {
+        inputUse = string;
+    }
+
+    /**
+     * @param string
+     */
+    public void setOutputUse(String string) {
+        outputUse = string;
+    }
+
+}

Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/ParameterInfo.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/ParameterInfo.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/ParameterInfo.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/ParameterInfo.java Thu Feb  3 04:39:48 2005
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws.info;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * this class represents Parameter(message in the wsdl)  
+ */
+public class ParameterInfo {
+    private Type type;
+    private String attribName;
+	private QName elementName;
+	
+    public String getParamName() {
+        return attribName;
+    }
+
+    public void setParamName(String paramName) {
+        this.attribName = paramName;
+    }
+
+    public ParameterInfo(Type type,String attribName) {
+        this.type = type;
+        this.attribName = TypeMap.resoleveWSDL2LanguageNameClashes(attribName);;
+    }
+    public Type getType() {
+        return type;
+    }
+    
+    /**
+     * @return
+     */
+    public QName getElementName() {
+        return elementName;
+    }
+
+    /**
+     * @param name
+     */
+    public void setElementName(QName name) {    	
+        elementName = name;
+    }
+    
+	public String getLangName(){
+		return this.type.getLanguageSpecificName();
+	}
+	
+	public QName getSchemaName(){
+		return this.type.getName();
+	}
+
+}