Author: vanto
Date: Wed Dec 17 03:54:04 2008
New Revision: 727350

URL: http://svn.apache.org/viewvc?rev=727350&view=rev
Log:
fixing ODE-465 in 1.x - code review welcome :)

Modified:
    
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
    
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/hooks/SessionOutHandler.java
    
ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/bpel/epr/WSAEndpoint.java
    
ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/bpel/epr/WSDL20Endpoint.java
    
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/Namespaces.java

Modified: 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java?rev=727350&r1=727349&r2=727350&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
 Wed Dec 17 03:54:04 2008
@@ -43,6 +43,7 @@
 import org.apache.ode.bpel.epr.EndpointFactory;
 import org.apache.ode.bpel.epr.MutableEndpoint;
 import org.apache.ode.bpel.epr.WSAEndpoint;
+import org.apache.ode.bpel.epr.WSDL20Endpoint;
 import org.apache.ode.bpel.iapi.BpelServer;
 import org.apache.ode.bpel.iapi.Message;
 import org.apache.ode.bpel.iapi.MessageExchange;
@@ -333,12 +334,12 @@
                if (myRoleSessionId != null) {
                    options.setProperty(JMSConstants.JMS_COORELATION_ID, 
myRoleSessionId);
                } else {
-                       Element sessionElement = 
DOMUtils.findChildByName(serviceElement, 
-                                       new 
QName(Namespaces.INTALIO_SESSION_NS, "session"), true);
-                       myRoleSessionId = sessionElement.getNodeValue();
-                       if (myRoleSessionId != null) {
-                           
options.setProperty(JMSConstants.JMS_COORELATION_ID, myRoleSessionId);
-                       }
+                if (odeMex.getMyRoleEndpointReference() instanceof 
MutableEndpoint) {
+                       WSAEndpoint epr = 
EndpointFactory.convertToWSA((MutableEndpoint) 
odeMex.getMyRoleEndpointReference());
+                       if (epr.getSessionId() != null) {
+                               
options.setProperty(JMSConstants.JMS_COORELATION_ID, myRoleSessionId);
+                       }
+                }
                }
 
             Element address = DOMUtils.findChildByName(serviceElement, 

Modified: 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/hooks/SessionOutHandler.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/hooks/SessionOutHandler.java?rev=727350&r1=727349&r2=727350&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/hooks/SessionOutHandler.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/hooks/SessionOutHandler.java
 Wed Dec 17 03:54:04 2008
@@ -57,6 +57,7 @@
             SOAPHeader header = messageContext.getEnvelope().getHeader();
             SOAPFactory factory = (SOAPFactory) 
messageContext.getEnvelope().getOMFactory();
             OMNamespace intalioSessNS = 
factory.createOMNamespace(Namespaces.INTALIO_SESSION_NS, "intalio");
+            OMNamespace odeSessNS = 
factory.createOMNamespace(Namespaces.ODE_SESSION_NS, "odesession");
             OMNamespace wsAddrNS = 
factory.createOMNamespace(Namespaces.WS_ADDRESSING_NS, "addr");
             if (header == null) {
                 header = 
factory.createSOAPHeader(messageContext.getEnvelope());
@@ -91,7 +92,11 @@
                 }
                    
                 if (targetEpr.getSessionId() != null) {
-                    OMElement session = 
factory.createSOAPHeaderBlock("session", intalioSessNS);
+                    OMElement session = 
factory.createSOAPHeaderBlock("session", odeSessNS);
+                    header.addChild(session);
+                    session.setText(targetEpr.getSessionId());
+                    // same for intalio
+                       session = factory.createSOAPHeaderBlock("session", 
intalioSessNS);
                     header.addChild(session);
                     session.setText(targetEpr.getSessionId());
                 }
@@ -100,15 +105,21 @@
 
             if (ocallbackSession != null && ocallbackSession instanceof 
MutableEndpoint) {
                 WSAEndpoint callbackEpr = 
EndpointFactory.convertToWSA((MutableEndpoint) ocallbackSession);
-                OMElement callback = factory.createSOAPHeaderBlock("callback", 
intalioSessNS);
-                header.addChild(callback);
+                OMElement odeCallback = 
factory.createSOAPHeaderBlock("callback", odeSessNS);
+                OMElement intCallback = 
factory.createSOAPHeaderBlock("callback", intalioSessNS);
+                header.addChild(odeCallback);
+                header.addChild(intCallback);
                 OMElement address = factory.createOMElement("Address", 
wsAddrNS);
-                callback.addChild(address);
+                odeCallback.addChild(address);
+                intCallback.addChild(address.cloneOMElement());
                 address.setText(callbackEpr.getUrl());
                 if (callbackEpr.getSessionId() != null) {
-                    OMElement session = factory.createOMElement("session", 
intalioSessNS);
-                    session.setText(callbackEpr.getSessionId());
-                    callback.addChild(session);
+                       OMElement odeSession = 
factory.createOMElement("session", odeSessNS);
+                       OMElement intSession = 
factory.createOMElement("session", intalioSessNS);
+                    odeSession.setText(callbackEpr.getSessionId());
+                    intSession.setText(callbackEpr.getSessionId());
+                    odeCallback.addChild(odeSession);
+                    intCallback.addChild(intSession);
                 }
                 __log.debug("Sending stateful FROM epr in message header using 
session " + callbackEpr.getSessionId());
             }

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/bpel/epr/WSAEndpoint.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/bpel/epr/WSAEndpoint.java?rev=727350&r1=727349&r2=727350&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/bpel/epr/WSAEndpoint.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/bpel/epr/WSAEndpoint.java
 Wed Dec 17 03:54:04 2008
@@ -50,15 +50,31 @@
     }
 
     public String getSessionId() {
-        NodeList idNodes = 
_eprElmt.getElementsByTagNameNS(Namespaces.INTALIO_SESSION_NS, "session");
-        if (idNodes.getLength() > 0)
+        NodeList idNodes = 
_eprElmt.getElementsByTagNameNS(Namespaces.ODE_SESSION_NS, "session");
+        if (idNodes.getLength() > 0) {
             return idNodes.item(0).getTextContent();
-        else
-            return null;
+        } else {
+               // try the same with the intalio header
+            idNodes = 
_eprElmt.getElementsByTagNameNS(Namespaces.INTALIO_SESSION_NS, "session");
+            if (idNodes.getLength() > 0) {
+                return idNodes.item(0).getTextContent();
+            } 
+               return null;
+        }
     }
 
     public void setSessionId(String sessionId) {
-        NodeList idList = 
_eprElmt.getElementsByTagNameNS(Namespaces.INTALIO_SESSION_NS, "session");
+        NodeList idList = 
_eprElmt.getElementsByTagNameNS(Namespaces.ODE_SESSION_NS, "session");
+        if (idList.getLength() > 0)
+            idList.item(0).setTextContent(sessionId);
+        else {
+            Element sessElmt = 
_eprElmt.getOwnerDocument().createElementNS(Namespaces.ODE_SESSION_NS, 
"session");
+            sessElmt.setTextContent(sessionId);
+            _eprElmt.appendChild(sessElmt);
+        }
+
+       // and the same for the intalio header
+        idList = 
_eprElmt.getElementsByTagNameNS(Namespaces.INTALIO_SESSION_NS, "session");
         if (idList.getLength() > 0)
             idList.item(0).setTextContent(sessionId);
         else {
@@ -190,7 +206,11 @@
         Element addrElmt = doc.createElementNS(Namespaces.WS_ADDRESSING_NS, 
"Address");
         addrElmt.setTextContent((String) eprMap.get(ADDRESS));
         if (eprMap.get(SESSION) != null) {
-            Element sessElmt = 
doc.createElementNS(Namespaces.INTALIO_SESSION_NS, "session");
+            Element sessElmt = doc.createElementNS(Namespaces.ODE_SESSION_NS, 
"session");
+            sessElmt.setTextContent((String) eprMap.get(SESSION));
+            _eprElmt.appendChild(sessElmt);
+            // and the same for the (deprecated) intalio namespace for 
backward compatibility
+            sessElmt = doc.createElementNS(Namespaces.INTALIO_SESSION_NS, 
"session");
             sessElmt.setTextContent((String) eprMap.get(SESSION));
             _eprElmt.appendChild(sessElmt);
         }

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/bpel/epr/WSDL20Endpoint.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/bpel/epr/WSDL20Endpoint.java?rev=727350&r1=727349&r2=727350&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/bpel/epr/WSDL20Endpoint.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-epr/src/main/java/org/apache/ode/bpel/epr/WSDL20Endpoint.java
 Wed Dec 17 03:54:04 2008
@@ -40,25 +40,44 @@
   }
 
   public String getSessionId() {
-    Element endpointElmt = 
(Element)_serviceElmt.getElementsByTagNameNS(Namespaces.WSDL_20, 
"endpoint").item(0);
-    NodeList idNodes = 
endpointElmt.getElementsByTagNameNS(Namespaces.INTALIO_SESSION_NS, "session");
-    if (idNodes.getLength() > 0) return idNodes.item(0).getTextContent();
-    else return null;
+         Element endpointElmt = 
(Element)_serviceElmt.getElementsByTagNameNS(Namespaces.WSDL_20, 
"endpoint").item(0);
+         NodeList idNodes = 
endpointElmt.getElementsByTagNameNS(Namespaces.ODE_SESSION_NS, "session");
+         if (idNodes.getLength() > 0) {
+                 return idNodes.item(0).getTextContent();
+         } else {
+                 // try the same with the intalio header
+                 idNodes = 
endpointElmt.getElementsByTagNameNS(Namespaces.INTALIO_SESSION_NS, "session");
+                 if (idNodes.getLength() > 0) {
+                         return idNodes.item(0).getTextContent();
+                 } 
+                 return null;
+         }
   }
 
   public void setSessionId(String sessionId) {
-    Element endpointElmt = 
(Element)_serviceElmt.getElementsByTagNameNS(Namespaces.WSDL_20, 
"endpoint").item(0);
-    NodeList idList = 
endpointElmt.getElementsByTagNameNS(Namespaces.INTALIO_SESSION_NS, "session");
-    if (idList.getLength() > 0) idList.item(0).setTextContent(sessionId);
-    else {
-      Element sessElmt = 
_serviceElmt.getOwnerDocument().createElementNS(Namespaces.INTALIO_SESSION_NS, 
"session");
-      sessElmt.setTextContent(sessionId);
-      endpointElmt.appendChild(sessElmt);
-    }
+         Element endpointElmt = 
(Element)_serviceElmt.getElementsByTagNameNS(Namespaces.WSDL_20, 
"endpoint").item(0);
+         NodeList idList = 
endpointElmt.getElementsByTagNameNS(Namespaces.ODE_SESSION_NS, "session");
+         if (idList.getLength() > 0)
+                 idList.item(0).setTextContent(sessionId);
+         else {
+                 Element sessElmt = 
endpointElmt.getOwnerDocument().createElementNS(Namespaces.ODE_SESSION_NS, 
"session");
+                 sessElmt.setTextContent(sessionId);
+                 endpointElmt.appendChild(sessElmt);
+         }
+
+         // and the same for the intalio header
+         idList = 
endpointElmt.getElementsByTagNameNS(Namespaces.INTALIO_SESSION_NS, "session");
+         if (idList.getLength() > 0)
+                 idList.item(0).setTextContent(sessionId);
+         else {
+                 Element sessElmt = 
endpointElmt.getOwnerDocument().createElementNS(Namespaces.INTALIO_SESSION_NS, 
"session");
+                 sessElmt.setTextContent(sessionId);
+                 endpointElmt.appendChild(sessElmt);
+         }
   }
 
   public String getUrl() {
-    return ((Element)_serviceElmt.getElementsByTagNameNS(Namespaces.WSDL_20, 
"endpoint").item(0)).getAttribute("address");
+         return 
((Element)_serviceElmt.getElementsByTagNameNS(Namespaces.WSDL_20, 
"endpoint").item(0)).getAttribute("address");
   }
 
   public void setUrl(String url) {
@@ -105,7 +124,7 @@
     HashMap<String,String> result = new HashMap<String,String>(1);
     result.put(ADDRESS, getUrl());
     String sid = getSessionId();
-    if (sid != null) result.put(ADDRESS, sid);
+    if (sid != null) result.put(SESSION, sid);
     return result;
   }
 
@@ -122,9 +141,13 @@
     endpoint.setAttribute("binding", "");
     if (eprMap.get(ADDRESS) != null) endpoint.setAttribute("address", (String) 
eprMap.get(ADDRESS));
     if (eprMap.get(SESSION) != null) {
-      Element session = doc.createElementNS(Namespaces.INTALIO_SESSION_NS, 
"session");
-      session.setTextContent((String) eprMap.get(SESSION));
-      endpoint.appendChild(session);
+        Element session = doc.createElementNS(Namespaces.ODE_SESSION_NS, 
"session");
+        session.setTextContent((String) eprMap.get(SESSION));
+        endpoint.appendChild(session);
+        // plus the deprecated intalio header
+       session = doc.createElementNS(Namespaces.INTALIO_SESSION_NS, "session");
+       session.setTextContent((String) eprMap.get(SESSION));
+       endpoint.appendChild(session);
     }
     _serviceElmt.appendChild(endpoint);
     doc.appendChild(_serviceElmt);

Modified: 
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/Namespaces.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/Namespaces.java?rev=727350&r1=727349&r2=727350&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/Namespaces.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/Namespaces.java
 Wed Dec 17 03:54:04 2008
@@ -60,6 +60,7 @@
     public static final String ODE_EXTENSION_NS = 
"http://www.apache.org/ode/type/extension";;
     public static final String ODE_HTTP_EXTENSION_NS = 
"http://www.apache.org/ode/type/extension/http";;
     public static final String INTALIO_SESSION_NS = 
"http://www.intalio.com/type/session";;
+    public static final String ODE_SESSION_NS = 
"http://www.apache.org/ode/type/session";;
     public static final String DEPRECATED_XDT_NS = 
"http://www.w3.org/2003/11/xpath-datatypes";;
 
 }


Reply via email to