Invoking Web Service

Use this forum for questions regarding adoption and functionality of OpenEMM

Moderator: moderator

adriano
Posts: 2
Joined: Sun Mar 01, 2020 3:55 pm

Invoking Web Service

Post by adriano »

Hello,
I downloaded and installed the latest version of OpenEmm 2019 (19.10.000.133) and I am testing the web services.
As specified in the manual, I have created one new web service user using the web gui and specifyied its username and password.

Now I am trying to invoke the web service (for example ListSubscribers).
How the user authentication parameters should be passed ?

I guess I should use an invocation like below, but even with the corrent username and password i've got the error: "com.sun.xml.wss.XWSSecurityException: Receiver Requirement for Digested Password has not been met; nested exception is com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.XWSSecurityException: Receiver Requirement for Digested Password has not been met".

How the security header should be specified ?
Is available any example for use the web services ?
Thanks for the help.


soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://agnitas.org/ws/schemas">
<soapenv:Header>
<wsse:Security >
<wsse:UsernameToken>
<wsse:Username>username</wsse:Username>
<wsse:Password>passoword</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<sch:ListSubscribersRequest>
</sch:ListSubscribersRequest>
</soapenv:Body>
</soapenv:Envelope>
maschoff
Site Admin
Posts: 2596
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Invoking Web Service

Post by maschoff »

OpenEMM Maintainer
adriano
Posts: 2
Joined: Sun Mar 01, 2020 3:55 pm

Re: Invoking Web Service

Post by adriano »

Thanks, it works!

This is a simple example using node and node-soap (https://github.com/vpulim/node-soap).


var soap = require('soap');
var url = '<wsdl url>';

var options = {
hasNonce: true,
passwordType:'PasswordDigest',
hasTimeStamp:false
};
var wsSecurity = new soap.WSSecurity('username', '>password>', options);
soap.createClient(url, function(err, client) {
client.setSecurity(wsSecurity);
client.ListMailinglists(args, function(err, result) {
console.log("result:",result);
console.log("err:", err);
});
});
Post Reply