beanshell newbie having trouble executing a remote script from a script.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

beanshell newbie having trouble executing a remote script from a script.

smarks aveksa
Hi,

I was hoping someone could help with code.

I am writing to write a bsh script that will execute another bsh on a
remote server.

I can do this successfully from the shell like this:

java http://192.168.10.59:8080/bshservlet-wbsh/eval test.bsh

I get the expected results when I execute this.

However when I try to do this from a bsh script much unhappiness ensues.

Here's the script:

import bsh.Remote;

StringBuffer resultsBuffer = new StringBuffer();

Remote.eval("http://192.168.10.59:8080/bshservlet-wbsh/eval test.bsh",
resultsBuffer);

print(resultsBuffer.toString());

When I execute like this:

java bsh.Interpreter remote-request.bsh

I get this bit of business:

Evaluation Error: Sourced file: remote-request.bsh : Error in method
invocation: Static method eval( java.lang.String,
java.lang.StringBuffer ) not found in class'bsh.Remote' : at Line: 5 :
in file: remote-request.bsh : Remote .eval (
"http://192.168.10.59:8080/bshservlet-wbsh/eval test.bsh" ,
resultsBuffer )

The javadoc here:
http://www.beanshell.org/javadoc/bsh/Remote.html#eval(java.lang.String,%20java.lang.String,%20java.lang.StringBuffer)

Lists this method:

public static int eval(java.lang.String url,
                       java.lang.String text,
                       java.lang.StringBuffer output)
                throws java.io.IOException

But that doesn't jive with the error message so I tried a one line script:

javap("bsh.Remote");

and got this:

Class class bsh.Remote extends class java.lang.Object
public static int bsh.Remote.eval(java.lang.String,java.lang.String)
throws java.io.IOException
public static void bsh.Remote.main(java.lang.String[]) throws
java.lang.Exception

This error makes the first error make more sense, and makes me think
the JavaDoc might be out of synch.

However, it lives me wondering how I can call execute a script on a
remote server from a local bsh script and capture the output.

Any help would be greatly appreciate. I am new to beanshell, and I
hope this question is not too dumb.
I am looking forward to learning more about beanshell it looks like a
great tool.

Thanks in advance!

sam


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
<a href="http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642">http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: beanshell newbie having trouble executing a remote script from a script.

patniemeyer

On Mar 9, 2006, at 7:05 PM, smarks aveksa wrote:

> The javadoc here:
> http://www.beanshell.org/javadoc/bsh/Remote.html#eval 
> (java.lang.String,%20java.lang.String,%20java.lang.StringBuffer)
>
> Lists this method:
>
> public static int eval(java.lang.String url,
>                        java.lang.String text,
>                        java.lang.StringBuffer output)
>                 throws java.io.IOException
>
> But that doesn't jive with the error message so I tried a one line  
> script:


Hmmm... sorry about that.  I don't know whether that method was just  
stubbed out at some point and not implemented or whether this class  
has slipped back somehow.  I will look into it.  If you are in a  
hurry you might simply grab the source for the Remote class and  
modify it to taste (or paste it into your script and do so)... it's  
pretty small.  Let me know if you need help.


Pat


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users