Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Beschreibung von Version 1.0.0

ThemaBeschreibung
REST-ProtokollDas BO System > REST-Protokoll protokolliert alle vom Nuclet generierten Requests
Verwendung in RegelnDie Klasse RESTUtils stellt dazu mehrere Methoden bereit

Verwendung in der Regelprogrammierung von Version 1.0.0

Klasse RESTUtils
static RESTContext execute(RESTContext restContext)
Führt einen Request durch, mit den in restContext angegebenen Parametern
Beispiel GLS Versandauftrag (JSON)

RESTContext restContext = new RESTContext();
restContext.setAddress(credentials.getAddress());
restContext.setRequest(getRequest(credentials, bo, referenceLabel));
restContext.setReference("GLS: Post Shipment for " + referenceProtokoll);

restContext.setEncoding(RESTContext.ENCODING_UTF_8);
restContext.setContentType(RESTContext.FORMAT_JSON);
restContext.setAcceptEncoding("gzip,deflate");
restContext.setAcceptLanguage("de");
restContext.setAccept(RESTContext.FORMAT_JSON);
restContext.setAuthorization(RESTContext.Authorization.Basic);
restContext.setUser(credentials.getUser());
restContext.setPassword(credentials.getPassword());

context.log("Starte Übermittlung des Lieferscheins an GLS: " + restContext.getUrlWithParameters());
RESTUtils.execute(restContext);
RESTShipmentResponseGLS response = null;
if (restContext.isError()) {
context.log("Fehler beim Übermitteln des GLS Shipment Response: " + restContext.getErrorMessage());
} else {
try {
response = objectMapper.readValue(restContext.getResponse(), RESTShipmentResponseGLS.class);
// ...
    } catch (JsonProcessingException e) {
throw new BusinessException("Fehler beim Auswerten des GLS Shipment Response: " + e.getMessage());
}
}

Beispiel Prüfung USt-ID (Inline)



RESTContext result = new RESTContext();

result.setContentType(RESTContext.FORMAT_APPLICATION_X_WWW_FORM_URLENCODED);
result.setEncoding(RESTContext.ENCODING_UTF_8);
result.setTest(Boolean.FALSE);
result.setAddress(pruefungsObjekt.getUrl());
result.addParameter(Parameter.UST_ID_1, pruefungsObjekt.getValue(Parameter.UST_ID_1));
result.addParameter(Parameter.UST_ID_2, pruefungsObjekt.getValue(Parameter.UST_ID_2));
result.addParameter(Parameter.FIRMENNAME, pruefungsObjekt.getValue(Parameter.FIRMENNAME));
result.addParameter(Parameter.ORT, pruefungsObjekt.getValue(Parameter.ORT));
result.addParameter(Parameter.PLZ, pruefungsObjekt.getValue(Parameter.PLZ));
result.addParameter(Parameter.STRASSE, pruefungsObjekt.getValue(Parameter.STRASSE));
result.setReference("Prüfung USt-ID für Prüfling " + pruefungsObjekt.getPruefling());

RESTUtils.execute(restContext);

Integration von Version 1.0.0

...