Author: mriou
Date: Mon Jul 24 18:08:55 2006
New Revision: 425243

URL: http://svn.apache.org/viewvc?rev=425243&view=rev
Log:
Sending wsa:Action together with wsa:To (and fixed a small bug in endpoints 
assignment).

Modified:
    
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/PXEService.java
    
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/SOAPUtils.java
    
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/SessionOutHandler.java
    
incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/runtime/ASSIGN.java

Modified: 
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/PXEService.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/PXEService.java?rev=425243&r1=425242&r2=425243&view=diff
==============================================================================
--- 
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/PXEService.java
 (original)
+++ 
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/PXEService.java
 Mon Jul 24 18:08:55 2006
@@ -99,14 +99,16 @@
         try {
           _txManager.commit();
         } catch (Exception e) {
-          throw new AxisFault("Commit failed!", e);
+          __log.error("COMMIT FAILED!", e);
+          success = false;
         }
-      } else {
+      }
+      if (!success) {
         __log.error("Rolling back PXE MEX "  + pxeMex );
         try {
           _txManager.rollback();
         } catch (Exception e) {
-          throw new AxisFault("Rollback failed!", e);
+          throw new AxisFault("ROLLBACK FAILED!", e);
         }
       }
 
@@ -219,6 +221,8 @@
   private void writeHeader(MessageContext msgContext, MyRoleMessageExchange 
pxeMex) {
     if (pxeMex.getEndpointReference() != null) {
       msgContext.setProperty("targetSessionEndpoint", 
pxeMex.getEndpointReference());
+      msgContext.setProperty("soapAction",
+              SOAPUtils.getSoapAction(_wsdlDef, _serviceName, _portName, 
pxeMex.getOperationName()));
     }
     if (pxeMex.getCallbackEndpointReference() != null) {
       msgContext.setProperty("callbackSessionEndpoint", 
pxeMex.getCallbackEndpointReference());

Modified: 
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/SOAPUtils.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/SOAPUtils.java?rev=425243&r1=425242&r2=425243&view=diff
==============================================================================
--- 
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/SOAPUtils.java
 (original)
+++ 
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/SOAPUtils.java
 Mon Jul 24 18:08:55 2006
@@ -10,7 +10,10 @@
 import javax.wsdl.Part;
 import javax.wsdl.Operation;
 import javax.wsdl.Message;
+import javax.wsdl.BindingOperation;
 import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.wsdl.extensions.ExtensibilityElement;
 import javax.xml.namespace.QName;
 import java.util.Collection;
 import java.util.List;
@@ -77,6 +80,31 @@
     }
   }
 
+  /**
+   * Attempts to extract the SOAP Action is defined in the WSDL document.
+   * @param def
+   * @param service
+   * @param port
+   * @param operation
+   * @return
+   */
+  public static String getSoapAction(Definition def, QName service, String 
port,  String operation) {
+    Service serviceDef = def.getService(service);
+    Port wsdlPort = serviceDef.getPort(port);
+    Binding binding = wsdlPort.getBinding();
+    for (int m = 0; m < binding.getBindingOperations().size(); m++) {
+      BindingOperation bindingOperation = (BindingOperation) 
binding.getBindingOperations().get(m);
+      if (bindingOperation.getName().equals(operation)) {
+        for (int n = 0; n < 
bindingOperation.getExtensibilityElements().size(); n++) {
+          ExtensibilityElement extElmt = (ExtensibilityElement) 
bindingOperation.getExtensibilityElements().get(n);
+          if (extElmt instanceof SOAPOperation)
+            return ((SOAPOperation)extElmt).getSoapActionURI();
+        }
+      }
+    }
+    return "";
+  }
+
   private static void copyParts(Element source, Element target, 
javax.wsdl.Message msgdef) {
     List<Part> expectedParts = msgdef.getOrderedParts(null);
 
@@ -93,7 +121,6 @@
         __log.error("Improperly formatted message, missing part: " + 
pdef.getName());
       }
     }
-
   }
 
   private static boolean isRPC(Service serviceDef) throws AxisFault {
@@ -115,4 +142,5 @@
     }
     throw new AxisFault(__msgs.msgNoBindingForService(serviceDef.getQName()));
   }
+
 }

Modified: 
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/SessionOutHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/SessionOutHandler.java?rev=425243&r1=425242&r2=425243&view=diff
==============================================================================
--- 
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/SessionOutHandler.java
 (original)
+++ 
incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/SessionOutHandler.java
 Mon Jul 24 18:08:55 2006
@@ -43,6 +43,12 @@
         OMElement to = factory.createOMElement("To", wsAddrNS);
         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);
+
         if (targetEpr.getSessionId() != null) {
           OMElement session = factory.createOMElement("session", 
intalioSessNS);
           header.addChild(session);

Modified: 
incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/runtime/ASSIGN.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/runtime/ASSIGN.java?rev=425243&r1=425242&r2=425243&view=diff
==============================================================================
--- 
incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/runtime/ASSIGN.java
 (original)
+++ 
incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/runtime/ASSIGN.java
 Mon Jul 24 18:08:55 2006
@@ -398,18 +398,6 @@
        }
 
   private void replaceEndpointRefence(PartnerLinkInstance plval, Node rvalue) 
throws FaultException {
-    // If variable is a simple type, we will get a type wrapper here (like 
xs:string
-    // or xs:uri), it's eliminated here.
-    if (rvalue.getNamespaceURI() != null && 
rvalue.getNamespaceURI().equals(Namespaces.XML_SCHEMA)) {
-      // Getting a non-empty text node
-      NodeList children = rvalue.getChildNodes();
-      for (int m = 0; m < children.getLength(); m++) {
-        Node child = children.item(m);
-        if (child.getNodeType() == Node.TEXT_NODE && 
((Text)child).getWholeText().trim().length() > 0)
-          rvalue = child;
-      }
-    }
-
     // Eventually wrapping with service-ref element if we've been directly 
assigned some
     // value that isn't wrapped.
     if (rvalue.getNodeType() == Node.TEXT_NODE ||
@@ -417,7 +405,11 @@
       Document doc = DOMUtils.newDocument();
       Element serviceRef = doc.createElementNS(Namespaces.WS_BPEL_20_NS, 
"service-ref");
       doc.appendChild(serviceRef);
-      serviceRef.appendChild(doc.importNode(rvalue, true));
+      NodeList children = rvalue.getChildNodes();
+      for (int m = 0; m < children.getLength(); m++) {
+        Node child = children.item(m);
+        serviceRef.appendChild(doc.importNode(child, true));
+      }
       rvalue = serviceRef;
     }
 


Reply via email to