Extentrix Developer Network-Extentrix Web Services for Citrix Presentation Server
Extentrix Web Services Consumer using J2EE (Servlet-Applet)
Introduction
Requirements
Application Source Code
Web Module
How to Call Extentrix Web Services for Citrix Presentation Server API using Java
J2EE Applet (Client side)
How to run the demo
Introduction
This sample shows how to invoke Extentrix Web Services for Citrix Presentation Server APIs using Java (Servlet-Applet). It invokes one of the APIs (launchApplicationWithParameter). The Applet requests the servlet for ICA file, the Applet stores the ICA file in the client temporary directory and launches it.
Requirements
This sample is developed using Oracle JDeveloper IDE. If you want to run this sample, it is preferable to use Oracle JDeveloper IDE just for simplicity.
If you already have another java IDE installed on your machine just make a web project and copy-past the code to your project.
This is not a Java tutorial, so it will only briefly describe what the code does. We assumed the person who is reading this has a good knowledge of J2EE.
Application Source Code
There are two main packages:
- com.extentrix.servlet:
This package contains : WSInvoker: this servlet invokes our web service where we are calling one of Extentrix Web Services APIs – launchApplicationWithParameter and returning an ICA file to launch the Citrix published application. com.extentrix.proxy
This package is obtained by adding web service proxy. To obtain a proxy in JDeveloper IDE, do the following:
1. Right click your project and select New as in Figure 1.

Figure 1
2. From the Business Tier node, select Web Services. Choose Web Service Proxy from the list of items that will appear in the right pane. Check
Figure 2.

Figure 2
3. The welcome window will appear. Click Next as in Figure 3.

Figure 3
4. Add the web service description language URL in the field WSDL Document URL and then click Next. This URL can be on your local computer or
remote one. See Figure 4.

Figure 4
Note: in this sample we use our test web services URLhttp://www.extentrix.com/webservices/3.5.0/ExtentrixWebServicesForCPS.asmx?wsdl
5. Click Next for the remaining wizard windows.
Web Module
Inside the public_html directory there is a download.html file which is the first file to run in this sample.
It demos a download page
where user can open the product users’ manual using an ICA Client.
Parameters to be passed to the WSInvoker servlet:
- clientName: Client Machine Name.
- userName: Server User Name;
- password: Server User Password.
- Domain: Server Domain
- file: The path of the file to be opened.
Note: If the file is located on the server, just provide its absolute path. But, if it is located on the client’s machine,
the path should look like this: “\\client\c:\out.txt”
How to Call Extentrix Web Services
Application Edition 3.5 API using Java
We will take a piece of code from WSInvoker servlet.
- We have to add following import statements to invoke the web services:
import com.proxy.ExtentrixWebServicesForCPSSoapClient;import com.proxy.types.extentrix.citrixpsws1._0.WindowsCredentials;
- We have to create an object from the created web services proxy.
- Create Credential object, and set its members.
WindowsCredentials crend = new WindowsCredentials();
crend.setDomain(domain);
crend.setDomainType(0);
crend.setPassword(password);
crend.setPasswordEncryptionMethod(0);
crend.setUserName(userName); - Invoke the web service.
String icaFile= proxy.launchApplicationWithParameter("", fileName, crend, clientName, clientIp);
For more Information about Extentrix web services APIs, please refer to Developers’ Manual.
J2EE Applet (Client side)
Inside the client demo directory there are the followings:
Index.html: Main page where it shows a regular user download page where user can open users’ manual using ICA Client.
- Client.java: Applet source code which requests the ICA file from the server and stores it on the client temporary directory to be launched.
- SignedApplet.jar: Jar file of source code.
- SSignedApplet.jar: Signed jar file of the previous jar file which will be used by the client.
- Extentrixstore: Server store for the certificates.
- clientstore: Client store for certificate.
- ExtentrixWSClient.cer: Test client certificate which used to singe the Applet client.
- security.jp: Contains the permission allowed for the client signed with the certificate. For the purpose of this sample, we are granting all permissions for the client.
How to run the demo
It consists of two parts:
Server Side:
- Change the default values for server and client settings in the beginning of WSInvoker servlet .
- In the Application Sources under com.extentrix.proxy you will find ExtentrixServicesCitrixPSProxy. When you click it you will see the classes in the IDE lower panel.
- Open ExtentrixServiceCitrixPSSoap_Stub class and change this line _setProperty(ENDPOINT_ADDRESS_PROPERTY, "http://172.19.7.100/ExtentrixWebService/ExtentrixServiceCitrixPS.asmx"); Use your web service URL for ENDPOINT_ADDRESS_PROPERTY.
- Repeat same things to ExtentrixServiceCitrixPSSoap12_Stub class.
- Run the WSInvoker servlet .
Client Side:
- Edit index.html file and search for Applet tag.
- Look for “PARAM NAME="WSURL". Change the value to the URL of the running server (from the previous part).
- Add to the URL, the file name you want to open as “file=test.pdf”
Where the complete URL will look like
http://172.19.7.48:8988/WS_ServerDemo-com-context-root/invoker?file=test.pdf
<PARAM NAME="WSURL" VALUE="http://172.19.7.69:8988/WS_ServerDemo-com-context-root/invoker"></APPLET>
Note: If the file is located on the server, just provide its path. But, if it is located on the client’s machine, the path should be like this: “\\client\c:\out.txt”