We have a JAX-WS webservice deployed in a WAR in JBoss EAP 6.4.0 (JBoss AS 7.5.0) that delivers a predefined WSDL and XSD:
@WebService(endpointInterface = "package.MyPortType",
targetNamespace = "http://target.name.space",
wsdlLocation = "/WEB-INF/classes/myService.wsdl",
serviceName = "myService",
portName = "myServicePort")
public class MyService implements MyPortType {
...
}
JBoss correctly deploys the webservice and publishes the given WSDL as http://localhost:8080/myApp/myService and http://localhost:8080/myApp/myService?wsdl
The problem we encounter lies in the XSD import in the WSDL. In the original WSDL it looks like:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" ...>
<types>
<xsd:schema targetNamespace="http://target.name.space">
<xsd:import namespace="http://target.name.space"
schemaLocation="mySchema.xsd" />
But JBoss rewrites this to
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" ...>
<types>
<xsd:schema targetNamespace="http://target.name.space">
<xsd:import namespace="http://target.name.space"
schemaLocation="https://localhost:8443/myApp/myService?xsd=mySchema.xsd" />
And this does not work because we have neither a HTTPs connector nor HTTPs socket binding defined in standalone.xml
. So JBoss is running without any HTTPs connectivity.
We do not have any additional configuration files regarding the web service deployment.
Why are the imports rewritten in such an erroneous way and how can we prevent this?
From the JAX-WS spec:
A JAX-WS implementation MUST patch the location attributes of all
wsdl:import
andxsd:import
statement in local documents that point to local documents......Please note that, although the catalog facility (see 4.4) is used to resolve any absolute URLs encountered while processing the root description document or any documents transitively reachable from it via
wsdl:import
andxsd:import
statements, those absolute URLs will not be rewritten when the importing document is published, since documents resolved via the catalog are not considered local, even if the catalog maps them to resources packaged with the application.
So you have why the location is being rewritten, specifically because the XSD is local.
To avoid the rewrite, you need to specify an absolute URL of your choosing in the schemaLocation
field in the original WSDL.
As to why the location is being rewritten erroneously? There's some chatter on the JBoss issue board that might indicate that there's a bug in your JAX-WS implementation