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

Description:

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.

Solution:

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:

    @SET TEST_APP=USDWSUtil

  4. Now uncomment the below:

    @SET TEST_APP=JWS

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

    @SET USD_SHORT_PATH=C:\PROGRA~2\CA\SERVIC~1

    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:

    C:\PROGRA~2\CA\SERVIC~1\samples\sdk\websvc\java\test2_basic>

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

Below is the expected output:

C:\PROGRA~1\CA\SERVIC~2\samples\sdk\websvc\java\test2_basic>run_java_test.bat

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"?>
<UDSObject>
<Handle>cnt:F6FADE63C7B40E4285313616B8842938</Handle>
<Attributes>
<Attribute DataType="2002">
<AttrName>first_name</AttrName>
<AttrValue/>
</Attribute>
<Attribute DataType="2002">
<AttrName>last_name</AttrName>
<AttrValue>ServiceDesk</AttrValue>
</Attribute>
<Attribute DataType="2002">
<AttrName>access_type.sym</AttrName>
<AttrValue>Administration</AttrValue>
</Attribute>
<Attribute DataType="2005">
<AttrName>organization</AttrName>
<AttrValue/>
</Attribute>
<Attribute DataType="2002">
<AttrName>organization.name</AttrName>
<AttrValue/>
</Attribute>
<Attribute DataType="2002">
<AttrName>admin_org.name</AttrName>
<AttrValue/>
</Attribute>
<Attribute DataType="2001">
<AttrName>group_list.length</AttrName>
<AttrValue>0</AttrValue>
</Attribute>
</Attributes>
</UDSObject>


Creating a Request...
New Request created:
requestHandle = cr:400002
requestNumber = 27
The Request can be displayed using the web_url:
'http://servicedesk:8080/CAisd/pdmweb.exe?OP=SEARCH+FACTORY=cr+SKIPLIST=1
+QBE.EQ.id=400002'

Creating a Change Order...
New Change Order created:
changeHandle = chg:400002
changeNumber = 22
The Change Order can be displayed using the web_url:
'http://servicedesk:8080/CAisd/pdmweb.exe?OP=SEARCH+FACTORY=chg+SKIPLIST=
1+QBE.EQ.id=400002'

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