The Location Attribute
In various places, Membrane's Spring-style configuration file, the proxies.xml, needs to reference external files or resources.
For example, if you reference a WSDL, you can write:
<validator wsdl="http://www.predic8.com:8080/material/ArticleService?wsdl" />
Membrane Service Proxy offers many ways to specify how to retrieve such resources. In the example, we used HTTP.
Ways to Specify the Resource Retrieval Method
Method | Example | Description |
---|---|---|
HTTP/S |
http://www.predic8.com/material/ArticleService?wsdl or https://www.predic8.com/material/ArticleService?wsdl |
Uses HTTP to fetch a representation of the resource. Note that by default the httpClientConfig of the associated router will be used to configure outbound HTTP connections. If necessary, an alternate httpClientConfig can be specified when using a location. |
Classpath | classpath:/com/predic8/membrane/core/interceptor/rest/xml2json.xsl |
Retrieves a resource from the classpath. Note that the classloader used to load service-proxy-core is used for the retrieval. |
File |
file:///etc/membrane/proxies.xml or file:///c:/Program Files/Membrane/proxies.xml |
Retrieves a resource using the file system. Note that if Membrane is deployed in a .war within a J2EE container, the root directory '/' refers to the root of the .war: Usually, the proxies.xml file is placed in the /WEB-INF directory. It can be referred to as file:///WEB-INF/proxies.xml. |
absolute path |
/etc/membrane/proxies.xml or C:/Program Files/Membrane/proxies.xml or C:\Program Files\Membrane\proxies.xml |
Implicitly uses the file system. The same note applies. |
relative path |
proxies.xml or ./a.xsd or ../b.xsd |
Resolves relatively to the resource containing the reference. |
Location Mangling
When Membrane retrieves a resource which references a second resource, the second resource's URL might be relative to the URL of the first resource.
For example, http://www.predic8.com/material/ArticleService?wsdl might refer to ./ArticleService?xsd=1.
Relative URLs are always resolved relatively to the URL of the resource whose representation contained the reference.
This means that http://www.predic8.com/material/ArticleService?wsdl and ./ArticleService?xsd=1 will be combined to compute the URL of the second resource:
http://www.predic8.com/material/ArticleService?xsd=1.
This mangling always takes place, if a resource is referenced by a relative URL.
Changes from pre-4.0.8
Membrane Service Proxy versions before 4.0.8 used to resolve relative paths in proxies.xml relative to the MEMBRANE_HOME environment variable. Versions since 4.0.8 resolve relative paths relative to the location of proxies.xml.
This aligns us with most of the internet (HTML, CSS, the XMLs including WSDL and XSD, etc.).
Unfortunately, this also requires the following change to your proxies.xml when upgrading from versions before 4.0.8 (if you use relative paths in proxies.xml):
If your pre-4.0.8 configuration looked like
<soapProxy wsdl="wsdls/ArticleService.wsdl" > ... </soapProxy>
You need to change it to:
<soapProxy wsdl="../wsdls/ArticleService.wsdl" > ... </soapProxy>
Explanation: To get to ArticleService.wsdl from proxies.xml, you first need to go one directory up, then one down (wsdls).