Revision: 1950
Author: florianstratil
Date: Wed Nov 5 08:44:11 2014 UTC
Log: Teststand 04.11.2014
https://code.google.com/p/extra-standard/source/detail?r=1950
Added:
/trunk/java/apps/extraClientLight/src/main/java/de/extra/extraClientLight/helper/ExtraResponseHelper.java
Modified:
/trunk/java/apps/extraClientLight/pom.xml
/trunk/java/apps/extraClientLight/src/main/java/de/extra/extraClientLight/impl/ExtraClientImpl.java
/trunk/java/apps/extraClientLight/src/main/java/de/extra/extraClientLight/util/ClientConstants.java
=======================================
--- /dev/null
+++
/trunk/java/apps/extraClientLight/src/main/java/de/extra/extraClientLight/helper/ExtraResponseHelper.java
Wed Nov 5 08:44:11 2014 UTC
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package de.extra.extraClientLight.helper;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.extra.extraClientLight.model.ResponseExtraBean;
+import de.extra.extraClientLight.model.enums.ReportLevelEnum;
+import de.extra.extraClientLight.util.ClientConstants;
+import de.extra_standard.namespace.components._1.FlagType;
+import de.extra_standard.namespace.response._1.TransportResponseType;
+
+public class ExtraResponseHelper {
+
+ private static Logger LOGGER = LoggerFactory
+ .getLogger(ExtraResponseHelper.class);
+
+ private static ResponseExtraBean responseBean;
+
+ public static ResponseExtraBean convertExtraResponse(
+ TransportResponseType extraResponse) {
+ responseBean = new ResponseExtraBean();
+
+ responseBean.setResponseId(extraResponse.getTransportHeader()
+ .getResponseDetails().getResponseID().getValue());
+ responseBean.setRequestId(extraResponse.getTransportHeader()
+ .getRequestDetails().getRequestID().getValue());
+
+ FlagType reportFlag = extraResponse.getTransportHeader()
+ .getResponseDetails().getReport().getFlag().get(0);
+
+ getReportInformation(reportFlag);
+ try {
+ final InputStream in = extraResponse.getTransportBody().getData()
+ .getBase64CharSequence().getValue().getInputStream();
+
+ responseBean.setData(IOUtils.toByteArray(in));
+ } catch (IOException e) {
+ LOGGER.error("Fehler beim Lesen des Datenstreams");
+ responseBean.setReturnCode(9);
+ }
+
+ return responseBean;
+ }
+
+ private static void getReportInformation(FlagType reportFlag) {
+
+ responseBean.setReportCode(reportFlag.getCode().getValue());
+ responseBean.setReportText(reportFlag.getText().getValue());
+
+ if (reportFlag.getWeight().equalsIgnoreCase(
+ ClientConstants.EXTRA_WEIGHT_INFO)) {
+
+ responseBean.setReportLevel(ReportLevelEnum.INFO);
+ responseBean.setReturnCode(0);
+ } else if (reportFlag.getWeight().equalsIgnoreCase(
+ ClientConstants.EXTRA_WEIGHT_WARN)) {
+ responseBean.setReturnCode(1);
+ responseBean.setReportLevel(ReportLevelEnum.WARN);
+ } else {
+
+ responseBean.setReportLevel(ReportLevelEnum.ERROR);
+ responseBean.setReturnCode(2);
+ }
+ }
+}
=======================================
--- /trunk/java/apps/extraClientLight/pom.xml Fri Oct 17 06:38:41 2014 UTC
+++ /trunk/java/apps/extraClientLight/pom.xml Wed Nov 5 08:44:11 2014 UTC
@@ -27,7 +27,13 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3.2</version>
+ </dependency>
</dependencies>
+ <!-- 2014-11-03 FS Deaktiviert bis Weg gefunden mit Annox zu nutzen
<build>
<pluginManagement>
<plugins>
@@ -62,6 +68,6 @@
</plugin>
</plugins>
</build>
-
+-->
</project>
=======================================
---
/trunk/java/apps/extraClientLight/src/main/java/de/extra/extraClientLight/impl/ExtraClientImpl.java
Fri Oct 17 06:38:41 2014 UTC
+++
/trunk/java/apps/extraClientLight/src/main/java/de/extra/extraClientLight/impl/ExtraClientImpl.java
Wed Nov 5 08:44:11 2014 UTC
@@ -25,17 +25,19 @@
import de.extra.extraClientLight.IextraClient;
import de.extra.extraClientLight.helper.BuildExtraTransport;
import de.extra.extraClientLight.helper.ExtraRequestHelper;
+import de.extra.extraClientLight.helper.ExtraResponseHelper;
import de.extra.extraClientLight.model.RequestExtraBean;
import de.extra.extraClientLight.model.ResponseExtraBean;
import de.extra.extraClientLight.util.SendWebService;
import de.extra_standard.namespace.request._1.TransportRequestType;
+import de.extra_standard.namespace.response._1.TransportResponseType;
public class ExtraClientImpl implements IextraClient {
private Logger LOGGER = LoggerFactory.getLogger(ExtraClientImpl.class);
public ResponseExtraBean sendExtra(RequestExtraBean requestExtra) {
LOGGER.info("Client aufgerufen");
- ResponseExtraBean responseBean = new ResponseExtraBean();
+ ResponseExtraBean responseBean;
SendWebService sendWebService = new SendWebService();
TransportRequestType extraRequest = BuildExtraTransport
@@ -43,8 +45,10 @@
ExtraRequestHelper.printRequest(extraRequest);
- sendWebService.sendRequest(extraRequest, requestExtra.getUrl(),
+ TransportResponseType extraResponse =
sendWebService.sendRequest(extraRequest, requestExtra.getUrl(),
requestExtra.isMtom());
+ responseBean = ExtraResponseHelper.convertExtraResponse(extraResponse);
+
return responseBean;
}
=======================================
---
/trunk/java/apps/extraClientLight/src/main/java/de/extra/extraClientLight/util/ClientConstants.java
Fri Oct 17 06:38:41 2014 UTC
+++
/trunk/java/apps/extraClientLight/src/main/java/de/extra/extraClientLight/util/ClientConstants.java
Wed Nov 5 08:44:11 2014 UTC
@@ -25,4 +25,8 @@
public static final String DETAILS_REQUEST_RESPONSE
= "
http://www.extra-standard.de/scenario/request-with-response";
public static final String DETAILS_ACKNOWLEDGEMENT
= "
http://www.extra-standard.de/scenario/request-with-acknowledgement";
+ public static final String EXTRA_WEIGHT_INFO
= "
http://www.extra-standard.de/weight/INFO";
+ public static final String EXTRA_WEIGHT_WARN
= "
http://www.extra-standard.de/weight/WARN";
+ public static final String EXTRA_WEIGHT_ERROR
= "
http://www.extra-standard.de/weight/ERROR";
+
}