DV_2 Super Contributor.
Super Contributor.
885 views

Consume 3rd Party Web Service

Hi,

 

I’m trying to integrate a custom table with xmatters (alarmpoint), using web service.

 

I have two options.

 

Option 1: Convert the WSDL to JS and create a custom JS to call

 

 

I have successfully converted the WSDL to JS (attached). But I’m not sure how to return the details.

 

function checkEvent(id)
{
var AP = new system.library.AlarmPointWebService.AlarmPointWebService();
var AE = new system.library.AlarmPointWebService.QueryEvent();
AP.user="Test";
AP.password="Password123";
AE.eventIdentifier.setValue(id);
var aux = AP.invoke(AE);
print(aux.QueryEventReturn.ResponseText.getValue())
//print(aux.result.getValue());
//var result = aux.getContent();
//print(result);

//print(aux.AE.getContent());
//print(aux.QueryEventReturn.ResponseText.getValue());
}

ret_val=checkEvent("202000");

 

 

Option 2: use doSOAPRequest to call.

 

In second option, I have created a javascript to query event from xmatters. When I tried to execute the script. I’m getting the following error.

 

 

function getID()
{
var uid = "Test";
var pas = "Password123";
var att = null;
var url = "http://10.168.11.12:8888/api/services/AlarmPointWebService.AlarmPointWebServiceHttpSoap11Endpoint/"
var act = "QueryEvent"

var xml = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:sch=\"http://www.alarmpoint.com/webservices/schema\">"+
"<soap:Header/>"+
"<soap:Body>"+
"<sch:QueryEvent>"+
"<sch:user>Test</sch:user>"+
"<sch:password>Password123</sch:password>"+
"<sch:clientTimestamp></sch:clientTimestamp>"+
"<sch:clientIP></sch:clientIP>"+
"<sch:clientOSUser></sch:clientOSUser>"+
"<sch:company></sch:company>"+
"<sch:eventIdentifier>202000</sch:eventIdentifier>"+
"</sch:QueryEvent>"+
"</soap:Body>"+
"</soap:Envelope>"
var eventDetails = doSOAPRequest(url, act, xml, uid, pas, 5, 5, 5, att);
print(eventDetails);
}

 

Error:

 

RAD E Script <unknown script>  line 0: ERROR uncaught exception: Error calling method: doSoapRequest  in class: com/hp/ov/sm/server/utility/SoapClient Exception (com.sun.xml.messaging.saaj.SOAPExceptionImpl: Error during saving a multipart message) at char 1

RTE E Cannot evaluate expression (display,show.rio)

 

 

Any comments?

 

Also any suggetions on integrating a custom table with Xmatters? 

 

 

Regards,

D_V

 

0 Likes
4 Replies
Trusted Contributor.. Flavio Bianchi Trusted Contributor..
Trusted Contributor..

Re: Consume 3rd Party Web Service

Hi,

What's the problem with option1 ?

 

This command print the expected value?

print(aux.QueryEventReturn.ResponseText.getValue())

 

 

0 Likes
DV_2 Super Contributor.
Super Contributor.

Re: Consume 3rd Party Web Service

Hi,

 

For option 1, 

 

It suppose to return for the query. 

 

When I tried to print(aux.QueryEventReturn.ResponseText.getValue()), I'm getting the following error.

 

 

 

 Process panel process.option in RAD display encountered error in line 1 (display,process.option)
Cannot evaluate expression (display,process.option)
Cannot evaluate expression (display,process.option)
Cannot evaluate expression (display,process.option)
Bad arg(2) oper = (display,process.option)
Cannot evaluate expression (display,process.option)
Cannot evaluate expression (display,process.option)
Bad arg(2) oper = (display,process.option)
Cannot evaluate expression (display,process.option)
Script 'VisitorNotification' line 41: ERROR TypeError: aux.QueryEventReturn has no properties at char 1

 

Regards,

D_V

 

0 Likes
Trusted Contributor.. Flavio Bianchi Trusted Contributor..
Trusted Contributor..

Re: Consume 3rd Party Web Service

try this:

 

print(aux.QueryEventReturn.getContent());

0 Likes
DV_2 Super Contributor.
Super Contributor.

Re: Consume 3rd Party Web Service

Hi, 

 

 I tried print(aux.QueryEventReturn.getContent());

Still the same error.

 

 Process panel process.option in RAD display encountered error in line 1 (display,process.option)
Cannot evaluate expression (display,process.option)
Cannot evaluate expression (display,process.option)
Cannot evaluate expression (display,process.option)
Bad arg(2) oper = (display,process.option)
Cannot evaluate expression (display,process.option)
Cannot evaluate expression (display,process.option)
Bad arg(2) oper = (display,process.option)
Cannot evaluate expression (display,process.option)
Script 'VisitorNotification' line 41: ERROR TypeError: aux.QueryEventReturn has no properties at char 1

 

 

Regards,

D_V

0 Likes
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.