03-19-2011 07:31 PM - edited 03-14-2019 07:36 AM
Hi,
I have uploaded a custom java class "jar file" to my document on the ipcc admin page
Then select it then reset the crs engine
On the script editor
Using SET step ,I modify the name of the object to the class name "testclass"
Then I successfuly find the method included in my class which named as "testmethod"
But the problem is that I don't know what to write in the expression editor to send the request to this method and get a response from it
This test is to send any string and to get 2000 "for test"
So, Do you see that I'm using the right path by using SET step
or please advise what can I do to send a variable and get a response from this java class
thanks
Solved! Go to Solution.
03-23-2011 11:25 AM
Two things I see right off the bat:
03-21-2011 09:50 AM
I have found the testmethod name when replacing the object word with the class name
Now the method appear as:
String ?.testmethod(String)
the first string word mean that this exp will give a string
but i don't know what ? or the second string mean
Only i need to send this class a string and it'll respond with a string 2000
So please help in how to send the string and where to get the response ?
I have tried the following:
SET X = testclass.testmethod('Y') : X the response , and Y is the input to the class BUT IT DIDN't WORK
SET X = testmethod('Y') DIDN'T WORK
SET X = Y.testmethod() DIDN't WORK
So please help in this how to send a string and to get back a response
thanks
03-22-2011 04:33 AM
The first String is what gets returned; a String.
The ? represents an object of your class. E.g., if my class is TestClass then an object of my class would be created like so: TestClass testObject = new TestClass;
The .testmethod() is the method your class exposes publicly for you to call. Also called an instance method. It's called like this: testObject.testmethod().
The last String, inside of your method's parenthesis, is the type of input required: a String. So this would be valid: testObject.testmethod("hello"), and this would be invalid: testObject.testmethod(45)
Does that help?
Sent from Cisco Technical Support iPhone App
03-22-2011 04:55 AM
Hi Anthony,
thanks a lot for your kind reply
Will test and feed you back
Best Regards
Haitham
03-22-2011 12:04 PM
Hi Anthony,
I have tried with a java file that get an integer and respond with integer
When I make this command:
Testjava.testIntMethod(x)
I got that error
Exception,, not a static method: testIntMethod
so i searched google of how to call non static method and found that I need to create an instance of the class; then I can use that to call non-static methods that non static methods and fields are always instance members while static methods / static fields are always class members.
So can you help me how to call this non-static method or by other means how to have an instance to call on
Thanks & Best Regards
Haitham
03-22-2011 01:20 PM
If you have a static method, this is how you call it:
TestClass.staticMethod();
If you have an instance method, this is how you call it:
TestClass testObject = new TestClass();
testObject.instanceMethod();
The difference being, in the static method example, you do not need to create an object of your class, and in the instance example you do.
Which way you choose is up to you, and how you plan on using your TestClass.
NOTE: In UCCX editor, to have an object in the global scope, meaning it can be referenced in any step in the script, create it in the variable pane first.
Have a look at this project I did, using custom Java classes in UCCX 5:
http://dl.dropbox.com/u/15705/www.avholloway.com-soap-project-offline.zip
03-23-2011 03:14 AM
Hi Anthony,
Thanks for your reply
I know that I should use an object to call the non-static method
I found on java sites something like the code you sent
But what is confusing me
Is how to write it in the expression editor of the CRS
Will I write it as java or need a special language ?
So as in the case below
I'll create a variable type object and its value will be as : TestClass testObject = new TestClass()
then using SET step to get the response on an integer X using this exp. : testObject.instanceMethod()
or using SET step and have all these in the expression editor:
{TestClass testObject = new TestClass();
testObject.instanceMethod();}
I have tried this, and a lot of other methods but always failed
Only I need to know how to use it with the expression editor, also if there is any doc help for the expression editor language guide,, that the scripting VOL3 doc on cisco was samples only with no codes help
Thanks a lot for your continous help
Best Regards
03-23-2011 04:52 AM
Your examples look correct.
Can you post a screen shot of your script editor steps and variables, and your error message or incorrect results.
Paste your java code here also.
Sent from Cisco Technical Support iPhone App
03-23-2011 10:23 AM
Hi Anthony,
Kindly find the attached java and error files
I'm trying with testIntMethod() method which return an integer value of 2000
I need to know if I should use pure java language in the expression editor or it is a special language ?
thanks a lot for your help
Best Regards
Haitham
03-23-2011 11:25 AM
Two things I see right off the bat:
03-23-2011 02:12 PM
Hi Anthony,
Thanks alot for your help
Best Regards
Haitham
03-23-2011 02:48 PM
So, it's working?
03-23-2011 04:22 PM
yes i can receive a response now
10-02-2017 03:58 AM
Hi Anthony
I have problem same his.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide