What is the Procedure to run the java webservices sample code in Service Desk Manager 12.x?

Document ID : KB000019757
Last Modified Date : 14/02/2018
Show Technical Document Details


This documment outlines the procedure to run the sample java web services code in Service Desk Manager 12.x which is available in the $NX_ROOT\\samples\sdk\websvc\java\test2_basic directory. Sample JWS.java demonstrates the login(), getHandleForUserid(), createRequest(), createChangeOrder(), createTicket() and logout() methods.


To run the sample code, perform the following steps:

  1. Edit the JWS.java file using tools such as Notepad++. Locate the following lines and verify web services URL:

    // The endpoint for the R11 web service
    String endpoint = "http://localhost:8080/axis/services/USD_R11_WebService?wsdl";

    If you are compiling on a remote server, replace the servicedesk hostname with localhost.

  2. Update the ServiceDesk password in the following lines:

    // Assume username and password are both "ServiceDesk"
    String username = "ServiceDesk";
    String password = "<password>";

  3. Save the file. Copy the run_java_test_bat.txt file from NX_ROOT\samples\sdk\websvc\java to NX_ROOT\samples\sdk\websvc\java\test2_basic folder and rename to run_java_test.bat. Edit the file run_java_test.bat and locate and and comment the following line:


  4. Now uncomment the below:


  5. Verify the path in the statement below and change accordingly:


    Note: If SDM is on 32bit server, path is C:\PROGRA~1\CA\SERVIC~1. On 64bit server it is C:\PROGRA~2\CA\SERVIC~1

  6. Make the changes to below JRE Path:

    @SET JAVA_PATH= C:\PROGRA~2\CA\SC\JRE\1.6.0_30

  7. Save the run_java_test.bat file and run it from the below location:


    You should see JWS.java file and com folder created in NX_ROOT\\samples\sdk\websvc\java\test2_basic.

Below is the expected output:


Compiling JWS.java

Running JWS

27/08/2013 2:41:02 PM org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax
.mail.internet.MimeMultipart). Attachment support is disabled.
login succeeded!

Contact information for ServiceDesk:
<?xml version="1.0" encoding="UTF-8"?>
<Attribute DataType="2002">
<Attribute DataType="2002">
<Attribute DataType="2002">
<Attribute DataType="2005">
<Attribute DataType="2002">
<Attribute DataType="2002">
<Attribute DataType="2001">

Creating a Request...
New Request created:
requestHandle = cr:400002
requestNumber = 27
The Request can be displayed using the web_url:

Creating a Change Order...
New Change Order created:
changeHandle = chg:400002
changeNumber = 22
The Change Order can be displayed using the web_url:

Creating a Ticket...
New Ticket created:
ticketHandle = cr:400003
ticketNumber = 28