aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/util')
-rw-r--r--src/main/java/at/gv/egiz/moazs/util/EndpointFactory.java8
-rw-r--r--src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java20
2 files changed, 13 insertions, 15 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/util/EndpointFactory.java b/src/main/java/at/gv/egiz/moazs/util/EndpointFactory.java
index 24321e1..9d31596 100644
--- a/src/main/java/at/gv/egiz/moazs/util/EndpointFactory.java
+++ b/src/main/java/at/gv/egiz/moazs/util/EndpointFactory.java
@@ -20,13 +20,13 @@ public class EndpointFactory {
this.bus = bus;
}
- public Endpoint create(Object implementor, Service service) {
- return create(implementor, service, null);
+ public Endpoint create(Object implementor, Service service, String route) {
+ return create(implementor, service, route, null);
}
- public Endpoint create(Object implementor, Service service, Interceptor<Message> interceptor) {
+ public Endpoint create(Object implementor, Service service, String route, Interceptor<Message> interceptor) {
EndpointImpl endpoint = new EndpointImpl(bus, implementor);
- endpoint.setAddress("/");
+ endpoint.setAddress(route);
endpoint.setServiceName(service.getServiceName());
endpoint.setWsdlLocation(service.getWSDLDocumentLocation().toString());
endpoint.publish();
diff --git a/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java b/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java
index 88ab7e0..d4aa75a 100644
--- a/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java
+++ b/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java
@@ -13,6 +13,7 @@ import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
@@ -46,25 +47,22 @@ public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInt
try {
byte[] content = messageUtils.copyContent(message);
- if(log.isTraceEnabled()) {
- log.trace("Interceptor received this SOAP message: {}. ", new String(content, StandardCharsets.UTF_8));
- }
-
if (content.length <= 0) {
return;
}
Element document = soapUtils.toDOM(content);
- byte[] response = soapUtils.unwrapSoapEnvelope(document);
- String appDeliveryID = soapUtils.getAppDeliveryIDFrom(document);
- String rootTag = document.getTagName();
+ var rootTagNode = soapUtils.getChildElementOfSoapBody(document);
+ var rootTagLocalName = rootTagNode.getLocalName();
- if (!idGenerators.containsKey(rootTag)) {
- log.trace("Will not store message of type {}. ", rootTag);
+ if (!idGenerators.containsKey(rootTagLocalName)) {
+ log.trace("Child element {} of <soap:Body> is unknown. Will not store message.", rootTagLocalName);
return;
}
- var id = idGenerators.get(rootTag).apply(appDeliveryID);
+ String appDeliveryID = soapUtils.getAppDeliveryIDFrom(document);
+ var id = idGenerators.get(rootTagLocalName).apply(appDeliveryID);
+ byte[] response = soapUtils.toBytes(rootTagNode);
repository.store(id, response);
if(log.isTraceEnabled()) {
@@ -72,7 +70,7 @@ public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInt
appDeliveryID, new String(response, StandardCharsets.UTF_8));
}
- } catch (ParserConfigurationException | SAXException | IOException | NullPointerException e) {
+ } catch (ParserConfigurationException | SAXException | IOException | NullPointerException | TransformerException e) {
throw moaZSException("Could not extract signed data from message.", e);
}
}