cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
19241
Views
53
Helpful
65
Replies

How-To: Using a custom Java class in UCCX 5.x (SOAP Example)

Anthony Holloway
Cisco Employee
Cisco Employee

Update: Due to the loss of dropbox, the links to dropbox offline project are no longer active.  Please use this awesome document as your new reference:

https://supportforums.cisco.com/document/97736/uccx-8x-really-simple-soap-client-no-custom-jar

 

Update:  Due to a server failure, the links to http://www.avholloway.com/ are no longer active.  Please download the offline project.

 

This tutorial can be viewed in its entirety on my web site:

 

http://www.avholloway.com/vtools/ipcc/custom-java/soap/

 

The first thing we need to do is find out what version of Java is our server running, this way we know which version of Java to compile in.

 

This document outlines the JRE (Java Runtime Environment) version compatibility with all versions of CRS:

"Cisco Customer Response Solutions (CRS) Software and Hardware Compatibility Guide" - June 16, 2008

http://www.cisco.com/en/US/docs/voice_ip_comm/cust_contact/contact_center/crs/express_compatibility/matrix/crscomtx.pdf

 

According to that document, my version of CRS, v5.0(1) SR2, uses JRE 1.5.0.  So I will go to Sun's site and download the JDK (Java Development Kit) for that version.

 

Alternatively, you could determine the Java version right on the CRS server itself.  Though, there could be multiple JRE's installed, and the CRS Engine uses only the one listed in the above document.

 

Sun's page for previous JDK versions:

http://java.sun.com/javase/downloads/previous.jsp

 

I would typically install the JDK and JRE for 1.5.0 on my personal computer and not on the server.  This way I can do all of my Java testing offline, making sure it all works, before even uploading it to the server.  I did one additional, and optional, thing to make developing easier.  I added the bin directory to my path variable so I can execute the necessary Java commands from any directory.  This is outlined in the installation instructions, which can be found on the JDK download page.

 

So now we have our development environment setup.  Yep, all we needed was the JDK, and the JRE, the only other tool we'll use it already on every system; a text editor.  I will use TextEdit on my Mac for this example, but you could easily use Notepad on Windows, or nano on Linux.

 

I will not get into the details of writing Java apps/classes, so for the purpose of this tutorial I will offer my simple SOAP class to you.

 

Disclaimer: I am not a Java programmer.  In fact, this is my very first program in Java, and I learned just enough for this task.

 

Browseable link: http://www.avholloway.com/vtools/ipcc/custom-java/soap/SimpleSOAP.java.txt

Download link: http://www.avholloway.com/vtools/ipcc/custom-java/soap/SimpleSOAP.java

 

Now, we need to compile our source code into byte code so the JRE can execute it.  Compiling the .java file will result in a new file of the same name, but with the .class extension on it.

 

http://www.avholloway.com/vtools/ipcc/custom-java/soap/compiling-SimpleSOAP.png - Command Prompt>javac SimpleSOAP.java

 

Now we need to test this new class to see if it works before we add the complexity of the CRS environment.

 

Let's create another Java file, and this one will utilize our newly created class.

 

Browseable link: http://www.avholloway.com/vtools/ipcc/custom-java/soap/RunMyCode.java.txt

Download link: http://www.avholloway.com/vtools/ipcc/custom-java/soap/RunMyCode.java

 

Now we compile that source code so it can also be ran.

 

http://www.avholloway.com/vtools/ipcc/custom-java/soap/compiling-RunMyCode.png - Command Prompt>javac RunMyCode.java

 

Next we pass the RunMyCode class to the JRE like so (Note the absence of the .class or .java file extension):

 

http://www.avholloway.com/vtools/ipcc/custom-java/soap/running-RunMyCode.png - Command Prompt>java RunMyCode

 

Your output should look something similar to this:

 

Screen shot: http://www.avholloway.com/vtools/ipcc/custom-java/soap/running-RunMycode.png

Browseable link: http://www.avholloway.com/vtools/ipcc/custom-java/soap/soap-response.xml

 

OK, so if everything is working up to this point, it's safe to assume that our CRS server will be able to utilize our class as well.

65 Replies 65

Hi Kashif,

I am not specialist in Java, but my script worked fine. I would like to share with you this example that I made.

Note: This doc is in Portuguese.

Good luck,

Valber Carvalho.

Hi,

HTTP 500 - Server error.

Maybe it's time to check the server logs?

G.

Hi Gergely,

Thanks for your suggestion, you are saying the logs of UCCX 8.5.1 or IIS 6.0? I am not aware of server logs, can you guide me how to server logs specially in UCCX 8.5.1? Your help will lead me to solve the issue at earliest.

Regards

Kashif Surhio

Hi,

based on what you have written, it would be the IIS logs ~ ie the SOAP server logs.

G.

Dear Gregely,

I had captured the IIS logs and found that IIS is responding with HTTP 500. I also captured low level logs with WireShark and found that I was sendig single quote in place of double quote

String soapRequestTXT    =     "\n"

After fixing to

String soapRequestTXT    =     "\n"

and it solved my problem. Now I am facing another issue that after restarting UCCX8.5..1 I am getting Access Denied Error. MIVR logs say the following:

90336: Jun 20 13:20:08.842 PKT %MIVR-SECURITY_MGR-2-SECURITY_VIOLATION:Security violation: Permission Name=accessClassInPackage.sun.net.www.http,Permission Action=,Application=test,Script=DIB_IVR 13June.aef,Step id=3214,Step.cisco.wfframework.obj.WFBeanStep,Step Description=Set s_tpin_result = { . . . . . .

After googleing, I found that it is known bug of UCCX 8.5.1 at URL (

http://adventuresinuc.com/2012/03/12/uccx-8-51-exception-when-creating-an-object-of-type-java-net-url/)

If you have any other finding/suggestion kindly tell us.

Regards

Kashif Surhio

Hi

If you can, upgrade to the latest SU. There are loads of bugs in 8.5 which make it worthwhile. When I've done custom java stuff I've found most things fail on the initial releases of both 8.5 and 8.0, and the SU fixed it.

Aaron

Aaron Please remember to rate helpful posts to identify useful responses, and mark 'Answered' if appropriate!