The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
[SOLVED] Run a bat with RapidMiner web service in c sharp
Hello.
I have a problem and you may have happened to any of you.
I have a web service that calls RapidMiner via a bat file with this execution string “C:/Archivos de Programa/Rapid-I/RapidMiner5/scripts/rapidminer.bat” –f "C:/Users/i3b2012/Desktop/ModelosRapidMiner/ModelosBranka4u/Procesos/Branka4u.xml" and if you answer "OK", I really have not run anything.
I have also tried running it through a batch file, as follows
Process myproc;
myproc = new Process();
myproc.EnableRaisingEvents = false;
ProcessStartInfo psi = new ProcessStartInfo("CMD.EXE","/C C:/TEMP/ModeloBranka.bat");
psi.UseShellExecute = false;
psi.WindowStyle = ProcessWindowStyle.Minimized;
myproc.StartInfo = psi;
// comienza
myproc.Start();
I searched the Internet and found some cases where the same thing happens with ASP applications and say it is a permissions problem and you need to give permissions to the account of the work process so you can interact with the desktop or to be run in the SYSTEM account. This I have done.
They also say that you have to activate the IIS Admin Service to interact with desktop and I have done this too.
And still can not run the process in the web service, if I run out, or with RapidMiner or running. Bat works perfectly.
I have a problem and you may have happened to any of you.
I have a web service that calls RapidMiner via a bat file with this execution string “C:/Archivos de Programa/Rapid-I/RapidMiner5/scripts/rapidminer.bat” –f "C:/Users/i3b2012/Desktop/ModelosRapidMiner/ModelosBranka4u/Procesos/Branka4u.xml" and if you answer "OK", I really have not run anything.
I have also tried running it through a batch file, as follows
Process myproc;
myproc = new Process();
myproc.EnableRaisingEvents = false;
ProcessStartInfo psi = new ProcessStartInfo("CMD.EXE","/C C:/TEMP/ModeloBranka.bat");
psi.UseShellExecute = false;
psi.WindowStyle = ProcessWindowStyle.Minimized;
myproc.StartInfo = psi;
// comienza
myproc.Start();
I searched the Internet and found some cases where the same thing happens with ASP applications and say it is a permissions problem and you need to give permissions to the account of the work process so you can interact with the desktop or to be run in the SYSTEM account. This I have done.
They also say that you have to activate the IIS Admin Service to interact with desktop and I have done this too.
And still can not run the process in the web service, if I run out, or with RapidMiner or running. Bat works perfectly.
0
Answers
Code java:
package com.MyAplic;
import javax.jws.WebService;
import com.rapidminer.RapidMiner;
import com.rapidminer.Process;
import com.rapidminer.example.ExampleSet;
import com.rapidminer.operator.*;
import com.rapidminer.repository.*;
@WebService(targetNamespace = "http://MyAplic.com/", portName = "ExecRapidminerWSPort", serviceName = "ExecRapidminerWSService")
public class ExecRapidminerWS {
public String execProcces(String repoPath){
try{
//System.setProperty("rapidminer.home", "C:\\Program Files\\Rapid-I\\RapidMiner5");
RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
RapidMiner.init();
RepositoryLocation pLoc = new RepositoryLocation(repoPath);
ProcessEntry pEntry = (ProcessEntry) pLoc.locateEntry();
String processXML = pEntry.retrieveXML();
Process myProcess = new Process(processXML);
IOContainer ioResult = myProcess.run();
// if (ioResult.getElementAt(0) instanceof ExampleSet) {
// ExampleSet resultSet = (ExampleSet)ioResult.getElementAt(0);
// }
return "Procces exec";
}catch(Exception e){
return e.getMessage();
}
}
}
Should be added to the web service clientExecRapidMinerWS.cs., and code webservice:
public class MyAplicWS : IMyAplicWS
{
public Result ResultRapidAnalytics()
{
Result resul = new Result();
Process p = new Process();
try
{
ExecRapidminerWSService clientExec = new ExecRapidminerWSService();
resul.Res = clientExec.execProcces("//New_MyAplic/Procdes/MyAplic"); // xml
}
catch (Exception e)
{
resul.Res = e.Message;
}
return resul;
}