| 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()); } } |
| 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); |