You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2007/05/11 20:14:27 UTC

svn commit: r537254 - in /incubator/ode/trunk: axis2/src/main/java/org/apache/ode/axis2/util/ bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ dao-jpa/src/main/java/org/apache/ode/dao/jpa/

Author: mriou
Date: Fri May 11 11:14:26 2007
New Revision: 537254

URL: http://svn.apache.org/viewvc?view=rev&rev=537254
Log:
Added support for operations with no parts in their input message (like the Axis2 version service for example). Mostly ignores what's in the invoke inputMessage and sets the message element to null. The rest is just making sure that we handle null messages properly.

Modified:
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/util/SoapMessageConverter.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
    incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageDaoImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java

Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/util/SoapMessageConverter.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/util/SoapMessageConverter.java?view=diff&rev=537254&r1=537253&r2=537254
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/util/SoapMessageConverter.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/util/SoapMessageConverter.java Fri May 11 11:14:26 2007
@@ -19,10 +19,23 @@
 
 package org.apache.ode.axis2.util;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.namespace.Constants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.axis2.Messages;
+import org.apache.ode.axis2.OdeFault;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.stl.CollectionsX;
+import org.w3c.dom.Element;
 
 import javax.wsdl.Binding;
 import javax.wsdl.BindingInput;
@@ -41,24 +54,10 @@
 import javax.wsdl.extensions.soap.SOAPHeader;
 import javax.wsdl.extensions.soap.SOAPOperation;
 import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPFault;
-import org.apache.axiom.soap.SOAPFaultDetail;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.namespace.Constants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ode.axis2.Messages;
-import org.apache.ode.axis2.OdeFault;
-import org.apache.ode.utils.DOMUtils;
-import org.apache.ode.utils.stl.CollectionsX;
-import org.w3c.dom.Element;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * SOAP/ODE Message converter. Uses WSDL binding information to convert the protocol-neutral ODE representation into a SOAP
@@ -145,7 +144,8 @@
     public void createSoapRequest(MessageContext msgCtx, Element message, Operation op) throws AxisFault {
         if (op == null)
             throw new NullPointerException("Null operation");
-        if (message == null)
+        // The message can be null if the input message has no part
+        if (op.getInput().getMessage().getParts().size() > 0 && message == null)
             throw new NullPointerException("Null message.");
         if (msgCtx == null)
             throw new NullPointerException("Null msgCtx");
@@ -225,15 +225,17 @@
             throw new OdeFault(__msgs.msgSoapHeaderReferencesUnkownPart(headerdef.getPart()));
 
         Element srcPartEl = null;
-        if (payloadMessageHeader)
-            srcPartEl = DOMUtils.findChildByName(message, new QName(null, headerdef.getPart()));
-        else {
-            Element fho = DOMUtils.findChildByName(message, FOREIGN_HEADER_OUT);
-            if (fho != null) {
-                srcPartEl = DOMUtils.findChildByName(fho, headerdef.getElementType());
+        // Message can be null if the operation message has no part
+        if (message != null) {
+            if (payloadMessageHeader)
+                srcPartEl = DOMUtils.findChildByName(message, new QName(null, headerdef.getPart()));
+            else {
+                Element fho = DOMUtils.findChildByName(message, FOREIGN_HEADER_OUT);
+                if (fho != null) {
+                    srcPartEl = DOMUtils.findChildByName(fho, headerdef.getElementType());
+                }
             }
         }
-
 
         // We don't complain about missing header data unless they are part of the message payload. This is
         // because AXIS may be providing these headers.

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java?view=diff&rev=537254&r1=537253&r2=537254
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java Fri May 11 11:14:26 2007
@@ -180,12 +180,13 @@
             }
         }
 
-        Node outboundMsg = getBpelRuntimeContext().fetchVariableData(
-            _scopeFrame.resolve(oinvoke.inputVar), false);
-
-        // TODO outbound message should be updated with non-initiate correlation sets
-        assert outboundMsg instanceof Element;
-        return (Element) outboundMsg;
+        if (oinvoke.operation.getInput().getMessage().getParts().size() > 0) {
+            Node outboundMsg = getBpelRuntimeContext().fetchVariableData(
+                _scopeFrame.resolve(oinvoke.inputVar), false);
+            // TODO outbound message should be updated with non-initiate correlation sets
+            assert outboundMsg instanceof Element;
+            return (Element) outboundMsg;
+        } else return null;
     }
 
     private void retryOrFailure(String reason, Element data) {

Modified: incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageDaoImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageDaoImpl.java?view=diff&rev=537254&r1=537253&r2=537254
==============================================================================
--- incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageDaoImpl.java (original)
+++ incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageDaoImpl.java Fri May 11 11:14:26 2007
@@ -20,60 +20,60 @@
 package org.apache.ode.daohib.bpel;
 
 
-import javax.xml.namespace.QName;
-
-import org.hibernate.Session;
-import org.w3c.dom.Element;
-
 import org.apache.ode.bpel.dao.MessageDAO;
 import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.daohib.SessionManager;
 import org.apache.ode.daohib.bpel.hobj.HLargeData;
 import org.apache.ode.daohib.bpel.hobj.HMessage;
 import org.apache.ode.utils.DOMUtils;
+import org.hibernate.Session;
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
 
 public class MessageDaoImpl extends HibernateDao implements MessageDAO {
 
-  private HMessage _hself;
-  private Session _session;
+    private HMessage _hself;
+    private Session _session;
+
+    protected MessageDaoImpl(SessionManager sessionManager, HMessage hobj) {
+        super(sessionManager, hobj);
+        _hself = hobj;
+        _session = sessionManager.getSession();
+    }
+
+    public void setType(QName type) {
+        _hself.setType(type == null ? null : type.toString());
+    }
+
+    public QName getType() {
+        return _hself.getType() == null ? null : QName.valueOf(_hself.getType());
+    }
+
+    public void setData(Element value) {
+        if (value == null) return;
+        if (_hself.getMessageData() != null)
+            _session.delete(_hself.getMessageData());
+        HLargeData newdata = new HLargeData(DOMUtils.domToString(value));
+        _session.save(newdata);
+        _hself.setMessageData(newdata);
+        update();
+    }
+
+    public Element getData() {
+        if (_hself.getMessageData() == null)
+            return null;
+        try {
+            return DOMUtils.stringToDOM(_hself.getMessageData().getText());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+
+    public MessageExchangeDAO getMessageExchange() {
+        return new MessageExchangeDaoImpl(_sm,_hself.getMessageExchange());
+    }
 
-  protected MessageDaoImpl(SessionManager sessionManager, HMessage hobj) {
-    super(sessionManager, hobj);
-    _hself = hobj;
-    _session = sessionManager.getSession();
-  }
-
-  public void setType(QName type) {
-    _hself.setType(type == null ? null : type.toString());
-  }
-
-  public QName getType() {
-    return _hself.getType() == null ? null : QName.valueOf(_hself.getType()); 
-  }
-
-  public void setData(Element value) {
-    if (_hself.getMessageData() != null)
-      _session.delete(_hself.getMessageData());
-    HLargeData newdata = new HLargeData(DOMUtils.domToString(value));
-    _session.save(newdata);
-    _hself.setMessageData(newdata);
-    update();
-  }
-
-  public Element getData() {
-    if (_hself.getMessageData() == null)
-      return null;
-    try {
-      return DOMUtils.stringToDOM(_hself.getMessageData().getText());
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-    
-  }
-
-  public MessageExchangeDAO getMessageExchange() {
-    return new MessageExchangeDaoImpl(_sm,_hself.getMessageExchange());
-  }
 
-  
 }

Modified: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java?view=diff&rev=537254&r1=537253&r2=537254
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java (original)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java Fri May 11 11:14:26 2007
@@ -85,7 +85,8 @@
 	}
 
 	public void setData(Element value) {
-		_data = DOMUtils.domToString(value);
+        if (value == null) return;
+        _data = DOMUtils.domToString(value);
 		_element = value;
 	}