Author: mriou
Date: Mon Sep 11 11:16:45 2006
New Revision: 442280

URL: http://svn.apache.org/viewvc?view=rev&rev=442280
Log:
Adding session ids to callback header on replies.

Modified:
    
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
    
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/SessionOutHandler.java

Modified: 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java?view=diff&rev=442280&r1=442279&r2=442280
==============================================================================
--- 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java
 (original)
+++ 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java
 Mon Sep 11 11:16:45 2006
@@ -146,6 +146,9 @@
             targetEPR.setSessionId(partnerSessionId);
         }
         options.setProperty("targetSessionEndpoint", targetEPR);
+        String soapAction = SOAPUtils.getSoapAction(_definition, _serviceName, 
_portName,
+                odeMex.getOperationName());
+        options.setProperty("soapAction", soapAction);
 
         if (myRoleEPR != null)  {
             if  (myRoleSessionId != null) {

Modified: 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java?view=diff&rev=442280&r1=442279&r2=442280
==============================================================================
--- 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java 
(original)
+++ 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java 
Mon Sep 11 11:16:45 2006
@@ -80,7 +80,7 @@
     private WSAEndpoint _serviceRef;
 
     public ODEService(AxisService axisService, Definition def, QName 
serviceName, String portName, BpelServer server,
-            TransactionManager txManager) {
+                      TransactionManager txManager) {
         _axisService = axisService;
         _server = server;
         _txManager = txManager;
@@ -225,28 +225,28 @@
         boolean result = _serviceName.equals(serviceName);
         result = result
                 && 
_wsdlDef.getService(_serviceName).getPort(_portName).getBinding().getPortType().getQName().equals(
-                        portTypeName);
+                portTypeName);
         return result;
     }
 
     private void onResponse(MyRoleMessageExchange mex, MessageContext 
msgContext) throws AxisFault {
         switch (mex.getStatus()) {
-        case FAULT:
-            throw new AxisFault(null, mex.getFault(), null, null, 
OMUtils.toOM(mex.getFaultResponse().getMessage()));
-        case ASYNC:
-        case RESPONSE:
-            Element response = SOAPUtils.wrap(mex.getResponse().getMessage(), 
_wsdlDef, _serviceName, mex
-                    .getOperation(), 
mex.getOperation().getOutput().getMessage());
-            if (__log.isDebugEnabled()) __log.debug("Received response message 
" +
-                    DOMUtils.domToString(response));
-            
msgContext.getEnvelope().getBody().addChild(OMUtils.toOM(response));
-            writeHeader(msgContext, mex);
-            break;
-        case FAILURE:
-            // TODO: get failure codes out of the message.
-            throw new AxisFault("Message exchange failure!");
-        default:
-            __log.warn("Received ODE message exchange in unexpected state: " + 
mex.getStatus());
+            case FAULT:
+                throw new AxisFault(null, mex.getFault(), null, null, 
OMUtils.toOM(mex.getFaultResponse().getMessage()));
+            case ASYNC:
+            case RESPONSE:
+                Element response = 
SOAPUtils.wrap(mex.getResponse().getMessage(), _wsdlDef, _serviceName, mex
+                        .getOperation(), 
mex.getOperation().getOutput().getMessage());
+                if (__log.isDebugEnabled()) __log.debug("Received response 
message " +
+                        DOMUtils.domToString(response));
+                
msgContext.getEnvelope().getBody().addChild(OMUtils.toOM(response));
+                writeHeader(msgContext, mex);
+                break;
+            case FAILURE:
+                // TODO: get failure codes out of the message.
+                throw new AxisFault("Message exchange failure!");
+            default:
+                __log.warn("Received ODE message exchange in unexpected state: 
" + mex.getStatus());
         }
     }
 
@@ -283,33 +283,18 @@
      * injection.
      */
     private void writeHeader(MessageContext msgContext, MyRoleMessageExchange 
odeMex) {
-        // EndpointReference targetEPR = odeMex.getEndpointReference();
-        // if (targetEPR == null)
-        // return;
-        //
-        // if (targetEPR instanceof MutableEndpoint)
-        // // The target session endpoint is simply the endpoint that was
-        // invoked
-        // // (since this
-        // // is a response header)
-        // msgContext.setProperty("targetSessionEndpoint",
-        // odeMex.getEndpointReference());
-        // msgContext.setProperty("soapAction",
-        // SOAPUtils.getSoapAction(_wsdlDef, _serviceName, _portName,
-        // odeMex.getOperationName()));
-        //
-        // // The callback endpoint is going to be the same as the target
-        // endpoint
-        // // in this case, except
-        // // that it is updated with session information (if available).
-        // if
-        // (odeMex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID)!=
-        // null) {
-        // msgContext.setProperty("callbackSessionEndpoint",
-        // odeMex.getProperty("org.apache.ode.bpel.callerSessionId"));
-        // }
-        //
-        // }
+        EndpointReference targetEPR = odeMex.getEndpointReference();
+        if (targetEPR == null)
+            return;
+
+        // The callback endpoint is going to be the same as the target
+        // endpoint in this case, except that it is updated with session
+        // information (if available).
+        if 
(odeMex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID)!= null) {
+            
_serviceRef.setSessionId(odeMex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID));
+            msgContext.setProperty("callbackSessionEndpoint", _serviceRef);
+        }
+
     }
 
     public AxisService getAxisService() {

Modified: 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/SessionOutHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/SessionOutHandler.java?view=diff&rev=442280&r1=442279&r2=442280
==============================================================================
--- 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/SessionOutHandler.java
 (original)
+++ 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/SessionOutHandler.java
 Mon Sep 11 11:16:45 2006
@@ -19,21 +19,20 @@
 
 package org.apache.ode.axis2.hooks;
 
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.AxisFault;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.ode.utils.Namespaces;
-import org.apache.ode.bpel.iapi.EndpointReference;
 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.iapi.EndpointReference;
+import org.apache.ode.utils.Namespaces;
 
 /**
  * An outgoing handler adding session id information in the message
@@ -69,10 +68,10 @@
         header.addChild(to);
         to.setText(targetEpr.getUrl());
 
-//        String soapAction = (String) 
messageContext.getProperty("soapAction");
-//        OMElement wsaAction = factory.createOMElement("Action", wsAddrNS);
-//        header.addChild(wsaAction);
-//        wsaAction.setText(soapAction);
+        String soapAction = (String) messageContext.getProperty("soapAction");
+        OMElement wsaAction = factory.createOMElement("Action", wsAddrNS);
+        header.addChild(wsaAction);
+        wsaAction.setText(soapAction);
 
         if (targetEpr.getSessionId() != null) {
           OMElement session = factory.createOMElement("session", 
intalioSessNS);


Reply via email to