如何防止JBoss将JAX-WS XSD导入URL重写为HTTP [英] Howto prevent JBoss from rewriting JAX-WS XSD import URLs to HTTPs
问题描述
我们在JBoss EAP 6.4.0(JBoss AS 7.5.0)的WAR中部署了JAX-WS Web服务,该服务提供了预定义的WSDL和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正确部署了Web服务,并将给定的WSDL发布为 http://localhost:8080/myApp/myService 和 http://localhost:8080/myApp/myService?wsdl
我们遇到的问题在于WSDL中的XSD导入.在原始的WSDL中,它看起来像:
<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" />
但是JBoss将其重写为
<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" />
这不起作用,因为我们在standalone.xml
中都没有定义HTTPs连接器和HTTPs套接字绑定.因此,JBoss在没有任何HTTPs连接的情况下运行.
我们没有有关Web服务部署的任何其他配置文件.
为什么以这种错误的方式重写进口,我们如何防止这种情况发生?
根据JAX-WS规范:
JAX-WS实现必须修补指向本地文档的本地文档中所有
wsdl:import
和xsd:import
语句的位置属性 ......请注意,尽管目录工具(请参阅4.4)用于解析在处理根描述文档或通过
wsdl:import
和xsd:import
语句可传递的所有文档时遇到的任何绝对URL,但是发布导入文档时,绝对URL不会被重写,因为通过目录解析的文档不被视为本地文档,即使目录将它们映射到与应用程序打包在一起的资源上.
所以您有为什么位置被重写的原因,特别是因为XSD是本地的.
为避免重写,您需要在原始WSDL的schemaLocation
字段中指定您选择的绝对URL.
为什么错误地重写了位置? 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: 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: But JBoss rewrites this to And this does not work because we have neither a HTTPs connector nor HTTPs socket binding defined in 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 ...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 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 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 这篇关于如何防止JBoss将JAX-WS XSD导入URL重写为HTTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!@WebService(endpointInterface = "package.MyPortType",
targetNamespace = "http://target.name.space",
wsdlLocation = "/WEB-INF/classes/myService.wsdl",
serviceName = "myService",
portName = "myServicePort")
public class MyService implements MyPortType {
...
}
<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" />
<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" />
standalone.xml
. So JBoss is running without any HTTPs connectivity.
We do not have any additional configuration files regarding the web service deployment.
wsdl:import
and xsd:import
statement in local documents that point to local documents... wsdl:import
and xsd: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.schemaLocation
field in the original WSDL.