airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject [69/90] [abbrv] AIRAVATA-1124
Date Mon, 14 Apr 2014 18:31:11 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/jython/JythonRunnerTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/jython/JythonRunnerTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/jython/JythonRunnerTestCase.java
new file mode 100644
index 0000000..c7a815f
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/jython/JythonRunnerTestCase.java
@@ -0,0 +1,74 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.jython;
+
+import java.util.LinkedList;
+
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.xbaya.jython.runner.JythonRunner;
+import org.apache.airavata.xbaya.jython.script.JythonScript;
+import org.apache.airavata.xbaya.test.XBayaTestCase;
+import org.apache.airavata.xbaya.test.service.adder.AdderService;
+import org.apache.airavata.xbaya.test.service.multiplier.MultiplierService;
+import org.apache.airavata.xbaya.test.util.WorkflowCreator;
+
+public class JythonRunnerTestCase extends XBayaTestCase {
+
+    /**
+     * @throws WorkflowException
+     */
+    public void testRun() throws WorkflowException {
+
+        WorkflowCreator creator = new WorkflowCreator();
+        Workflow workflow = creator.createComplexMathWorkflow();
+        JythonScript script = new JythonScript(workflow, this.configuration);
+        script.create();
+        String jythonString = script.getJythonString();
+
+        AdderService adder = new AdderService();
+        adder.run();
+        String adderWSDLLoc = adder.getServiceWsdlLocation();
+
+        MultiplierService multiplier = new MultiplierService();
+        multiplier.run();
+        String multiplierWSDLLoc = multiplier.getServiceWsdlLocation();
+
+        LinkedList<String> arguments = new LinkedList<String>();
+        arguments.add("-topic");
+        arguments.add("complex-math");
+        arguments.add("-Adder_wsdl");
+        arguments.add(adderWSDLLoc);
+        arguments.add("-Adder_2_wsdl");
+        arguments.add(adderWSDLLoc);
+        arguments.add("-Multiplier_wsdl");
+        arguments.add(multiplierWSDLLoc);
+
+        JythonRunner runner = new JythonRunner();
+        runner.run(jythonString, arguments);
+        runner.run(jythonString, arguments);
+
+        adder.shutdownServer();
+        multiplier.shutdownServer();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/jython/JythonScriptTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/jython/JythonScriptTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/jython/JythonScriptTestCase.java
new file mode 100644
index 0000000..022b099
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/jython/JythonScriptTestCase.java
@@ -0,0 +1,131 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.jython;
+
+import java.io.IOException;
+
+import org.apache.airavata.common.utils.IOUtil;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.xbaya.jython.runner.JythonRunner;
+import org.apache.airavata.xbaya.jython.script.JythonScript;
+import org.apache.airavata.xbaya.test.XBayaTestCase;
+import org.apache.airavata.xbaya.test.service.adder.AdderService;
+import org.apache.airavata.xbaya.test.service.arrayadder.ArrayAdderService;
+import org.apache.airavata.xbaya.test.service.arraygen.ArrayGeneratorService;
+import org.apache.airavata.xbaya.test.service.multiplier.MultiplierService;
+import org.apache.airavata.xbaya.test.util.WorkflowCreator;
+
+public class JythonScriptTestCase extends XBayaTestCase {
+
+    private WorkflowCreator workflowCreator;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        this.workflowCreator = new WorkflowCreator();
+    }
+
+    /**
+     * @throws IOException
+     * @throws WorkflowException
+     */
+    public void testSimpleMath() throws IOException, WorkflowException {
+        Workflow workflow = this.workflowCreator.createSimpleMathWorkflow();
+        JythonScript script = new JythonScript(workflow, this.configuration);
+        script.create();
+        String jythonString = script.getJythonString();
+        String filename = "tmp/simple-math.py";
+        IOUtil.writeToFile(jythonString, filename);
+
+        AdderService service = new AdderService();
+        service.run();
+        String adderWSDLLoc = service.getServiceWsdlLocation();
+
+        String[] arguments = new String[] { "-Adder_add_wsdl", adderWSDLLoc };
+        JythonRunner runner = new JythonRunner();
+        runner.run(jythonString, arguments);
+
+        service.shutdownServer();
+    }
+
+    /**
+     * @throws IOException
+     * @throws WorkflowException
+     */
+    public void testComplexMath() throws IOException, WorkflowException {
+        Workflow workflow = this.workflowCreator.createComplexMathWorkflow();
+        JythonScript script = new JythonScript(workflow, this.configuration);
+        script.create();
+        String jythonString = script.getJythonString();
+        String filename = "tmp/complex-math.py";
+        IOUtil.writeToFile(jythonString, filename);
+
+        AdderService adder = new AdderService();
+        adder.run();
+        String adderWSDLLoc = adder.getServiceWsdlLocation();
+
+        MultiplierService multiplier = new MultiplierService();
+        multiplier.run();
+        String multiplierWSDLLoc = multiplier.getServiceWsdlLocation();
+
+        String[] arguments = new String[] { "-topic", "complex-math", "-Adder_add_wsdl", adderWSDLLoc,
+                "-Adder_add_2_wsdl", adderWSDLLoc, "-Multiplier_multiply_wsdl", multiplierWSDLLoc };
+
+        JythonRunner runner = new JythonRunner();
+        runner.run(jythonString, arguments);
+
+        adder.shutdownServer();
+        multiplier.shutdownServer();
+    }
+
+    /**
+     * @throws IOException
+     * @throws WorkflowException
+     */
+    public void testArray() throws IOException, WorkflowException {
+        Workflow workflow = this.workflowCreator.createArrayWorkflow();
+        JythonScript script = new JythonScript(workflow, this.configuration);
+        script.create();
+        String jythonString = script.getJythonString();
+        String filename = "tmp/array-test.py";
+        IOUtil.writeToFile(jythonString, filename);
+
+        ArrayGeneratorService arrayGenerator = new ArrayGeneratorService();
+        arrayGenerator.run();
+        String arrayGeneratorWSDLLoc = arrayGenerator.getServiceWsdlLocation();
+
+        ArrayAdderService arrayAdder = new ArrayAdderService();
+        arrayAdder.run();
+        String arrayAdderWSDLLoc = arrayAdder.getServiceWsdlLocation();
+
+        String[] arguments = new String[] { "-topic", "array-test", "-ArrayAdder_add_wsdl", arrayAdderWSDLLoc,
+                "-ArrayGenerator_generate_wsdl", arrayGeneratorWSDLLoc };
+
+        JythonRunner runner = new JythonRunner();
+        runner.run(jythonString, arguments);
+
+        arrayGenerator.shutdownServer();
+        arrayAdder.shutdownServer();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/AllServices.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/AllServices.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/AllServices.java
new file mode 100644
index 0000000..e63027b
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/AllServices.java
@@ -0,0 +1,115 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.xbaya.file.XBayaPathConstants;
+import org.apache.airavata.xbaya.test.service.adder.Adder;
+import org.apache.airavata.xbaya.test.service.adder.AdderImpl;
+import org.apache.airavata.xbaya.test.service.approver.Approver;
+import org.apache.airavata.xbaya.test.service.approver.ApproverImpl;
+import org.apache.airavata.xbaya.test.service.arrayadder.ArrayAdder;
+import org.apache.airavata.xbaya.test.service.arrayadder.ArrayAdderImpl;
+import org.apache.airavata.xbaya.test.service.arraygen.ArrayGenerator;
+import org.apache.airavata.xbaya.test.service.arraygen.ArrayGeneratorImpl;
+import org.apache.airavata.xbaya.test.service.echo.Echo;
+import org.apache.airavata.xbaya.test.service.echo.EchoImpl;
+import org.apache.airavata.xbaya.test.service.multiplier.Multiplier;
+import org.apache.airavata.xbaya.test.service.multiplier.MultiplierImpl;
+
+import xsul.lead.LeadContextHeader;
+import xsul.wsdl.WsdlDefinitions;
+import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
+import xsul.xservo.XService;
+import xsul.xservo_soap.XSoapDocLiteralService;
+import xsul.xservo_soap_http.HttpBasedServices;
+
+public class AllServices {
+
+    // private static final Logger logger = LoggerFactory.getLogger();
+
+    private int port;
+
+    private HttpBasedServices httpServices;
+
+    /**
+     * Constructs an AllService.
+     * 
+     * @param port
+     */
+    public AllServices(int port) {
+        this.port = port;
+    }
+
+    /**
+     * @throws IOException
+     */
+    public void startAll() throws IOException {
+        this.httpServices = new HttpBasedServices(this.port);
+
+        start(Adder.SERVICE_NAME, Adder.WSDL_NAME, Adder.WSDL_PATH, new AdderImpl());
+        start(Multiplier.SERVICE_NAME, Multiplier.WSDL_NAME, Multiplier.WSDL_PATH, new MultiplierImpl());
+        start(ArrayGenerator.SERVICE_NAME, ArrayGenerator.WSDL_NAME, ArrayGenerator.WSDL_PATH, new ArrayGeneratorImpl());
+        start(ArrayAdder.SERVICE_NAME, ArrayAdder.WSDL_NAME, ArrayAdder.WSDL_PATH, new ArrayAdderImpl());
+        start(Echo.SERVICE_NAME, Echo.WSDL_NAME, Echo.WSDL_PATH, new EchoImpl());
+
+        start(Approver.SERVICE_NAME, Approver.WSDL_NAME, Approver.WSDL_PATH, new ApproverImpl());
+    }
+
+    /**
+     * @param serviceName
+     * @param wsdlName
+     * @param wsdlPath
+     * @param serviceImpl
+     * @throws IOException
+     */
+    private void start(String serviceName, String wsdlName, String wsdlPath, Object serviceImpl) throws IOException {
+        String wsdlLocation = XBayaPathConstants.WSDL_DIRECTORY + File.separator + wsdlPath;
+        XService xservice = this.httpServices.addService(new XSoapDocLiteralService(serviceName, wsdlLocation,
+                serviceImpl));
+        xservice.addHandler(new StickySoapHeaderHandler("retrieve-lead-header", LeadContextHeader.TYPE));
+        xservice.startService();
+
+        WsdlDefinitions wsdl = xservice.getWsdl();
+
+        File wsdlFile = new File(Service.SAMPLE_WSDL_DIRECTORY, wsdlName);
+        XMLUtil.saveXML(wsdl, wsdlFile);
+    }
+
+    /**
+     * @param args
+     * @throws IOException
+     */
+    public static void main(String args[]) throws IOException {
+        int port = 0;
+        if (args.length == 2) {
+            if ("-port".equalsIgnoreCase(args[0])) {
+                port = Integer.parseInt(args[1]);
+            }
+        }
+        AllServices service = new AllServices(port);
+        service.startAll();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/Service.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/Service.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/Service.java
new file mode 100644
index 0000000..ca6a4df
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/Service.java
@@ -0,0 +1,44 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service;
+
+import java.io.File;
+
+import org.apache.airavata.xbaya.file.XBayaPathConstants;
+
+public interface Service {
+
+    /**
+     * SAMPLE_WSDL_DIRECTORY
+     */
+    public static final String SAMPLE_WSDL_DIRECTORY = XBayaPathConstants.WSDL_DIRECTORY + File.separator + "sample";
+
+    /**
+     * MATH_DIRECTORY_NAME
+     */
+    public static final String MATH_DIRECTORY_NAME = "math";
+
+    /**
+     * LOAD_DIRECTORY_NAME
+     */
+    public static final String LOAN_DIRECTORY_NAME = "loan";
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/ServiceNotificationSender.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/ServiceNotificationSender.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/ServiceNotificationSender.java
new file mode 100644
index 0000000..cd2db2b
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/ServiceNotificationSender.java
@@ -0,0 +1,161 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.tracking.Notifier;
+import org.apache.airavata.workflow.tracking.NotifierFactory;
+import org.apache.airavata.workflow.tracking.common.InvocationContext;
+import org.apache.airavata.workflow.tracking.common.InvocationEntity;
+import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.xmlbeans.XmlObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlDocument;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.XmlConstants;
+import xsul.lead.LeadContextHeader;
+import xsul.soap.SoapUtil;
+import xsul.soap11_util.Soap11Util;
+import xsul.soap12_util.Soap12Util;
+import xsul.xbeans_util.XBeansUtil;
+
+public class ServiceNotificationSender {
+
+    private final static Logger logger = LoggerFactory.getLogger(ServiceNotificationSender.class);
+
+    private final static String INVOKED_MESSAGE = "Service is invoked";
+
+    private final static String SENDING_RESULT_MESSAGE = "Sending successful result of invocation";
+
+    private Notifier notifier;
+
+    private InvocationEntity initiator;
+
+    private InvocationEntity receiver;
+
+    private InvocationContext invocationContext;
+
+    private WorkflowTrackingContext context;
+
+    private SoapUtil soapFragrance;
+
+    /**
+     * @param inputElement
+     * @return The ServiceNotificationSender
+     */
+    public static ServiceNotificationSender invoked(XmlElement inputElement) {
+        try {
+
+            XmlElement soapBody = (XmlElement) inputElement.getParent();
+            XmlElement soapEnvelope = (XmlElement) soapBody.getParent();
+            SoapUtil soapFragrance = SoapUtil.selectSoapFragrance(soapEnvelope,
+                    new SoapUtil[] { Soap11Util.getInstance(), Soap12Util.getInstance() });
+            XmlElement soapHeader = soapEnvelope.element(null, XmlConstants.S_HEADER);
+            XmlElement leadHeader = soapHeader.element(LeadContextHeader.NS, LeadContextHeader.TYPE.getLocalPart());
+            logger.info("leadHeader: " + XMLUtil.xmlElementToString(leadHeader));
+            if (leadHeader == null) {
+                return null;
+            }
+            LeadContextHeader leadContext = new LeadContextHeader(leadHeader);
+            ServiceNotificationSender sender = new ServiceNotificationSender(soapFragrance, leadContext);
+            sender.serviceInvoked(inputElement);
+
+            return sender;
+        } catch (RuntimeException e) {
+            logger.error(e.getMessage(), e);
+            return null;
+        }
+    }
+
+    /**
+     * Constructs a ServiceNotificationSender.
+     * 
+     * @param soapFragrance
+     * @param leadContext
+     */
+    private ServiceNotificationSender(SoapUtil soapFragrance, LeadContextHeader leadContext) {
+        this.soapFragrance = soapFragrance;
+        this.notifier = NotifierFactory.createNotifier();
+
+        URI workflowID = leadContext.getWorkflowId();
+        String serviceIDString = leadContext.getServiceId();
+        if (serviceIDString == null) {
+            serviceIDString = "serviceIDWasNull";
+        }
+        URI serviceID = URI.create(serviceIDString);
+        String nodeID = leadContext.getNodeId();
+        String timeStepString = leadContext.getTimeStep();
+        Integer timeStep = null;
+        if (timeStepString != null) {
+            try {
+                timeStep = new Integer(timeStepString);
+            } catch (NumberFormatException e) {
+                logger.error(e.getMessage(), e);
+            }
+        }
+        this.initiator = this.notifier.createEntity(workflowID, serviceID, nodeID, timeStep);
+        this.receiver = this.notifier.createEntity(workflowID, serviceID, nodeID, timeStep);
+        EndpointReference epr = new EndpointReference(leadContext.getEventSink().getAddress().toString());
+        this.context = this.notifier.createTrackingContext(new Properties(), epr.toString(), workflowID, serviceID,
+                nodeID, timeStep);
+    }
+
+    /**
+     * @param inputElement
+     */
+    private void serviceInvoked(XmlElement inputElement) {
+        XmlElement soapBody = (XmlElement) inputElement.getParent();
+        XmlElement soapEnvelope = (XmlElement) soapBody.getParent();
+        XmlElement soapHeader = soapEnvelope.element(null, XmlConstants.S_HEADER);
+        XmlObject headerObject = XBeansUtil.xmlElementToXmlObject(soapHeader);
+        XmlObject bodyObject = XBeansUtil.xmlElementToXmlObject(soapBody);
+        this.invocationContext = this.notifier.serviceInvoked(this.context, this.initiator, headerObject, bodyObject,
+                INVOKED_MESSAGE);
+    }
+
+    /**
+     * @param outputElement
+     */
+    public void sendingResult(XmlElement outputElement) {
+        try {
+            XmlDocument document = this.soapFragrance.wrapBodyContent(outputElement);
+            XmlElement soapEnvelope = document.getDocumentElement();
+            XmlElement soapHeader = soapEnvelope.element(null, XmlConstants.S_HEADER);
+            XmlElement soapBody = soapEnvelope.element(null, XmlConstants.S_BODY);
+            XmlObject headerObject = null;
+            if (soapHeader != null) {
+                headerObject = XBeansUtil.xmlElementToXmlObject(soapHeader);
+            }
+            XmlObject bodyObject = XBeansUtil.xmlElementToXmlObject(soapBody);
+            this.notifier.sendingResult(this.context, this.invocationContext, headerObject, bodyObject,
+                    SENDING_RESULT_MESSAGE);
+        } catch (RuntimeException e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/Adder.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/Adder.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/Adder.java
new file mode 100644
index 0000000..1d29245
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/Adder.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.adder;
+
+import java.io.File;
+
+import org.apache.airavata.xbaya.test.service.Service;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.xwsif_runtime.XmlElementBasedStub;
+
+public interface Adder extends XmlElementBasedStub {
+
+    /**
+     * SERVICE_NAME
+     */
+    public final static String SERVICE_NAME = "AdderService";
+
+    /**
+     * WSDL_NAME
+     */
+    public final static String WSDL_NAME = "adder.wsdl";
+
+    /**
+     * WSDL_PATH
+     */
+    public final static String WSDL_PATH = Service.MATH_DIRECTORY_NAME + File.separator + WSDL_NAME;
+
+    /**
+     * @param input
+     *            the input message
+     * @return the output message
+     */
+    public XmlElement add(XmlElement input);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderClient.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderClient.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderClient.java
new file mode 100644
index 0000000..d3cfe7c
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderClient.java
@@ -0,0 +1,114 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.adder;
+
+import java.net.URI;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.xbaya.XBayaConfiguration;
+import org.apache.airavata.xbaya.lead.LeadContextHeaderHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.lead.LeadContextHeader;
+import xsul.wsif.WSIFMessage;
+import xsul.wsif.WSIFOperation;
+import xsul.wsif.WSIFPort;
+import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
+import xsul.xwsif_runtime.WSIFClient;
+import xsul.xwsif_runtime.WSIFRuntime;
+import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
+
+public class AdderClient {
+
+    private final static Logger logger = LoggerFactory.getLogger(AdderClient.class);
+
+    private AdderService service;
+
+    /**
+     * 
+     */
+    public void run() {
+        String wsdlLoc = startServer();
+        runClient(wsdlLoc);
+        shutdownServer();
+    }
+
+    private String startServer() {
+        this.service = new AdderService();
+        this.service.run();
+        return this.service.getServiceWsdlLocation();
+    }
+
+    private void shutdownServer() {
+        this.service.shutdownServer();
+    }
+
+    private void runClient(String wsdlLoc) {
+        logger.info("Invoking operation echoString using WSDL from " + wsdlLoc);
+
+        WSIFAsyncResponsesCorrelator correlator;
+        correlator = null;
+
+        // pass some headers
+        LeadContextHeaderHelper helper = new LeadContextHeaderHelper();
+        helper.setXBayaConfiguration(new XBayaConfiguration());
+        LeadContextHeader leadContext = helper.getLeadContextHeader();
+        leadContext.setWorkflowId(URI.create("http://host/2005/11/09/workflowinstace"));
+        leadContext.setNodeId("decoder1");
+        leadContext.setTimeStep("5");
+        leadContext.setServiceId("decoder-instance-10");
+
+        WSIFClient wclient = WSIFRuntime.newClient(wsdlLoc)
+                .addHandler(new StickySoapHeaderHandler("use-lead-header", leadContext)).useAsyncMessaging(correlator)
+                .setAsyncResponseTimeoutInMs(33000L); // to simplify testing set to just few
+        // seconds
+
+        WSIFPort port = wclient.getPort();
+        WSIFOperation operation = port.createOperation("add");
+        WSIFMessage inputMessage = operation.createInputMessage();
+        WSIFMessage outputMessage = operation.createOutputMessage();
+        WSIFMessage faultMessage = operation.createFaultMessage();
+
+        inputMessage.setObjectPart("x", "2");
+        inputMessage.setObjectPart("y", "3");
+
+        logger.info("Sending a message:\n" + XMLUtil.xmlElementToString((XmlElement) inputMessage));
+        boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
+
+        XmlElement result;
+        if (success) {
+            result = (XmlElement) outputMessage;
+        } else {
+            result = (XmlElement) faultMessage;
+        }
+        logger.info("Received message:\n" + XMLUtil.xmlElementToString(result));
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        (new AdderClient()).run();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderImpl.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderImpl.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderImpl.java
new file mode 100644
index 0000000..ee37bf4
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderImpl.java
@@ -0,0 +1,79 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.adder;
+
+import java.util.Random;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.xbaya.test.service.ServiceNotificationSender;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+import org.xmlpull.v1.builder.XmlNamespace;
+
+import xsul.XmlConstants;
+
+public class AdderImpl implements Adder {
+
+    private final static Logger logger = LoggerFactory.getLogger(AdderImpl.class);
+
+    /**
+     * @see org.apache.airavata.xbaya.test.service.adder.Adder#add(org.xmlpull.v1.builder.XmlElement)
+     */
+    public XmlElement add(XmlElement inputElement) {
+        logger.info(XMLUtil.xmlElementToString(inputElement));
+        ServiceNotificationSender notifier = ServiceNotificationSender.invoked(inputElement);
+
+        XmlElement xElement = inputElement.requiredElement(null, "x");
+        XmlElement yElement = inputElement.requiredElement(null, "y");
+        String xString = xElement.requiredTextContent();
+        String yString = yElement.requiredTextContent();
+
+        int x = Integer.parseInt(xString);
+        int y = Integer.parseInt(yString);
+
+        int z = x + y;
+
+        Random random = new Random();
+        int msec = random.nextInt(5000);
+        logger.info("Sleep for " + msec + " msec");
+        try {
+            Thread.sleep(msec);
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        String zString = "" + z;
+
+        XmlNamespace namespace = XmlConstants.BUILDER.newNamespace("addertypens",
+                "http://www.extreme.indiana.edu/math/adder/xsd/");
+        XmlElement outputElement = XmlConstants.BUILDER.newFragment(namespace, "AddOutput");
+        XmlElement zElement = outputElement.addElement("z");
+        zElement.addChild(zString);
+
+        if (notifier != null) {
+            notifier.sendingResult(outputElement);
+        }
+        logger.info(XMLUtil.xmlElementToString(outputElement));
+        return outputElement;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderService.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderService.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderService.java
new file mode 100644
index 0000000..d14e5f6
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/adder/AdderService.java
@@ -0,0 +1,131 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.adder;
+
+import java.io.File;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import xsul.lead.LeadContextHeader;
+import xsul.wsdl.WsdlDefinitions;
+import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
+import xsul.xservo.XService;
+import xsul.xservo_soap.XSoapDocLiteralService;
+import xsul.xservo_soap_http.HttpBasedServices;
+
+public class AdderService {
+
+    private final static String SERVICE_NAME = "AdderService";
+
+    private final static String BASE_WSDL_LOCATION = "wsdls/math/adder.wsdl";
+
+    private final static String OUTPUT_WSDL_LOCATION = "wsdls/sample/adder.wsdl";
+
+    private final static Logger logger = LoggerFactory.getLogger(AdderService.class);
+
+    private HttpBasedServices httpServices;
+
+    private XService xservice;
+
+    private int port;
+
+    /**
+     * Constructs a AdderService.
+     */
+    public AdderService() {
+        this(0);
+    }
+
+    /**
+     * Constructs a AdderService.
+     * 
+     * @param port
+     */
+    public AdderService(int port) {
+        this.port = port;
+    }
+
+    /**
+     * Runs the service.
+     */
+    public void run() {
+        this.httpServices = new HttpBasedServices(this.port);
+        logger.info("Server started on " + this.httpServices.getServerPort());
+
+        logger.info("Using WSDL for service description from " + BASE_WSDL_LOCATION);
+        this.xservice = this.httpServices.addService(new XSoapDocLiteralService(SERVICE_NAME, BASE_WSDL_LOCATION,
+                new AdderImpl()));
+        this.xservice.addHandler(new StickySoapHeaderHandler("retrieve-lead-header", LeadContextHeader.TYPE));
+        this.xservice.startService();
+        logger.info("Service started");
+        logger.info("Service WSDL available at " + getServiceWsdlLocation());
+
+    }
+
+    /**
+     * Returns the location of the WSDL of the service.
+     * 
+     * @return The location of the WSDL of the service.
+     */
+    public String getServiceWsdlLocation() {
+        return this.httpServices.getServer().getLocation() + "/" + SERVICE_NAME + "?wsdl";
+    }
+
+    /**
+     * Returns the WSDL of the service.
+     * 
+     * @return The WSDL of the service.
+     */
+    public WsdlDefinitions getWsdl() {
+        return this.xservice.getWsdl();
+    }
+
+    /**
+     * Shutdowns the service.
+     */
+    public void shutdownServer() {
+        this.httpServices.getServer().shutdownServer();
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        try {
+            int port = 0;
+            if (args.length == 2) {
+                if ("-port".equalsIgnoreCase(args[0])) {
+                    port = Integer.parseInt(args[1]);
+                }
+            }
+            AdderService service = new AdderService(port);
+            service.run();
+            WsdlDefinitions wsdl = service.getWsdl();
+            File wsdlFile = new File(OUTPUT_WSDL_LOCATION);
+            XMLUtil.saveXML(wsdl, wsdlFile);
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/Approver.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/Approver.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/Approver.java
new file mode 100644
index 0000000..067770d
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/Approver.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.approver;
+
+import java.io.File;
+
+import org.apache.airavata.xbaya.test.service.Service;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.xwsif_runtime.XmlElementBasedStub;
+
+public interface Approver extends XmlElementBasedStub {
+
+    /**
+     * SERVICE_NAME
+     */
+    public final static String SERVICE_NAME = "ApproverService";
+
+    /**
+     * WSDL_NAME
+     */
+    public final static String WSDL_NAME = "approver.wsdl";
+
+    /**
+     * WSDL_PATH
+     */
+    public final static String WSDL_PATH = Service.LOAN_DIRECTORY_NAME + File.separator + WSDL_NAME;
+
+    /**
+     * @param input
+     *            the input message
+     * @return the output message
+     */
+    public XmlElement approve(XmlElement input);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverClient.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverClient.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverClient.java
new file mode 100644
index 0000000..954d93e
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverClient.java
@@ -0,0 +1,113 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.approver;
+
+import java.net.URI;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.xbaya.XBayaConfiguration;
+import org.apache.airavata.xbaya.lead.LeadContextHeaderHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.lead.LeadContextHeader;
+import xsul.wsif.WSIFMessage;
+import xsul.wsif.WSIFOperation;
+import xsul.wsif.WSIFPort;
+import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
+import xsul.xwsif_runtime.WSIFClient;
+import xsul.xwsif_runtime.WSIFRuntime;
+import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
+
+public class ApproverClient {
+
+    private final static Logger logger = LoggerFactory.getLogger(ApproverClient.class);
+
+    private ApproverService service;
+
+    /**
+     * 
+     */
+    public void run() {
+        String wsdlLoc = startServer();
+        runClient(wsdlLoc);
+        shutdownServer();
+    }
+
+    private String startServer() {
+        this.service = new ApproverService();
+        this.service.run();
+        return this.service.getServiceWsdlLocation();
+    }
+
+    private void shutdownServer() {
+        this.service.shutdownServer();
+    }
+
+    private void runClient(String wsdlLoc) {
+        logger.info("Invoking operation echoString using WSDL from " + wsdlLoc);
+
+        WSIFAsyncResponsesCorrelator correlator;
+        correlator = null;
+
+        // pass some headers
+        LeadContextHeaderHelper helper = new LeadContextHeaderHelper();
+        helper.setXBayaConfiguration(new XBayaConfiguration());
+        LeadContextHeader leadContext = helper.getLeadContextHeader();
+        leadContext.setWorkflowId(URI.create("http://host/2005/11/09/workflowinstace"));
+        leadContext.setNodeId("decoder1");
+        leadContext.setTimeStep("5");
+        leadContext.setServiceId("decoder-instance-10");
+
+        WSIFClient wclient = WSIFRuntime.newClient(wsdlLoc)
+                .addHandler(new StickySoapHeaderHandler("use-lead-header", leadContext)).useAsyncMessaging(correlator)
+                .setAsyncResponseTimeoutInMs(33000L); // to simplify testing set to just few
+        // seconds
+
+        WSIFPort port = wclient.getPort();
+        WSIFOperation operation = port.createOperation("approve");
+        WSIFMessage inputMessage = operation.createInputMessage();
+        WSIFMessage outputMessage = operation.createOutputMessage();
+        WSIFMessage faultMessage = operation.createFaultMessage();
+
+        inputMessage.setObjectPart("amount", "100");
+
+        logger.info("Sending a message:\n" + XMLUtil.xmlElementToString((XmlElement) inputMessage));
+        boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
+
+        XmlElement result;
+        if (success) {
+            result = (XmlElement) outputMessage;
+        } else {
+            result = (XmlElement) faultMessage;
+        }
+        logger.info("Received message:\n" + XMLUtil.xmlElementToString(result));
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        (new ApproverClient()).run();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverImpl.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverImpl.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverImpl.java
new file mode 100644
index 0000000..37bff40
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverImpl.java
@@ -0,0 +1,74 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.approver;
+
+import java.util.Random;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.xbaya.test.service.ServiceNotificationSender;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+import org.xmlpull.v1.builder.XmlNamespace;
+
+import xsul.XmlConstants;
+
+public class ApproverImpl implements Approver {
+
+    private final static Logger logger = LoggerFactory.getLogger(ApproverImpl.class);
+
+    /**
+     * @see org.apache.airavata.xbaya.test.service.approver.Approver#approve(org.xmlpull.v1.builder.XmlElement)
+     */
+    public XmlElement approve(XmlElement inputElement) {
+        logger.info(XMLUtil.xmlElementToString(inputElement));
+        ServiceNotificationSender notifier = ServiceNotificationSender.invoked(inputElement);
+
+        XmlElement amountElement = inputElement.requiredElement(null, "amount");
+        String amountString = amountElement.requiredTextContent();
+        int amount = Integer.parseInt(amountString);
+        logger.info("amount: " + amount);
+
+        Random random = new Random();
+        int msec = random.nextInt(5000);
+        logger.info("Sleep for " + msec + " msec");
+        try {
+            Thread.sleep(msec);
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        String accept = "No";
+
+        XmlNamespace namespace = XmlConstants.BUILDER.newNamespace("approvertypens",
+                "http://www.extreme.indiana.edu/loan/approver/xsd/");
+        XmlElement outputElement = XmlConstants.BUILDER.newFragment(namespace, "ApproveOutput");
+        XmlElement acceptElement = outputElement.addElement("accept");
+        acceptElement.addChild(accept);
+
+        if (notifier != null) {
+            notifier.sendingResult(outputElement);
+        }
+        logger.info(XMLUtil.xmlElementToString(outputElement));
+        return outputElement;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverService.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverService.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverService.java
new file mode 100644
index 0000000..30caac2
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/approver/ApproverService.java
@@ -0,0 +1,131 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.approver;
+
+import java.io.File;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import xsul.lead.LeadContextHeader;
+import xsul.wsdl.WsdlDefinitions;
+import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
+import xsul.xservo.XService;
+import xsul.xservo_soap.XSoapDocLiteralService;
+import xsul.xservo_soap_http.HttpBasedServices;
+
+public class ApproverService {
+
+    private final static String SERVICE_NAME = "ApproverService";
+
+    private final static String BASE_WSDL_LOCATION = "wsdls/loan/approver-wsdl.xml";
+
+    private final static String OUTPUT_WSDL_LOCATION = "wsdls/sample/approver-wsdl.xml";
+
+    private final static Logger logger = LoggerFactory.getLogger(ApproverService.class);
+
+    private HttpBasedServices httpServices;
+
+    private XService xservice;
+
+    private int port;
+
+    /**
+     * Constructs a AdderService.
+     */
+    public ApproverService() {
+        this(0);
+    }
+
+    /**
+     * Constructs a AdderService.
+     * 
+     * @param port
+     */
+    public ApproverService(int port) {
+        this.port = port;
+    }
+
+    /**
+     * Runs the service.
+     */
+    public void run() {
+        this.httpServices = new HttpBasedServices(this.port);
+        logger.info("Server started on " + this.httpServices.getServerPort());
+
+        logger.info("Using WSDL for service description from " + BASE_WSDL_LOCATION);
+        this.xservice = this.httpServices.addService(new XSoapDocLiteralService(SERVICE_NAME, BASE_WSDL_LOCATION,
+                new ApproverImpl()));
+        this.xservice.addHandler(new StickySoapHeaderHandler("retrieve-lead-header", LeadContextHeader.TYPE));
+        this.xservice.startService();
+        logger.info("Service started");
+        logger.info("Service WSDL available at " + getServiceWsdlLocation());
+
+    }
+
+    /**
+     * Returns the location of the WSDL of the service.
+     * 
+     * @return The location of the WSDL of the service.
+     */
+    public String getServiceWsdlLocation() {
+        return this.httpServices.getServer().getLocation() + "/" + SERVICE_NAME + "?wsdl";
+    }
+
+    /**
+     * Returns the WSDL of the service.
+     * 
+     * @return The WSDL of the service.
+     */
+    public WsdlDefinitions getWsdl() {
+        return this.xservice.getWsdl();
+    }
+
+    /**
+     * Shutdowns the service.
+     */
+    public void shutdownServer() {
+        this.httpServices.getServer().shutdownServer();
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        try {
+            int port = 0;
+            if (args.length == 2) {
+                if ("-port".equalsIgnoreCase(args[0])) {
+                    port = Integer.parseInt(args[1]);
+                }
+            }
+            ApproverService service = new ApproverService(port);
+            service.run();
+            WsdlDefinitions wsdl = service.getWsdl();
+            File wsdlFile = new File(OUTPUT_WSDL_LOCATION);
+            XMLUtil.saveXML(wsdl, wsdlFile);
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdder.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdder.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdder.java
new file mode 100644
index 0000000..4fc4bb9
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdder.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.arrayadder;
+
+import java.io.File;
+
+import org.apache.airavata.xbaya.test.service.Service;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.xwsif_runtime.XmlElementBasedStub;
+
+public interface ArrayAdder extends XmlElementBasedStub {
+
+    /**
+     * SERVICE_NAME
+     */
+    public final static String SERVICE_NAME = "ArrayAdderService";
+
+    /**
+     * WSDL_NAME
+     */
+    public final static String WSDL_NAME = "arrayadder.wsdl";
+
+    /**
+     * WSDL_PATH
+     */
+    public final static String WSDL_PATH = Service.MATH_DIRECTORY_NAME + File.separator + WSDL_NAME;
+
+    /**
+     * @param input
+     *            the input message
+     * @return the output message
+     */
+    public XmlElement add(XmlElement input);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderClient.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderClient.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderClient.java
new file mode 100644
index 0000000..58786e2
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderClient.java
@@ -0,0 +1,121 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.arrayadder;
+
+import java.net.URI;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.xbaya.XBayaConfiguration;
+import org.apache.airavata.xbaya.lead.LeadContextHeaderHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.XmlConstants;
+import xsul.lead.LeadContextHeader;
+import xsul.wsif.WSIFMessage;
+import xsul.wsif.WSIFOperation;
+import xsul.wsif.WSIFPort;
+import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
+import xsul.xwsif_runtime.WSIFClient;
+import xsul.xwsif_runtime.WSIFRuntime;
+import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
+
+public class ArrayAdderClient {
+
+    private final static Logger logger = LoggerFactory.getLogger(ArrayAdderClient.class);
+
+    private ArrayAdderService service;
+
+    /**
+     * 
+     */
+    public void run() {
+        String wsdlLoc = startServer();
+        runClient(wsdlLoc);
+        shutdownServer();
+    }
+
+    private String startServer() {
+        this.service = new ArrayAdderService();
+        this.service.run();
+        return this.service.getServiceWsdlLocation();
+    }
+
+    private void shutdownServer() {
+        this.service.shutdownServer();
+    }
+
+    private void runClient(String wsdlLoc) {
+        logger.info("Invoking operation add using WSDL from " + wsdlLoc);
+
+        WSIFAsyncResponsesCorrelator correlator;
+        correlator = null;
+
+        // pass some headers
+        LeadContextHeaderHelper helper = new LeadContextHeaderHelper();
+        helper.setXBayaConfiguration(new XBayaConfiguration());
+        LeadContextHeader leadContext = helper.getLeadContextHeader();
+        leadContext.setWorkflowId(URI.create("http://host/2005/11/09/workflowinstace"));
+        leadContext.setNodeId("decoder1");
+        leadContext.setTimeStep("5");
+        leadContext.setServiceId("decoder-instance-10");
+
+        WSIFClient wclient = WSIFRuntime.newClient(wsdlLoc)
+                .addHandler(new StickySoapHeaderHandler("use-lead-header", leadContext)).useAsyncMessaging(correlator)
+                .setAsyncResponseTimeoutInMs(33000L); // to simplify testing set to just few
+        // seconds
+
+        WSIFPort port = wclient.getPort();
+        WSIFOperation operation = port.createOperation("add");
+        WSIFMessage inputMessage = operation.createInputMessage();
+        WSIFMessage outputMessage = operation.createOutputMessage();
+        WSIFMessage faultMessage = operation.createFaultMessage();
+
+        // Input
+        XmlElement arrayElement = XmlConstants.BUILDER.newFragment("input");
+        for (int i = 0; i < 5; i++) {
+            XmlElement valueElement = arrayElement.addElement("value");
+            valueElement.addChild("" + i);
+        }
+
+        inputMessage.setObjectPart("input", arrayElement);
+
+        logger.info("Sending a message:\n" + XMLUtil.xmlElementToString((XmlElement) inputMessage));
+        boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
+
+        XmlElement result;
+        if (success) {
+            result = (XmlElement) outputMessage;
+        } else {
+            result = (XmlElement) faultMessage;
+        }
+        logger.info("Received message:\n" + XMLUtil.xmlElementToString(result));
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        (new ArrayAdderClient()).run();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderImpl.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderImpl.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderImpl.java
new file mode 100644
index 0000000..ab2792c
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderImpl.java
@@ -0,0 +1,83 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.arrayadder;
+
+import java.util.Iterator;
+import java.util.Random;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.xbaya.test.service.ServiceNotificationSender;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+import org.xmlpull.v1.builder.XmlNamespace;
+
+import xsul.XmlConstants;
+
+public class ArrayAdderImpl implements ArrayAdder {
+
+    private final static Logger logger = LoggerFactory.getLogger(ArrayAdderImpl.class);
+
+    /**
+     * @see org.apache.airavata.xbaya.test.service.arrayadder.ArrayAdder#add(org.xmlpull.v1.builder.XmlElement)
+     */
+    public XmlElement add(XmlElement inputElement) {
+        logger.info(XMLUtil.xmlElementToString(inputElement));
+
+        ServiceNotificationSender notifier = ServiceNotificationSender.invoked(inputElement);
+
+        XmlElement arrayElement = inputElement.requiredElement(null, "input");
+
+        int sum = 0;
+        @SuppressWarnings("rawtypes")
+		Iterator valueIt = arrayElement.elements(null, "value").iterator();
+        while (valueIt.hasNext()) {
+            XmlElement valueElement = (XmlElement) valueIt.next();
+            String valueString = valueElement.requiredTextContent();
+            int value = Integer.parseInt(valueString);
+            sum += value;
+        }
+
+        Random random = new Random();
+        int msec = random.nextInt(5000);
+        logger.info("Sleep for " + msec + " msec");
+        try {
+            Thread.sleep(msec);
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        String sumString = "" + sum;
+
+        XmlNamespace namespace = XmlConstants.BUILDER.newNamespace("typens",
+                "http://www.extreme.indiana.edu/math/arrayadder/xsd/");
+        XmlElement outputElement = XmlConstants.BUILDER.newFragment(namespace, "ArrayAdderOutput");
+        XmlElement sumElement = outputElement.addElement("sum");
+        sumElement.addChild(sumString);
+
+        if (notifier != null) {
+            notifier.sendingResult(outputElement);
+        }
+        logger.info(XMLUtil.xmlElementToString(outputElement));
+        return outputElement;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderService.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderService.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderService.java
new file mode 100644
index 0000000..b5f9cae
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arrayadder/ArrayAdderService.java
@@ -0,0 +1,131 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.arrayadder;
+
+import java.io.File;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import xsul.lead.LeadContextHeader;
+import xsul.wsdl.WsdlDefinitions;
+import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
+import xsul.xservo.XService;
+import xsul.xservo_soap.XSoapDocLiteralService;
+import xsul.xservo_soap_http.HttpBasedServices;
+
+public class ArrayAdderService {
+
+    private final static String SERVICE_NAME = "ArrayGeneratorService";
+
+    private final static String BASE_WSDL_LOCATION = "wsdls/math/arrayadder-wsdl.xml";
+
+    private final static String OUTPUT_WSDL_LOCATION = "wsdls/sample/arrayadder-wsdl.xml";
+
+    private final static Logger logger = LoggerFactory.getLogger(ArrayAdderService.class);
+
+    private HttpBasedServices httpServices;
+
+    private XService xservice;
+
+    private int port;
+
+    /**
+     * Constructs a AdderService.
+     */
+    public ArrayAdderService() {
+        this(0);
+    }
+
+    /**
+     * Constructs a AdderService.
+     * 
+     * @param port
+     */
+    public ArrayAdderService(int port) {
+        this.port = port;
+    }
+
+    /**
+     * Runs the service.
+     */
+    public void run() {
+        this.httpServices = new HttpBasedServices(this.port);
+        logger.info("Server started on " + this.httpServices.getServerPort());
+
+        logger.info("Using WSDL for service description from " + BASE_WSDL_LOCATION);
+        this.xservice = this.httpServices.addService(new XSoapDocLiteralService(SERVICE_NAME, BASE_WSDL_LOCATION,
+                new ArrayAdderImpl()));
+        this.xservice.addHandler(new StickySoapHeaderHandler("retrieve-lead-header", LeadContextHeader.TYPE));
+        this.xservice.startService();
+        logger.info("Service started");
+        logger.info("Service WSDL available at " + getServiceWsdlLocation());
+
+    }
+
+    /**
+     * Returns the location of the WSDL of the service.
+     * 
+     * @return The location of the WSDL of the service.
+     */
+    public String getServiceWsdlLocation() {
+        return this.httpServices.getServer().getLocation() + "/" + SERVICE_NAME + "?wsdl";
+    }
+
+    /**
+     * Returns the WSDL of the service.
+     * 
+     * @return The WSDL of the service.
+     */
+    public WsdlDefinitions getWsdl() {
+        return this.xservice.getWsdl();
+    }
+
+    /**
+     * Shutdowns the service.
+     */
+    public void shutdownServer() {
+        this.httpServices.getServer().shutdownServer();
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        try {
+            int port = 0;
+            if (args.length == 2) {
+                if ("-port".equalsIgnoreCase(args[0])) {
+                    port = Integer.parseInt(args[1]);
+                }
+            }
+            ArrayAdderService service = new ArrayAdderService(port);
+            service.run();
+            WsdlDefinitions wsdl = service.getWsdl();
+            File wsdlFile = new File(OUTPUT_WSDL_LOCATION);
+            XMLUtil.saveXML(wsdl, wsdlFile);
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGenerator.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGenerator.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGenerator.java
new file mode 100644
index 0000000..4ffd01b
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGenerator.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.arraygen;
+
+import java.io.File;
+
+import org.apache.airavata.xbaya.test.service.Service;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.xwsif_runtime.XmlElementBasedStub;
+
+public interface ArrayGenerator extends XmlElementBasedStub {
+
+    /**
+     * SERVICE_NAME
+     */
+    public final static String SERVICE_NAME = "ArrayGeneratorService";
+
+    /**
+     * WSDL_NAME
+     */
+    public final static String WSDL_NAME = "arraygen.wsdl";
+
+    /**
+     * WSDL_PATH
+     */
+    public final static String WSDL_PATH = Service.MATH_DIRECTORY_NAME + File.separator + WSDL_NAME;
+
+    /**
+     * @param input
+     *            the input message
+     * @return the output message
+     */
+    public XmlElement generate(XmlElement input);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorClient.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorClient.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorClient.java
new file mode 100644
index 0000000..3256d6f
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorClient.java
@@ -0,0 +1,113 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.arraygen;
+
+import java.net.URI;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.xbaya.XBayaConfiguration;
+import org.apache.airavata.xbaya.lead.LeadContextHeaderHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.lead.LeadContextHeader;
+import xsul.wsif.WSIFMessage;
+import xsul.wsif.WSIFOperation;
+import xsul.wsif.WSIFPort;
+import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
+import xsul.xwsif_runtime.WSIFClient;
+import xsul.xwsif_runtime.WSIFRuntime;
+import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
+
+public class ArrayGeneratorClient {
+
+    private final static Logger logger = LoggerFactory.getLogger(ArrayGeneratorClient.class);
+
+    private ArrayGeneratorService service;
+
+    /**
+     * 
+     */
+    public void run() {
+        String wsdlLoc = startServer();
+        runClient(wsdlLoc);
+        shutdownServer();
+    }
+
+    private String startServer() {
+        this.service = new ArrayGeneratorService();
+        this.service.run();
+        return this.service.getServiceWsdlLocation();
+    }
+
+    private void shutdownServer() {
+        this.service.shutdownServer();
+    }
+
+    private void runClient(String wsdlLoc) {
+        logger.info("Invoking operation echoString using WSDL from " + wsdlLoc);
+
+        WSIFAsyncResponsesCorrelator correlator;
+        correlator = null;
+
+        // pass some headers
+        LeadContextHeaderHelper helper = new LeadContextHeaderHelper();
+        helper.setXBayaConfiguration(new XBayaConfiguration());
+        LeadContextHeader leadContext = helper.getLeadContextHeader();
+        leadContext.setWorkflowId(URI.create("http://host/2005/11/09/workflowinstace"));
+        leadContext.setNodeId("decoder1");
+        leadContext.setTimeStep("5");
+        leadContext.setServiceId("decoder-instance-10");
+
+        WSIFClient wclient = WSIFRuntime.newClient(wsdlLoc)
+                .addHandler(new StickySoapHeaderHandler("use-lead-header", leadContext)).useAsyncMessaging(correlator)
+                .setAsyncResponseTimeoutInMs(33000L); // to simplify testing set to just few
+        // seconds
+
+        WSIFPort port = wclient.getPort();
+        WSIFOperation operation = port.createOperation("generate");
+        WSIFMessage inputMessage = operation.createInputMessage();
+        WSIFMessage outputMessage = operation.createOutputMessage();
+        WSIFMessage faultMessage = operation.createFaultMessage();
+
+        inputMessage.setObjectPart("n", "3");
+
+        logger.info("Sending a message:\n" + XMLUtil.xmlElementToString((XmlElement) inputMessage));
+        boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
+
+        XmlElement result;
+        if (success) {
+            result = (XmlElement) outputMessage;
+        } else {
+            result = (XmlElement) faultMessage;
+        }
+        logger.info("Received message:\n" + XMLUtil.xmlElementToString(result));
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        (new ArrayGeneratorClient()).run();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorImpl.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorImpl.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorImpl.java
new file mode 100644
index 0000000..3f6cb9d
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorImpl.java
@@ -0,0 +1,77 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.arraygen;
+
+import java.util.Random;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.xbaya.test.service.ServiceNotificationSender;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+import org.xmlpull.v1.builder.XmlNamespace;
+
+import xsul.XmlConstants;
+
+public class ArrayGeneratorImpl implements ArrayGenerator {
+
+    private final static Logger logger = LoggerFactory.getLogger(ArrayGeneratorImpl.class);
+
+    /**
+     * @see org.apache.airavata.xbaya.test.service.arraygen.ArrayGenerator#generate(org.xmlpull.v1.builder.XmlElement)
+     */
+    public XmlElement generate(XmlElement inputElement) {
+        logger.info(XMLUtil.xmlElementToString(inputElement));
+
+        ServiceNotificationSender notifier = ServiceNotificationSender.invoked(inputElement);
+
+        XmlElement nElement = inputElement.requiredElement(null, "n");
+        String nString = nElement.requiredTextContent();
+
+        int n = Integer.parseInt(nString);
+
+        Random random = new Random();
+        int msec = random.nextInt(5000);
+        logger.info("Sleep for " + msec + " msec");
+        try {
+            Thread.sleep(msec);
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        XmlNamespace namespace = XmlConstants.BUILDER.newNamespace("typens",
+                "http://www.extreme.indiana.edu/math/arraygen/xsd/");
+        XmlElement outputElement = XmlConstants.BUILDER.newFragment(namespace, "ArrayGeneratorOutput");
+
+        XmlElement arrayElement = outputElement.addElement("output");
+        for (int i = 0; i < n; i++) {
+            XmlElement valueElement = arrayElement.addElement("value");
+            valueElement.addChild("" + i);
+        }
+
+        if (notifier != null) {
+            notifier.sendingResult(outputElement);
+        }
+        logger.info(XMLUtil.xmlElementToString(outputElement));
+        return outputElement;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorService.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorService.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorService.java
new file mode 100644
index 0000000..5685c69
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/arraygen/ArrayGeneratorService.java
@@ -0,0 +1,131 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.arraygen;
+
+import java.io.File;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import xsul.lead.LeadContextHeader;
+import xsul.wsdl.WsdlDefinitions;
+import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
+import xsul.xservo.XService;
+import xsul.xservo_soap.XSoapDocLiteralService;
+import xsul.xservo_soap_http.HttpBasedServices;
+
+public class ArrayGeneratorService {
+
+    private final static String SERVICE_NAME = "ArrayGeneratorService";
+
+    private final static String BASE_WSDL_LOCATION = "wsdls/math/arraygen-wsdl.xml";
+
+    private final static String OUTPUT_WSDL_LOCATION = "wsdls/sample/arraygen-wsdl.xml";
+
+    private final static Logger logger = LoggerFactory.getLogger(ArrayGeneratorService.class);
+
+    private HttpBasedServices httpServices;
+
+    private XService xservice;
+
+    private int port;
+
+    /**
+     * Constructs a AdderService.
+     */
+    public ArrayGeneratorService() {
+        this(0);
+    }
+
+    /**
+     * Constructs a AdderService.
+     * 
+     * @param port
+     */
+    public ArrayGeneratorService(int port) {
+        this.port = port;
+    }
+
+    /**
+     * Runs the service.
+     */
+    public void run() {
+        this.httpServices = new HttpBasedServices(this.port);
+        logger.info("Server started on " + this.httpServices.getServerPort());
+
+        logger.info("Using WSDL for service description from " + BASE_WSDL_LOCATION);
+        this.xservice = this.httpServices.addService(new XSoapDocLiteralService(SERVICE_NAME, BASE_WSDL_LOCATION,
+                new ArrayGeneratorImpl()));
+        this.xservice.addHandler(new StickySoapHeaderHandler("retrieve-lead-header", LeadContextHeader.TYPE));
+        this.xservice.startService();
+        logger.info("Service started");
+        logger.info("Service WSDL available at " + getServiceWsdlLocation());
+
+    }
+
+    /**
+     * Returns the location of the WSDL of the service.
+     * 
+     * @return The location of the WSDL of the service.
+     */
+    public String getServiceWsdlLocation() {
+        return this.httpServices.getServer().getLocation() + "/" + SERVICE_NAME + "?wsdl";
+    }
+
+    /**
+     * Returns the WSDL of the service.
+     * 
+     * @return The WSDL of the service.
+     */
+    public WsdlDefinitions getWsdl() {
+        return this.xservice.getWsdl();
+    }
+
+    /**
+     * Shutdowns the service.
+     */
+    public void shutdownServer() {
+        this.httpServices.getServer().shutdownServer();
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        try {
+            int port = 0;
+            if (args.length == 2) {
+                if ("-port".equalsIgnoreCase(args[0])) {
+                    port = Integer.parseInt(args[1]);
+                }
+            }
+            ArrayGeneratorService service = new ArrayGeneratorService(port);
+            service.run();
+            WsdlDefinitions wsdl = service.getWsdl();
+            File wsdlFile = new File(OUTPUT_WSDL_LOCATION);
+            XMLUtil.saveXML(wsdl, wsdlFile);
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/echo/Echo.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/echo/Echo.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/echo/Echo.java
new file mode 100644
index 0000000..bfc22db
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/service/echo/Echo.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test.service.echo;
+
+import java.io.File;
+
+import org.apache.airavata.xbaya.test.service.Service;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.xwsif_runtime.XmlElementBasedStub;
+
+public interface Echo extends XmlElementBasedStub {
+
+    /**
+     * SERVICE_NAME
+     */
+    public final static String SERVICE_NAME = "EchoService";
+
+    /**
+     * WSDL_NAME
+     */
+    public final static String WSDL_NAME = "echo.wsdl";
+
+    /**
+     * WSDL_PATH
+     */
+    public final static String WSDL_PATH = Service.MATH_DIRECTORY_NAME + File.separator + WSDL_NAME;
+
+    /**
+     * @param input
+     *            the input message
+     * @return the output message
+     */
+    public XmlElement echo(XmlElement input);
+}
\ No newline at end of file


Mime
View raw message