XMLRPC from Eggplant

I want to do things specific to a SUT/Server like stopping NFS , Checking a Registry key etc on SUT . It is quite difficult to do this with Eggplant so I am doing it by XMLRPC . However I am running into problems when I try to make a Applescript wrapper for the RPC Calls

The wrapper looks like this

(*Handler is the Class that will be invoked when an RPC Call is made
method is the Method is class Handler which would be invoked
Strparams is a list of arguments passed as a String sperated by commas
xmlrpcServerIP is the IPAddress of the XMLRPCServer
xmlrpcServerPort is the Port of the XMLRPCServer to connect to *)

params handler , method ,Strparams , returnVal ,xmlrpcServerIP , xmlrpcServerPort

put handler&"."&method into meth
put xmlrpcServerIP&":"&xmlrpcServerPort into servDet

if Strparams is null then
put <<return call xmlrpc { method name: “>>&meth&<<” }>> into command
else
put <<return call xmlrpc {method name:">>&meth&<<" , parameter: {“Strparams”}}>> into command
end if

do applescript merge of {{

script test
property mServerDet : “[[servDet]]”
property mServCommand : [[command]]
on func()
using terms from application “http://localhost/
tell application (“http://” & mServerDet & “/”)
return “[[command]]”
end tell
end using terms from
end func

end script

test’s func()

}}

put the result

=======

The caller is

to stopNFS sutName , handler , method ,Strparams , returnVal ,xmlrpcServerIP ,xmlrpcServerPort

ApplescriptWrapper  "nfs" , "stopNFS",  null , null ,"192.168.1.100","9000"

end stopNFS

When I run I get this error

Tue, 01/11/05 2:31:12 PM START Running Selection from /Users/qa/Eggplant/IVECommon/Utils/System.suite/Scripts/NFSUtils.script

02:31:12 Start handler 1: Execute String
ApplescriptWrapper “nfs” , “stopNFS”, null , null ,“192.168.1.100”,“9000”

02:31:12 Start handler 2: applescriptwrapper
put handler&"."&method into meth
put xmlrpcServerIP&":"&xmlrpcServerPort into servDet
if Strparams is null then
put <<call xmlrpc { method name: “>>&meth&<<” }>> into command
answer meth
answer servDet
answer command
do applescript merge of {{

02:31:15 Start handler 3:

property mServerDet : “[[servDet]]”
property mServCommand : [[command]]
return [[command]]
<<< 02:31:15 End handler 3: (normal exit)
put the result
AppleScript Error: Expected end of line, etc. but found identifier.
<<< 02:31:15 End handler 2: applescriptwrapper (normal exit)
<<< 02:31:15 End handler 1: Execute String (normal exit)
Tue, 01/11/05 2:31:15 PM DONE Selection Finished Running

Calls to AppleScript can be difficult to debug. It will probably be helpful first to see exactly what your AppleScript call looks like. I suggest that you change your script slightly in the place where you call AppleScript, to something like this:

set ASCode to merge of {{
... all your good AppleScript code is here ...
}}

put ASCode -- take a look at the code before calling it
doAppleScript ASCode

When I tried this, it appeared that your use of [[command]] was probably not giving you quite what you wanted. But I’ll leave that for you to decide. :wink:

Hopefully working with it in this way will help you figure out what you need to do to get this all working for you.