ParvezABB Absent Member.
Absent Member.
662 views

Java code to submit ticket into HPSM thru external application

Hi, I am consuming HP SM web-service for interaction from Eclipse ide. And trying to write java code to submit an interaction from our external app. Could you please help how to do it. A short example java code would be helpful. Thanks in advance.

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Java code to submit ticket into HPSM thru external application

Hi,

This is different of what you need but you can take this as an example:

This is a test with self consuming ServiceDesk WSDL in Service Manager


1. Create a JS script from WSDL

• System navigator > Tailoring > Web Services > Run WSDL to JS
• URL: http://localhost:13080/sc62server/PWS/ServiceDesk.wsdl
• Username: falcon
• Password: XXX
• Click 'Proceed'
new ScriptLibrary is created by 'WSDL to JS'
• Add ScriptLibrary, ServiceDesk


2. Create and test Custom script
• db > ScriptLibrary
• Create new ScriptLibary, TRAINING,
• Name:TRAINING, Package:user
• Code:

-----------------------------------------------------------------
var service = new lib.ServiceDesk.ServiceDesk();
var request = new lib.ServiceDesk.CreateInteractionRequest();

service.user="falcon";
service.password="";

request.model.instance.Contact.setValue("AARON, JIM");
request.model.instance.ServiceRecipient.setValue("AARON, JIM");
request.model.instance.NotifyBy.setValue("E-mail");
request.model.instance.AffectedService.setValue("Applications");
request.model.instance.Category.setValue("request for information");
request.model.instance.Area.setValue("general information");
request.model.instance.Subarea.setValue("general information");
request.model.instance.Urgency.setValue("4");
request.model.instance.Impact.setValue("4");
request.model.instance.Title.setValue("JS Webservice Test");
var description = request.model.instance.Description.Description_newInstance();
description.setValue("JS Webservice Test");

var response = service.invoke(request);

for (i=0;i<response.messages.message.length;i++)
{
print("Message: " + response.messages.message[i].getValue());
}
-----------------------------------------------------------------

3. Click Save, Compile and Execute
4. Check and verify "Message: Interaction SD XXXXX has ben added"

 

Regards,

If you feel this was helpful please click the KUDOS! thumb below!
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.