MID Server Script Include expect - Custom Java Package Call

adriantan08
Giga Expert

Hi, Guys.

Need some help here. I have a custom Java application - literally doing a hello world right now. 

I followed this youtube tutorial by Mr. Andersen- https://www.youtube.com/watch?v=tOHuFVE3XNQ

I made sure that the JAR file is available in the MID server already via MID Server JAR Files.

Here is my Java class:

package com.xsltprocessor;

public class Processor {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println("hello");
		
	}
	public Processor(){
	
	}
	public String HeartBeat(String s){
		String x = s+" - append.";
		return x;
	}
}

 

Also, here's the payload I am passing:

<parameters>
	<parameter name="script" value="var test = new Packages.com.xsltprocessor.Processor(); test.HeartBeat('heya');"
</parameters>

 

The returned input throws a unique error that it is looking for a MID Server Script Include. This mostly taken in the ECC QUEUE Name because I tried changing the name and it's using that always in the error message. 

 

find_real_file.png

1 ACCEPTED SOLUTION

adriantan08
Giga Expert

Figured that the best approach to test this is to create the probe via Script. I had to use the following script to run the probe:

 

var probe = new JavascriptProbe("MID SERVER");
probe.setName("NAME");
probe.setJavascript("var test = new Packages.com.xsltprocessor.Processor(); test.HeartBeat('heya');");
probe.create();

View solution in original post

3 REPLIES 3

asifnoor
Kilo Patron

Can you try passing that command inside the Name field instead of payload and check? Maybe you can run it in the background script and check.

var probe = SncProbe.get("Command");
probe.setName("var test = new Packages.com.xsltprocessor.Processor(); test.HeartBeat('heya');");
probe.create("<MID Server Name>");

then check the ECC queue with output entry and see what the output is.

Mark the comment as a correct answer and also helpful if it helps.

Now it complains that the command script include does not exist. 

 

find_real_file.png

adriantan08
Giga Expert

Figured that the best approach to test this is to create the probe via Script. I had to use the following script to run the probe:

 

var probe = new JavascriptProbe("MID SERVER");
probe.setName("NAME");
probe.setJavascript("var test = new Packages.com.xsltprocessor.Processor(); test.HeartBeat('heya');");
probe.create();