Author: keith
Date: Tue Aug  5 03:43:05 2008
New Revision: 20399
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=20399

Log:
Fixing Mashup-1058. Now we can set the mep as options.mep = "in-only"; 
Supported values are in-olny and in-out


Modified:
   
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java

Modified: 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java?rev=20399&r1=20398&r2=20399&view=diff
==============================================================================
--- 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java
      (original)
+++ 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java
      Tue Aug  5 03:43:05 2008
@@ -111,6 +111,8 @@
 public class WSRequestHostImpl extends ScriptableObject {
 
     private static final long serialVersionUID = -4540679471306518117L;
+    private static final String IN_OUT = "in-out";
+    private static final String IN_ONLY = "in-only";
 
     String responseText = null;
 
@@ -137,6 +139,8 @@
 
     private String encryptionUser;
 
+    private String mep = IN_OUT;
+
     private static final int TIMEOUT_IN_MILLI_SECONDS = 60000;
 
     /**
@@ -337,6 +341,18 @@
                     && !(HTTPContentEncodingObject instanceof UniqueTag)) {
                 httpContentEncoding = HTTPContentEncodingObject.toString();
             }
+
+            Object mepObject = optionsArray.get("mep", optionsArray);
+            if (mepObject != null &&
+                    !(mepObject instanceof Undefined)
+                    && !(mepObject instanceof UniqueTag)) {
+                String mepValue  = mepObject.toString();
+                if (IN_OUT.equalsIgnoreCase(mepValue) || 
IN_ONLY.equalsIgnoreCase(mepValue)) {
+                    wsRequest.mep = mepValue;
+                } else {
+                    throw new Error("Invalid value for mep. Supported values 
are in-out and in-only");
+                }
+            }
         }
         try {
             wsRequest.sender =
@@ -451,8 +467,8 @@
                        WSDLReader reader = 
WSDLFactory.newInstance().newWSDLReader();
                        reader.setFeature("javax.wsdl.importDocuments", true);
                        Definition definition = 
reader.readWSDL(getBaseURI(wsdlURL), doc);
-            Service service = null;
-            Port returnPort = null;
+            Service service;
+            Port returnPort;
             if (serviceQName == null) {
                 Map services = definition.getServices();
                 service = null;
@@ -572,6 +588,18 @@
                         && !(encryptionUserObject instanceof UniqueTag)) {
                     wsRequest.encryptionUser = encryptionUserObject.toString();
                 }
+
+                Object mepObject = optionsArray.get("mep", optionsArray);
+                if (mepObject != null && !(mepObject instanceof Undefined)
+                        && !(mepObject instanceof UniqueTag)) {
+                    String mepValue = mepObject.toString();
+                    if (IN_OUT.equalsIgnoreCase(mepValue) || 
IN_ONLY.equalsIgnoreCase(mepValue)) {
+                        wsRequest.mep = mepValue;
+                    } else {
+                        throw new Error(
+                                "Invalid value for mep. Supported values are 
in-out and in-only");
+                    }
+                }
             }
             wsRequest.targetNamespace = definition.getTargetNamespace();
             } catch (MalformedURLException e) {
@@ -708,10 +736,18 @@
                 if (wsRequest.wsdlMode) {
                     engageSecurity(wsRequest, operationName);
                     setSSLProperties(wsRequest);
-                    wsRequest.sender.sendReceiveNonBlocking(operationName, 
payloadElement, callback);
+                    if (IN_ONLY.equalsIgnoreCase(wsRequest.mep)) {
+                        wsRequest.sender.fireAndForget(operationName, 
payloadElement);
+                    } else {
+                        wsRequest.sender.sendReceiveNonBlocking(operationName, 
payloadElement, callback);
+                    }
                 } else {
                     setSSLProperties(wsRequest);
-                    wsRequest.sender.sendReceiveNonBlocking(payloadElement, 
callback);
+                    if (IN_ONLY.equalsIgnoreCase(wsRequest.mep)) {
+                        wsRequest.sender.fireAndForget(payloadElement);
+                    } else {
+                        
wsRequest.sender.sendReceiveNonBlocking(payloadElement, callback);
+                    }
                 }
                 wsRequest.readyState = 2;
             } else { // synchronous call to send()
@@ -720,12 +756,23 @@
                 if (wsRequest.wsdlMode) {
                     engageSecurity(wsRequest, operationName);
                     setSSLProperties(wsRequest);
-                    wsRequest.responseXML = 
wsRequest.sender.sendReceive(operationName, payloadElement);
+                    if (IN_ONLY.equalsIgnoreCase(wsRequest.mep)) {
+                        wsRequest.sender.fireAndForget(operationName, 
payloadElement);
+                        wsRequest.readyState = 2;
+                    } else {
+                        wsRequest.responseXML = 
wsRequest.sender.sendReceive(operationName, payloadElement);
+                        wsRequest.readyState = 4;
+                    }
                 } else {
                     setSSLProperties(wsRequest);
-                    wsRequest.responseXML = 
wsRequest.sender.sendReceive(payloadElement);
+                    if (IN_ONLY.equalsIgnoreCase(wsRequest.mep)) {
+                        wsRequest.sender.fireAndForget(payloadElement);
+                        wsRequest.readyState = 2;
+                    } else {
+                        wsRequest.responseXML = 
wsRequest.sender.sendReceive(payloadElement);
+                        wsRequest.readyState = 4;
+                    }
                 }
-                wsRequest.readyState = 4;
             }
             // Calling onreadystatechange function
             if (wsRequest.onReadyStateChangeFunction != null) {

_______________________________________________
Mashup-dev mailing list
[email protected]
http://mailman.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to