Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
78c88ca
Add WSDL parsing utilities and schema validation tests
predic8 Mar 8, 2026
ea95d52
Remove unused WSDLSOAPVersionExtractor and clean up redundant WSDL pa…
predic8 Mar 8, 2026
0b0fe16
Enhance WSDL parser with support for cyclic imports, schema inclusion…
predic8 Mar 9, 2026
1175eab
Refactor WSDL parser code for immutability and readability
predic8 Mar 9, 2026
1a35ae9
Refactor WSDL parser and URI utility for improved normalization, bind…
predic8 Mar 9, 2026
ed047c8
Merge branch 'master' into wsdl-validator-new-wsdl-parser
predic8 Mar 9, 2026
6b14b8f
Add embedded WSDL example and enhance parser robustness for URI norma…
predic8 Mar 9, 2026
1e2706b
Improve WSDL parser and URI utility
predic8 Mar 9, 2026
4a55bbc
Add copyright headers, logging improvements, and update SOAP namespac…
predic8 Mar 9, 2026
466cc05
Add copyright headers, logging improvements, and update SOAP namespac…
predic8 Mar 9, 2026
e4a9e14
Remove unused fields and redundant logic in `WSDLInterceptor`
predic8 Mar 9, 2026
d2b38e7
Remove redundant WSDL utility methods, tests, and dependencies
predic8 Mar 9, 2026
6767861
Remove `WSDLUtil` class and refactor related utilities
predic8 Mar 10, 2026
c5e149f
Add WSDL fault handling and improve parser robustness
predic8 Mar 10, 2026
0ef1e5b
Refactor WSDL parser: streamline imports, enhance schema handling, an…
predic8 Mar 10, 2026
c3b0803
Remove unused fields and simplify logic in WSDL parser classes
predic8 Mar 10, 2026
2a750ad
Merge branch 'master' into wsdl-validator-new-wsdl-parser
predic8 Mar 10, 2026
af4b1eb
Refactor WSDL parser: simplify attribute handling, improve SOAP versi…
predic8 Mar 10, 2026
99d8df0
Simplify `Binding` class by removing unused fields and refining `Port…
predic8 Mar 10, 2026
cf4bf05
Merge remote-tracking branch 'origin/wsdl-validator-new-wsdl-parser' …
predic8 Mar 10, 2026
4a7dd9c
Refactor WSDL parser classes for improved readability and maintainabi…
predic8 Mar 10, 2026
cd4a6da
Refactor WSDL parser: simplify field initialization, streamline list …
predic8 Mar 10, 2026
b1d679d
Refactor WSDL parser: simplify attribute handling, enhance fault hand…
predic8 Mar 11, 2026
75c9804
Improve WSDL parser exception handling and test assertions
predic8 Mar 11, 2026
b3f3738
Fix: include fault details in WebServiceExplorer table rendering
predic8 Mar 11, 2026
8a4bf53
Refactor WSDL parser: migrate to `record` for `WSDLParserContext`, si…
predic8 Mar 11, 2026
44535d0
Add SOAP 1.2 WSDL file and corresponding tests for enhanced schema va…
predic8 Mar 11, 2026
6b6de14
Refactor schema validation and WSDL parser components
predic8 Mar 11, 2026
4582fde
Refactor schema validation and WSDL components
predic8 Mar 11, 2026
ba9d83f
Merge branch 'master' into wsdl-validator-new-wsdl-parser
predic8 Mar 11, 2026
2ad6883
Refactor and enhance URI handling and WSDL/XML components
predic8 Mar 11, 2026
4468e52
Merge remote-tracking branch 'origin/wsdl-validator-new-wsdl-parser' …
predic8 Mar 11, 2026
919fe85
Refactor URI normalization: rename method for clarity, enhance except…
predic8 Mar 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.predic8.membrane.annot;

import javax.xml.*;
import javax.xml.namespace.*;
import java.io.*;
import java.util.*;
Expand Down Expand Up @@ -61,6 +62,10 @@ public class Constants {

public static final String HTTP_VERSION_11 = "1.1";

public static final String XMLNS_NS = "http://www.w3.org/2000/xmlns/";

public static final String WSDL11_NS = "http://schemas.xmlsoap.org/wsdl/";

public static final String WSDL_SOAP11_NS = "http://schemas.xmlsoap.org/wsdl/soap/";
public static final String WSDL_SOAP12_NS = "http://schemas.xmlsoap.org/wsdl/soap12/";
public static final String WSDL_HTTP_NS = "http://schemas.xmlsoap.org/wsdl/http/";
Expand All @@ -85,7 +90,7 @@ public enum SoapVersion { SOAP11, SOAP12, SOAP20, UNKNOWN }


/**
* Used for {@link Request}-to-XML and XML-to-{@link Response} conversions.
* Used for Request-to-XML and XML-to-Response conversions.
* See {@link REST2SOAPInterceptor}.
*/
public static final String HTTP_NS = "http://membrane-soa.org/schemas/http/v1/";
Expand Down
27 changes: 10 additions & 17 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
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.
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>service-proxy-core</artifactId>
Expand Down Expand Up @@ -89,20 +91,6 @@
<groupId>com.googlecode.jatl</groupId>
<artifactId>jatl</artifactId>
</dependency>
<dependency>
<groupId>com.predic8</groupId>
<artifactId>soa-model-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
Expand Down Expand Up @@ -230,6 +218,10 @@
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-templates</artifactId>
</dependency>
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-json</artifactId>
</dependency>

<!-- ntlm support-->
<dependency>
Expand Down Expand Up @@ -349,7 +341,7 @@
<version>5.19.1</version>
<scope>test</scope>
</dependency>
<dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
Expand Down Expand Up @@ -486,7 +478,8 @@
<configuration>
<target>
<copy todir="../docs">
<fileset dir="${project.build.directory}/classes/com/predic8/membrane/core/config/spring">
<fileset
dir="${project.build.directory}/classes/com/predic8/membrane/core/config/spring">
<include name="router-conf.xsd"/>
</fileset>
</copy>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected String getLocationHost(Exchange exc) {
if (host != null)
return host;

String locHost = exc.getOriginalHostHeaderHost();
var locHost = exc.getOriginalHostHeaderHost();

log.debug("host {}",locHost);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import com.predic8.membrane.annot.*;
import com.predic8.membrane.core.exchange.*;
import com.predic8.membrane.core.http.*;
import com.predic8.membrane.core.transport.http.*;
import com.predic8.membrane.core.util.*;
import com.predic8.membrane.core.ws.relocator.*;
import org.jetbrains.annotations.*;
Expand All @@ -28,11 +26,8 @@
import java.net.*;

import static com.predic8.membrane.annot.Constants.*;
import static com.predic8.membrane.core.http.Header.*;
import static com.predic8.membrane.core.http.Request.*;
import static com.predic8.membrane.core.interceptor.Interceptor.Flow.Set.*;
import static com.predic8.membrane.core.util.soap.WSDLUtil.*;
import static java.nio.charset.StandardCharsets.*;

/**
* @description <p>The <i>wsdlRewriter</i> rewrites endpoint addresses of services and XML Schema locations in WSDL documents.</p>
Expand All @@ -47,9 +42,7 @@ public class WSDLInterceptor extends RelocatingInterceptor {
public static final QName XSD_INCLUDE_QNAME = new QName(XSD_NS, "include");
public static final String LOCATION = "location";

private String registryWSDLRegisterURL;
private boolean rewriteEndpoint = true;
private HttpClient hc;

/**
* Path of the service location to rewrite
Expand All @@ -64,7 +57,6 @@ public WSDLInterceptor() {
@Override
public void init() {
super.init();
hc = router.getHttpClientFactory().createClient(null);

if (path != null)
setPathRewriterOnWSDLInterceptor(path);
Expand Down Expand Up @@ -94,12 +86,9 @@ public void setPathRewriterOnWSDLInterceptor(String keypath) {
protected void rewrite(Exchange exc) throws Exception {
log.debug("Changing endpoint address in WSDL");

ByteArrayOutputStream stream = new ByteArrayOutputStream();
Relocator relocator = getRelocator(exc, stream);
var stream = new ByteArrayOutputStream();
var relocator = getRelocator(exc, stream);
relocator.relocate(exc.getResponse().getBodyAsStream());
if (relocator.isWsdlFound()) {
registerWSDL(exc);
}
exc.getResponse().setBodyContent(stream.toByteArray());

// Preserve existing Content-Type if present; otherwise set a sane default including charset.
Expand All @@ -109,7 +98,7 @@ protected void rewrite(Exchange exc) throws Exception {
}

private @NotNull Relocator getRelocator(Exchange exc, OutputStream stream) throws Exception {
Relocator relocator = createRelocator(exc, stream);
var relocator = createRelocator(exc, stream);

if (rewriteEndpoint) {
relocator.getRelocatingAttributes().put(WSDL11_ADDRESS_SOAP11, LOCATION);
Expand All @@ -128,71 +117,6 @@ protected void rewrite(Exchange exc) throws Exception {
getLocationPort(exc), exc.getHandler().getContextPath(exc), pathRewriter);
}

private void registerWSDL(Exchange exc) {
if (registryWSDLRegisterURL == null)
return;

StringBuilder buf = new StringBuilder(2000);
buf.append(registryWSDLRegisterURL);
buf.append("?wsdl=");

buf.append(URLDecoder.decode(getWSDLURL(exc), US_ASCII));

callRegistry(buf.toString());

log.debug(buf.toString());
}

private void callRegistry(String uri) {
try {
var exchange = createExchange(uri);
hc.call(exchange);
Response res = exchange.getResponse();
if (res.getStatusCode() != 200)
log.warn("{}", res);
} catch (Exception e) {
log.error("", e);
}
}

private Exchange createExchange(String uri) throws MalformedURLException, URISyntaxException {
return get(getCompletePath(new URL(uri))).header(HOST, getHost(uri)).buildExchange();

}

private static String getHost(String uri) throws MalformedURLException {
return new URL(uri).getHost();
}

private String getCompletePath(URL url) {
if (url.getQuery() == null)
return url.getPath();
return url.getPath() + "?" + url.getQuery();
}

private String getWSDLURL(Exchange exc) {
StringBuilder buf = new StringBuilder();
buf.append(getLocationProtocol());
buf.append("://");
buf.append(getLocationHost(exc));
if (getLocationPort(exc) != 80) {
buf.append(":");
buf.append(getLocationPort(exc));
}
buf.append("/");
buf.append(exc.getRequest().getUri());
return buf.toString();
}

@MCAttribute
public void setRegistryWSDLRegisterURL(String registryWSDLRegisterURL) {
this.registryWSDLRegisterURL = registryWSDLRegisterURL;
}

public String getRegistryWSDLRegisterURL() {
return registryWSDLRegisterURL;
}

@Override
public String getShortDescription() {
return "Rewrites SOAP endpoint addresses and XML Schema locations in WSDL and XSD documents.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ private String createClientToken(FlowContext flowContext) {
}

public InputStream resolve(ResolverMap rm, String baseLocation, String url) throws Exception {
url = ResolverMap.combine(baseLocation, url);
url = ResolverMap.combine( baseLocation, url);
// ask the internal httpClient (might be proxied/authenticated), if HTTP
if (url.startsWith("http")) {
var exc = get(url).buildExchange();
Expand Down
Loading
Loading