You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by du...@apache.org on 2006/04/05 21:06:15 UTC

svn commit: r391722 - in /webservices/axis/trunk/proposals/dug/java/src/org/apache/axis: client/ configuration/ deployment/wsdd/ encoding/ transport/http/ utils/ wsdl/toJava/

Author: dug
Date: Wed Apr  5 12:06:13 2006
New Revision: 391722

URL: http://svn.apache.org/viewcvs?rev=391722&view=rev
Log:
sync with HEAD

Modified:
    webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/Call.java
    webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/configuration/FileProvider.java
    webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java
    webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/deployment/wsdd/WSDDUndeployment.java
    webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/encoding/SerializationContext.java
    webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java
    webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/utils/Admin.java
    webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java
    webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java

Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/Call.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/Call.java?rev=391722&r1=391721&r2=391722&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/Call.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/Call.java Wed Apr  5 12:06:13 2006
@@ -2802,13 +2802,7 @@
             }
         }
 
-        // if(!msgContext.getIsOneWay()) {
-            invokeEngine(msgContext);
-        /*
-        } else {
-            invokeEngineOneWay(msgContext);
-        }
-        */
+        invokeEngine(msgContext);
 
         if (log.isDebugEnabled()) {
             log.debug("Exit: Call::invoke()");
@@ -2858,31 +2852,6 @@
                   throw ((SOAPFault)respBody).getFault();
             }
         }
-    }
-
-    /**
-     * Implement async invocation by running the request in a new thread
-     * @param msgContext
-     */
-    private void invokeEngineOneWay(final MessageContext msgContext) {
-        //TODO: this is not a good way to do stuff, as it has no error reporting facility
-        //create a new class
-        Runnable runnable = new Runnable(){
-            public void run() {
-                msgContext.setIsOneWay( true );
-                try {
-                    service.getEngine().invoke( msgContext );
-                } catch (AxisFault af){
-                    //TODO: handle errors properly
-                    log.debug(Messages.getMessage("exceptionPrinting"), af);
-                }
-                msgContext.setIsOneWay( false );
-            }
-        };
-        //create a thread to run it
-        Thread thread = new Thread(runnable);
-        //run it
-        thread.start();
     }
 
     /**

Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/configuration/FileProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/configuration/FileProvider.java?rev=391722&r1=391721&r2=391722&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/configuration/FileProvider.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/configuration/FileProvider.java Wed Apr  5 12:06:13 2006
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.io.Writer;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -198,11 +199,13 @@
         throws ConfigurationException {
         if (!readOnly) {
             try {
-                Document doc = Admin.listConfig(engine);
+                StringWriter strWriter = new StringWriter();
+                Admin.listConfig(engine, strWriter);
+
                 Writer osWriter = new OutputStreamWriter(
                         new FileOutputStream(configFile),XMLUtils.getEncoding());
                 PrintWriter writer = new PrintWriter(new BufferedWriter(osWriter));
-                XMLUtils.DocumentToWriter(doc, writer);
+                writer.print(strWriter.getBuffer().toString());
                 writer.println();
                 writer.close();
             } catch (Exception e) {

Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java?rev=391722&r1=391721&r2=391722&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java Wed Apr  5 12:06:13 2006
@@ -155,6 +155,20 @@
             deployMapping(typeMapping);
     }
 
+    public void undeployTypeMapping(WSDDTypeMapping typeMapping)
+    {
+        QName qname = typeMapping.getQName();
+        String encoding = typeMapping.getEncodingStyle();
+        
+        // We have to include the encoding in the key
+        // because otherwise we would overwrite exiting mappings
+        typeMappings.remove(qname + encoding);
+
+        if (tmrDeployed) {
+            undeployMapping(typeMapping);
+        }
+    }
+
     /**
      * Default constructor
      */
@@ -311,6 +325,11 @@
         } catch (Exception e) {
             throw new WSDDException(e);
         }
+    }
+
+    private void undeployMapping(WSDDTypeMapping mapping)
+    {
+        // not implemented
     }
 
     public void writeToContext(SerializationContext context)

Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/deployment/wsdd/WSDDUndeployment.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/deployment/wsdd/WSDDUndeployment.java?rev=391722&r1=391721&r2=391722&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/deployment/wsdd/WSDDUndeployment.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/deployment/wsdd/WSDDUndeployment.java Wed Apr  5 12:06:13 2006
@@ -118,21 +118,17 @@
             addService(getQName(elements[i]));
         }
 
-        /*
-        // How to deal with undeploying mappings?
-
         elements = getChildElements(e, ELEM_WSDD_TYPEMAPPING);
         for (i = 0; i < elements.length; i++) {
             WSDDTypeMapping mapping = new WSDDTypeMapping(elements[i]);
-            addTypeMapping(mapping);
+            deployTypeMapping(mapping);
         }
 
         elements = getChildElements(e, ELEM_WSDD_BEANMAPPING);
         for (i = 0; i < elements.length; i++) {
             WSDDBeanMapping mapping = new WSDDBeanMapping(elements[i]);
-            addTypeMapping(mapping);
+            deployTypeMapping(mapping);
         }
-        */
     }
 
     protected QName getElementName()
@@ -174,6 +170,11 @@
                 throw new ConfigurationException(exp);
             }
             registry.undeployService(qname);
+        }
+
+        for (int n = 0; n < typeMappings.size(); n++) {
+            WSDDTypeMapping mapping  = (WSDDTypeMapping)typeMappings.get(n);
+            registry.undeployTypeMapping(mapping);
         }
     }
 

Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/encoding/SerializationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/encoding/SerializationContext.java?rev=391722&r1=391721&r2=391722&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/encoding/SerializationContext.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/encoding/SerializationContext.java Wed Apr  5 12:06:13 2006
@@ -324,6 +324,20 @@
     }
 
     /**
+     * Sets the pretty xml serialization support.
+     */
+    public void setDisablePrettyXML(boolean disablePrettyXML) {
+        this.disablePrettyXML = disablePrettyXML;
+    }
+    
+    /**
+     * Gets whether the pretty xml serialization support is enabled.
+     */
+    public boolean getDisablePrettyXML() {
+        return this.disablePrettyXML;
+    }
+
+    /**
      * Get whether the serialization should be pretty printed.
      * @return true/false
      */

Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java?rev=391722&r1=391721&r2=391722&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java Wed Apr  5 12:06:13 2006
@@ -194,6 +194,12 @@
             }
 
             int returnCode = httpClient.executeMethod(hostConfiguration, method, null);
+            String statusMessage = method.getStatusText();
+
+            msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE,
+                                   new Integer(returnCode));
+            msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_MESSAGE,
+                                   statusMessage);
 
             String contentType = 
                 getHeader(method, HTTPConstants.HEADER_CONTENT_TYPE);
@@ -209,12 +215,11 @@
                        SOAPConstants.SOAP12_CONSTANTS) {
                 // For now, if we're SOAP 1.2, fall through, since the range of
                 // valid result codes is much greater
-            } else if ((contentType != null) && !contentType.equals("text/html")
+            } else if ((contentType != null) && !contentType.startsWith("text/html")
                        && ((returnCode > 499) && (returnCode < 600))) {
                 
                 // SOAP Fault should be in here - so fall through
             } else {
-                String statusMessage = method.getStatusText();
                 AxisFault fault = new AxisFault("HTTP",
                                                 "(" + returnCode + ")"
                                                 + statusMessage, null,
@@ -233,6 +238,15 @@
                 }
             }
             
+            if (contentLength != null) {
+                long length = Long.parseLong(contentLength);
+                
+                if (length == 0) {
+                    method.releaseConnection();
+                    return;
+                }
+            }
+
             // wrap the response body stream so that close() also releases 
             // the connection back to the pool.
             InputStream releaseConnectionOnCloseStream = 
@@ -288,12 +302,6 @@
                         handleCookie(HTTPConstants.HEADER_COOKIE2, headers[i].getValue(), msgContext);
                     }
                 }
-            }
-
-            // always release the connection back to the pool if 
-            // it was one way invocation
-            if (msgContext.isPropertyTrue("axis.one.way")) {
-                method.releaseConnection();
             }
             
         } catch (Exception e) {

Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/utils/Admin.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/utils/Admin.java?rev=391722&r1=391721&r2=391722&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/utils/Admin.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/utils/Admin.java Wed Apr  5 12:06:13 2006
@@ -39,6 +39,7 @@
 import java.io.FileInputStream;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.io.Writer;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 
@@ -206,20 +207,23 @@
         }
     }
 
-    /** Get an XML document representing this engine's configuration.
-     *
-     * This document is suitable for saving and reloading into the
-     * engine.
+    /** 
+     * Outputs XML document representing this engine's configuration
+     * to the specified writer. 
      *
      * @param engine the AxisEngine to work with
-     * @return an XML document holding the engine config
+     * @param writer the writer to which write the engine configuration.
+     *               This function does not close the writer.
      * @exception AxisFault
      */
-    public static Document listConfig(AxisEngine engine)
+    public static void listConfig(AxisEngine engine, Writer writer)
         throws AxisFault
     {
-        StringWriter writer = new StringWriter();
+        if (writer == null) {
+            return;
+        }
         SerializationContext context = new SerializationContext(writer);
+        context.setDisablePrettyXML(false);
         context.setPretty(true);
         try {
             EngineConfiguration config = engine.getConfig();
@@ -235,7 +239,22 @@
 
             throw new AxisFault(Messages.getMessage("noEngineWSDD"));
         }
+    }
 
+    /** Get an XML document representing this engine's configuration.
+     *
+     * This document is suitable for saving and reloading into the
+     * engine.
+     *
+     * @param engine the AxisEngine to work with
+     * @return an XML document holding the engine config
+     * @exception AxisFault
+     */
+    public static Document listConfig(AxisEngine engine)
+        throws AxisFault
+    {
+        StringWriter writer = new StringWriter();
+        listConfig(engine, writer);
         try {
             writer.close();
             return XMLUtils.newDocument(new InputSource(new StringReader(writer.getBuffer().toString())));

Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java?rev=391722&r1=391721&r2=391722&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java Wed Apr  5 12:06:13 2006
@@ -717,27 +717,6 @@
                         + "_";
             }
 
-            // Process the attributes
-            Vector attributes = te.getContainedAttributes();
-            if (attributes != null) {
-                for (int j = 0; j < attributes.size(); j += 1) {
-                    ContainedAttribute attr = (ContainedAttribute) attributes.get(j);
-
-                    String name = getAttributeName(attr);
-                    String typeName = attr.getType().getName();
-
-                    // TODO - What about MinOccurs and Nillable?
-                    // Do they make sense here?
-                    if (attr.getOptional()) {
-                        typeName = Utils.getWrapperType(typeName);
-                    }
-
-                    paramTypes.add(typeName);
-                    paramNames.add(JavaUtils.getUniqueValue(
-                            helper.reservedPropNames, name));
-                }
-            }
-
             // Process the elements
             Vector elements = te.getContainedElements();
 
@@ -759,6 +738,28 @@
                     }
                 }
             }
+
+            // Process the attributes
+            Vector attributes = te.getContainedAttributes();
+            if (attributes != null) {
+                for (int j = 0; j < attributes.size(); j += 1) {
+                    ContainedAttribute attr = (ContainedAttribute) attributes.get(j);
+
+                    String name = getAttributeName(attr);
+                    String typeName = attr.getType().getName();
+
+                    // TODO - What about MinOccurs and Nillable?
+                    // Do they make sense here?
+                    if (attr.getOptional()) {
+                        typeName = Utils.getWrapperType(typeName);
+                    }
+
+                    paramTypes.add(typeName);
+                    paramNames.add(JavaUtils.getUniqueValue(
+                            helper.reservedPropNames, name));
+                }
+            }
+
         }
 
         if (isMixed && !isAny && !parentIsAny && !parentIsMixed) {

Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java?rev=391722&r1=391721&r2=391722&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java Wed Apr  5 12:06:13 2006
@@ -403,7 +403,7 @@
 
         pw.println("            return _call;");
         pw.println("        }");
-        pw.println("        catch (java.lang.Throwable _t) {");
+        pw.println("        catch (java.lang.Exception _t) {");
         pw.println("            throw new org.apache.axis.AxisFault(\""
                 + Messages.getMessage("badCall01") + "\", _t);");
         pw.println("        }");
@@ -549,7 +549,8 @@
             if ((i % OPERDESC_PER_BLOCK) == 0) {
                 k++;
 
-                pw.println("    }\n");
+                pw.println("    }");
+                pw.println();
                 pw.println("    private static void _initOperationDesc" + k
                         + "(){");
                 pw.println(