diff options
Diffstat (limited to 'src/main/java/at')
3 files changed, 26 insertions, 25 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/backend/DeliveryRequestBackend.java b/src/main/java/at/gv/egiz/moazs/backend/DeliveryRequestBackend.java index 9cbdd81..7e1d2f7 100644 --- a/src/main/java/at/gv/egiz/moazs/backend/DeliveryRequestBackend.java +++ b/src/main/java/at/gv/egiz/moazs/backend/DeliveryRequestBackend.java @@ -121,7 +121,7 @@ public class DeliveryRequestBackend implements Consumer<String> { var msgRequest = buildMsgRequest(mzsRequest); traceMsgRequest(msgRequest); var msgClientParams = mzsRequest.getConfig().getMSGClient(); - App2ZusePort client = clientFactory.createSOAP12(msgClientParams, App2ZusePort.class); + App2ZusePort client = clientFactory.createMsgClient(msgClientParams); status = client.delivery(msgRequest); traceMsgResponse(status); @@ -159,7 +159,7 @@ public class DeliveryRequestBackend implements Consumer<String> { if (mzsRequest.getConfig().isPerformQueryPersonRequest()) { log.trace("Perform QueryPersonRequest. "); var tnvzClientParams = mzsRequest.getConfig().getTNVZClient(); - TNVZServicePort tnvzPort = clientFactory.createSOAP12(tnvzClientParams, TNVZServicePort.class); + TNVZServicePort tnvzPort = clientFactory.createTnvzClient(tnvzClientParams); var identification = tnvzHelper.performQueryPersonRequest(mzsRequest, tnvzPort); return converter.convert(mzsRequest, identification); } else { diff --git a/src/main/java/at/gv/egiz/moazs/backend/ForwardResponseToServiceSink.java b/src/main/java/at/gv/egiz/moazs/backend/ForwardResponseToServiceSink.java index b6f9b44..1312a5f 100644 --- a/src/main/java/at/gv/egiz/moazs/backend/ForwardResponseToServiceSink.java +++ b/src/main/java/at/gv/egiz/moazs/backend/ForwardResponseToServiceSink.java @@ -58,7 +58,7 @@ public class ForwardResponseToServiceSink { log.info("Forward msg:{} with AppDeliveryID={} to service at {}.", msgResponse.getRootElementLocalPart(), msgResponse.getAppDeliveryID(), params.getURL()); var binaryResponse = repository.retrieveBinaryResponse(msgResponse.getResponseID()); - Mzs2AppPortType client = factory.createSOAP11(params, Mzs2AppPortType.class); + Mzs2AppPortType client = factory.createAppClient(params); return msgResponse.sendToAppClient(converter, binaryResponse, client); } } diff --git a/src/main/java/at/gv/egiz/moazs/client/ClientFactory.java b/src/main/java/at/gv/egiz/moazs/client/ClientFactory.java index c294aa3..18fcdd9 100644 --- a/src/main/java/at/gv/egiz/moazs/client/ClientFactory.java +++ b/src/main/java/at/gv/egiz/moazs/client/ClientFactory.java @@ -26,7 +26,10 @@ import at.gv.egiz.moazs.util.FileUtils; import at.gv.egiz.moazs.util.StoreSOAPBodyBinaryInRepositoryInterceptor; import at.gv.zustellung.app2mzs.xsd.ClientType; import at.gv.zustellung.app2mzs.xsd.KeyStoreType; +import at.gv.zustellung.app2mzs.xsd.Mzs2AppPortType; import at.gv.zustellung.app2mzs.xsd.SSLType; +import at.gv.zustellung.msg.xsd.App2ZusePort; +import at.gv.zustellung.tnvz.xsd.TNVZServicePort; import org.apache.cxf.configuration.jsse.TLSClientParameters; import org.apache.cxf.endpoint.Client; import org.apache.cxf.ext.logging.LoggingInInterceptor; @@ -78,48 +81,46 @@ public class ClientFactory { this.configUtil = configUtil; } - /** - * Creates a client that communicates with a soap 1.2 service. - * - * @param params for the client, such as service url and ssl parameters. - * @return the client - */ - public <T> T createSOAP12(ClientType params, Class<T> clazz) { - return createSOAPClient(params, clazz, true); + public TNVZServicePort createTnvzClient(ClientType params) { + return createSOAPClient(params, TNVZServicePort.class, true, false, false); } - /** - * Creates a client that communicates with a soap 1.1 service. - * - * @param params for the client, such as service url and ssl parameters. - * @return the client - */ - public <T> T createSOAP11(ClientType params, Class<T> clazz) { - return createSOAPClient(params, clazz, false); + public Mzs2AppPortType createAppClient(ClientType params) { + return createSOAPClient(params, Mzs2AppPortType.class, false, false, true); + } + + public App2ZusePort createMsgClient(ClientType params) { + return createSOAPClient(params, App2ZusePort.class, true, true, true); } - private <T> T createSOAPClient(ClientType params, Class<T> clazz, boolean isSoap12) { + private <T> T createSOAPClient(ClientType params, Class<T> clazz, boolean isSoap12, boolean storeResponse, boolean mtomEnabled) { log.info("Create client for service {}", params.getURL()); var factory = new JaxWsClientFactoryBean(); factory.setServiceClass(clazz); factory.setAddress(params.getURL()); - factory.getInInterceptors().add(storeResponseInterceptor); + + if (storeResponse) { + factory.getInInterceptors().add(storeResponseInterceptor); + } if (isSoap12) { - factory.setBindingId(SOAPBinding.SOAP12HTTP_MTOM_BINDING); + factory.setBindingId(SOAPBinding.SOAP12HTTP_BINDING); } + setupLoggingInterceptors(factory); var proxy = new JaxWsProxyFactoryBean(factory).create(); Client client = ClientProxy.getClient(proxy); HTTPConduit http = (HTTPConduit) client.getConduit(); - var bindingProvider = (BindingProvider) proxy; - SOAPBinding binding = (SOAPBinding) bindingProvider.getBinding(); - binding.setMTOMEnabled(true); + if (mtomEnabled) { + var bindingProvider = (BindingProvider) proxy; + SOAPBinding binding = (SOAPBinding) bindingProvider.getBinding(); + binding.setMTOMEnabled(true); + } var httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnectionTimeout(params.getConnectionTimeout().longValueExact()); |