From e3da3a91ae67257fdf472214e8d84e2208938f6c Mon Sep 17 00:00:00 2001 From: Thomas Bayer Date: Fri, 3 Nov 2023 08:43:01 +0100 Subject: [PATCH 1/2] Readme --- .../core/interceptor/rest/REST2SOAPInterceptor.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/predic8/membrane/core/interceptor/rest/REST2SOAPInterceptor.java b/core/src/main/java/com/predic8/membrane/core/interceptor/rest/REST2SOAPInterceptor.java index 1b2ed8f55d..63b23fe456 100644 --- a/core/src/main/java/com/predic8/membrane/core/interceptor/rest/REST2SOAPInterceptor.java +++ b/core/src/main/java/com/predic8/membrane/core/interceptor/rest/REST2SOAPInterceptor.java @@ -280,11 +280,18 @@ private void setServiceEndpoint(AbstractExchange exc, Mapping mapping) { } private String getNewDestination(AbstractExchange exc) { - return "http://" + ((AbstractServiceProxy) exc.getRule()).getTargetHost() + ":" + return getProtocol(exc) + "://" + ((AbstractServiceProxy) exc.getRule()).getTargetHost() + ":" + ((AbstractServiceProxy) exc.getRule()).getTargetPort() + exc.getRequest().getUri(); } + private String getProtocol(AbstractExchange exc) { + if(exc.getRule().getSslOutboundContext() != null) { + return "https"; + } + return "http"; + } + private String getURI(AbstractExchange exc) { return exc.getRequest().getUri(); } From 456c61f70a39da8a28392b0a2123323015ee17fb Mon Sep 17 00:00:00 2001 From: Thomas Bayer Date: Fri, 3 Nov 2023 08:44:40 +0100 Subject: [PATCH 2/2] Get protocol from context --- .../membrane/core/interceptor/rest/REST2SOAPInterceptor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/main/java/com/predic8/membrane/core/interceptor/rest/REST2SOAPInterceptor.java b/core/src/main/java/com/predic8/membrane/core/interceptor/rest/REST2SOAPInterceptor.java index 63b23fe456..3198075b64 100644 --- a/core/src/main/java/com/predic8/membrane/core/interceptor/rest/REST2SOAPInterceptor.java +++ b/core/src/main/java/com/predic8/membrane/core/interceptor/rest/REST2SOAPInterceptor.java @@ -312,5 +312,4 @@ public void setMappings(List mappings) { public String getShortDescription() { return "Transforms REST requests into SOAP and responses vice versa."; } - -} +} \ No newline at end of file