Oh! Thanks for replying!!

Yesterday, I wrote similar program (basically made few
changes in my old program for SWAMP) and started
working with it I am attaching it for your reference. 

I am setting a variable called arguments in my work
flow which has the sequence in which process variable
need to be passed as a parameter. I then use SWAMP
built in methods to get the values.

Please feel free to comment on it.


One more thing is that SWAMP.pm dosen't work as
expected for me. 

my $url      =
'http://localhost:8080/axis/services/swamp?wsdl';
my $swamp = SUSE::Swamp->new($url);

It gives runtime error at line 200. 

What's wrong with this code?? 

So I made few changes in Swamp.pm as , 
 my $endpoint = "http://localhost:8080/axis";;
 my $uri = "SWAMP";
$self->{soap} =
SOAP::Lite->uri($uri)->proxy($endpoint);
& then it works.



Regards, 
Deepali



                
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/
/*************************************************************************
# Copyright (c) 2001, 2002, 2003, 2005, 2006 Tata Infotech Ltd.
# Copyright (c) 2006 Tata Consultancy Services Ltd.
#************************************************************************

# $Id$

#  ExegenixAction class for Swamp workflow */

package com.exegenix;

import de.suse.swamp.core.container.*;
import de.suse.swamp.core.workflow.*;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
import java.util.Vector;
import de.suse.swamp.core.security.*;
import de.suse.swamp.core.util.*;
import de.suse.swamp.core.util.SecurityException;
import de.suse.swamp.util.*;
import de.suse.swamp.core.conditions.*;
import de.suse.swamp.core.data.*;
import de.suse.swamp.core.filter.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
 * @author Deepali
 * 
*/

public class ExegenixAction1 {
	String execString="";
	Vector myVect = new Vector();
	String BufLine;
	/* arguments variable contains the parameters supplied to the variable separeted by '*' 
	
	<scriptaction name="WriteExilTaskSetProgram">
	<description>Setting the required variables</description>
	<script>
	$wf.getDatabit("exegenixdataset.Program").setValue("/home/taka/deepali/ShellScripts/swampWriteExil.sh")
	</script>
	</scriptaction>

	<scriptaction name="WriteExilTaskSetArguments">
	<description>Setting the required variables</description>
	<script>
	$wf.getDatabit("exegenixdataset.arguments").setValue("Program*FilePath*FileName")
	</script>
	</scriptaction>
	
	//FilePath and FileName variables are already set

	<customtask name="WriteExilTask" eventtype="WRITEEXIL_OK"
	class="com.exegenix.ExegenixAction"
	function="callScript">
	<description>calling Write Exil</description>

	*/
	public Boolean callScript(Integer wid, Integer userId) throws Exception {
		Workflow wf = WorkflowManager.getInstance().getWorkflow(wid.intValue());
		String arguments = wf.getDatabitValue("exegenixdataset.arguments");
		Logger.DEBUG("arguments are : "+arguments);
		try{
		   myVect = (Vector) mapVariables(arguments);
		   if(myVect.isEmpty() == false){
			   ListIterator myVectIterator =myVect.listIterator();
			   int x = 0;
			   String arg = "";
			   while(myVectIterator.hasNext()){
				   arg = (String) myVectIterator.next();
				   //Logger.DEBUG("arg is " +arg);
				   String argValueToGet= "exegenixdataset."+arg;
				   //Logger.DEBUG("argValueToGet is : "+argValueToGet);
				   //Logger.DEBUG("going to get value as : "+(String) wf.getDatabitValue(argValueToGet));	
				   execString =execString +(String) wf.getDatabitValue(argValueToGet)+" ";
		    		   //Logger.DEBUG("execString : "+execString);
				   
			     }
			   //Logger.DEBUG("execstring is : "+execString);
		  }
		    
		}
		catch(Exception ex){Logger.DEBUG("Error in map variable");}
       		try{
			Process p = Runtime.getRuntime().exec(execString);
			Logger.DEBUG( "launching process");
			InputStream inputStream = p.getInputStream();
       			InputStreamReader ir = new InputStreamReader(inStream);
			BufferedReader bufReader = new BufferedReader(new InputStreamReader(inputStream));
			try {
			bufLine = bufReader.readLine();
				while(bufLine != null){
				//Do what you want to do after comparing the stream
				bufLine = bufReader.readLine();
			 	}
               		}
			catch(Exception ex1){
			}    				
			int outCode = p.waitFor();

 
		return Boolean.TRUE;
	}

	
	public Object mapVariables(String NameOfTheArguments){
		Logger.DEBUG("************In MapVariables************************");
		String variableArguments  = NameOfTheArguments;
		String[] myMapArray = null;
		Vector myMapVect = new Vector();
		try{
		Logger.DEBUG("variableArguments : "+variableArguments);
		myMapArray = variableArguments.split("\\*");
		
		Logger.DEBUG("************storing variables in var Array************************");
		for (int x= 0; x< myMapArray.length; x++){
			
		myMapVect.add(x,myMapArray[x]);
		}
		}catch(Exception ex2){Logger.DEBUG("Can't split");}
		return myMapVect;
	}	
    
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
swamp-devel mailing list
swamp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swamp-devel
http://swamp.sf.net 

Reply via email to