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 sa...@apache.org on 2006/11/21 06:23:09 UTC

svn commit: r477509 - in /webservices/axis2/branches/java/1_1/modules: adb/src/org/apache/axis2/rpc/receivers/ kernel/src/org/apache/axis2/transport/http/util/ kernel/src/org/apache/axis2/transport/mail/

Author: saminda
Date: Mon Nov 20 21:23:08 2006
New Revision: 477509

URL: http://svn.apache.org/viewvc?view=rev&rev=477509
Log:
Fixes for JIRA 1732 and 1733 

Modified:
    webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java
    webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/util/SOAPUtil.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/mail/EMailSender.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java

Modified: webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java?view=diff&rev=477509&r1=477508&r2=477509
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java (original)
+++ webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java Mon Nov 20 21:23:08 2006
@@ -88,14 +88,20 @@
             }
         } catch (InvocationTargetException e) {
             String msg = null;
-            if (e.getCause() != null) {
-                msg = e.getCause().getMessage();
+
+            Throwable cause = e.getCause();
+
+            if (cause != null) {
+                msg = cause.getMessage();
+                if (msg == null) {
+                    msg = "Exception occurred while trying to invoke service method " +
+                          method.getName();
+                }
+                log.error(msg, e);
+                if (cause instanceof AxisFault) {
+                    throw (AxisFault) cause;
+                }
             }
-            if (msg == null) {
-                msg = "Exception occurred while trying to invoke service method " +
-                        method.getName();
-            }
-            log.error(msg, e);
             throw new AxisFault(msg);
         } catch (Exception e) {
             String msg = "Exception occurred while trying to invoke service method " +

Modified: webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java?view=diff&rev=477509&r1=477508&r2=477509
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java (original)
+++ webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java Mon Nov 20 21:23:08 2006
@@ -122,14 +122,18 @@
                     method, envelope, fac, ns, bodyContent, outMessage);
         } catch (InvocationTargetException e) {
             String msg = null;
-            if (e.getCause() != null) {
-                msg = e.getCause().getMessage();
+            Throwable cause = e.getCause();
+            if (cause != null) {
+                msg = cause.getMessage();
             }
             if (msg == null) {
                 msg = "Exception occurred while trying to invoke service method " +
-                        method.getName();
+                      method.getName();
             }
             log.error(msg, e);
+            if (cause instanceof AxisFault) {
+                throw (AxisFault) cause;
+            }
             throw new AxisFault(msg);
         } catch (Exception e) {
             String msg = "Exception occurred while trying to invoke service method " +

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java?view=diff&rev=477509&r1=477508&r2=477509
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java Mon Nov 20 21:23:08 2006
@@ -102,7 +102,7 @@
             invokeAxisEngine(msgContext);
 
         } catch (AxisFault axisFault) {
-            throw new AxisFault(axisFault);
+            throw axisFault;
         } catch (IOException ioException) {
             throw new AxisFault(ioException);
         }
@@ -142,7 +142,10 @@
 
             invokeAxisEngine(msgContext);
 
-        } catch (IOException e) {
+        }catch(AxisFault axisFault) {
+            throw axisFault;
+        }
+        catch (IOException e) {
             throw new AxisFault(e);
         }
         return true;
@@ -217,7 +220,6 @@
 
 
         } catch (Exception e) {
-            e.printStackTrace();
             throw new AxisFault("Error in creating a SOAPEnvelope from the REST request");
         }
 

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/util/SOAPUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/util/SOAPUtil.java?view=diff&rev=477509&r1=477508&r2=477509
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/util/SOAPUtil.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/util/SOAPUtil.java Mon Nov 20 21:23:08 2006
@@ -71,7 +71,10 @@
                 response.setStatus(HttpServletResponse.SC_ACCEPTED);
             }
             return true;
-        } catch (IOException ioException) {
+        }catch(AxisFault axisFault) {
+            throw axisFault;
+        }
+        catch (IOException ioException) {
             throw new AxisFault(ioException);
         }
     }

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/mail/EMailSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/mail/EMailSender.java?view=diff&rev=477509&r1=477508&r2=477509
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/mail/EMailSender.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/mail/EMailSender.java Mon Nov 20 21:23:08 2006
@@ -27,6 +27,8 @@
 import javax.mail.internet.AddressException;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
+import javax.activation.MailcapCommandMap;
+import javax.activation.CommandMap;
 import java.util.Properties;
 
 public class EMailSender {
@@ -34,11 +36,21 @@
     private MessageContext messageContext;
     private PasswordAuthentication passwordAuthentication;
 
-    public EMailSender() {}
+    static {
+        //Initializing the proper mime types
+        MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
+        mc.addMailcap(
+                "application/soap+xml;;x-java-content-handler=com.sun.mail.handlers.text_xml");
+        CommandMap.setDefaultCommandMap(mc);
+    }
+
+    public EMailSender() {
+    }
 
     public void setMessageContext(MessageContext messageContext) {
         this.messageContext = messageContext;
     }
+
     public void setProperties(Properties properties) {
         this.properties = properties;
     }
@@ -75,7 +87,7 @@
                 if (messageContext.getSoapAction() != null) {
                     msg.setContent(message,
                                    contentType + "; charset=" + format.getCharSetEncoding() +
-                                   " ; action=" + messageContext.getSoapAction());
+                                   " ; action=\"" + messageContext.getSoapAction() + "\"");
                 }
             } else {
                 msg.setContent(message, contentType + "; charset=" + format.getCharSetEncoding());

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java?view=diff&rev=477509&r1=477508&r2=477509
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java Mon Nov 20 21:23:08 2006
@@ -299,6 +299,25 @@
             if (msg.getContentType().indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE)
                 > -1) {
                 soapNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+                // set the soapAction if available
+                int index = msg.getContentType().indexOf("action");
+                if (index > -1) {
+                    String transientString = msg.getContentType().substring(index, msg.getContentType().length());
+                    int equal = transientString.indexOf("=");
+                    int firstSemiColon = transientString.indexOf(";");
+                    if (firstSemiColon > -1) {
+                        soapAction = transientString.substring(equal + 1, firstSemiColon);
+                    } else {
+                        soapAction = transientString.substring(equal + 1, transientString.length());
+                    }
+                    if ((soapAction != null) && soapAction.startsWith("\"")
+                        && soapAction.endsWith("\"")) {
+                        soapAction = soapAction
+                                .substring(1, soapAction.length() - 1);
+                    }
+                    msgContext.setSoapAction(soapAction);
+
+                }
             } else if (msg.getContentType().indexOf(
                     SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
                 soapNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org