Für die Entwicklung mit ECS REST Services und JavaScript empfehlen wir den Einsatz unserer JavaScript-Bibliothek Client Library tEcs (theobald.ecs.micro) for ERPConnect Services/Core, welche die clientseitige Programmierung mit JavaScript durch die Kapselung der Basisfunktionen von ECS vereinfacht.
theobald.ready(function() {
tEcs.executeXql({
serviceApplication: "ec2",
query: 'SELECT TOP 10 * FROM MAKT'
}).always(function(result) {
console.log(result)
});
tEcs.executeFunction({
name: 'Z_ECS_GET_STOCKS',
data: {
exports: {
MATNR: '100-100'
}
},
done: function(data) {
alert('Everything as planned!');
},
fail: function(data) {
alert('Something broke :(');
}
});
});
Für einen SOAP-Service:
tEcs.callSoapService({
//
// REQUIRED: Name of deployed service
serviceName: 'SAPCustomerWebService',
//
// OPTIONAL: can be put explicitly. If not, then '/_vti_bin/' + serviceName is used
url: '/_vti_bin/SAPCustomerWebService.svc',
//
// Name of action. If not specified, tests the service connection
actionName: 'GetCustomersByName',
//
// JSON of input paramters, OPTIONAL (if no input)
data: { name: '%' },
//
// OPTIONAL: success handler
done: function(data, status, xhr){ alert('COMPLETED!'); },
//
// OPTIONAL: error handler
fail: function(xhr, status, thrownError){ alert('ERROR!'); },
// OPTIONAL: will be always executed (on success AND error)
always: function (data, statusText, errorThrown) { console.log('%o', data); },
// OPTIONAL: direct overrides of jquery ajax
ajax: { url: 'http://someserver.com/service.svc', contentType: 'text' //... }
});
theobald.ecs:
theobald.ecs ist eine Erweiterung von theobald.ecs.micro und erfordert jQuery.
Sie ermöglicht weitere Features wie Persistierung der Einstellungen und Logging.
Wenn Sie SharePoint- und Persistierung-APIs nutzen möchten, um APIKey, ServiceApplication, Url in SharePoint oder Client-seitige Konfiguration im Browser zu speichern, dann nutzen Sie theobald.ecs.