简体   繁体   English

JBoss-防止WSDL分裂

[英]JBoss - Prevent WSDL splitting

I'm working in a SOAP WS project with JBoss. 我正在与JBoss一起进行SOAP WS项目。 In order to define SOAP operations, I annotate my Java classes with @Local and @WebService, and my methods with @WebMethod and @WebResult. 为了定义SOAP操作,我用@Local和@WebService注释Java类,并用@WebMethod和@WebResult注释方法。

The WSDL file is generated automatically by JBoss. WSDL文件由JBoss自动生成。 I can customize some aspects of the WSDL: https://docs.jboss.org/author/display/JBWS/Published+WSDL+customization 我可以自定义WSDL的某些方面: https : //docs.jboss.org/author/display/JBWS/Published+WSDL+customization

JBoss splits the WSDL in a few files. JBoss将WSDL分成几个文件。 The 'main' WSDL uses <wsdl:import/> tags to include other files. “主” WSDL使用<wsdl:import />标记包括其他文件。

My web service is used from within the intranet and externally. 我的Web服务是在Intranet内部和外部使用的。 The 'internal' hostname of my WS is different to its 'external' hostname. 我的WS的“内部”主机名与其​​“外部”主机名不同。 Since JBoss generates full URL links for the WSDL imports, and in order to ensure my WSDL is valid I have to overwrite the hostname of the URL using 'wsdl-host'. 由于JBoss为WSDL导入生成了完整的URL链接,并且为了确保我的WSDL有效,我必须使用'wsdl-host'覆盖URL的主机名。

I had to use the external URL in wsdl-host in order to allow both internal e external systems to work. 我必须在wsdl-host中使用外部URL,以使两个内部e外部系统都能正常工作。 As such, all internal SOAP clients fetch included parts of the WSDL using the external URL. 这样,所有内部SOAP客户端都会使用外部URL来获取WSDL的一部分。 If the external proxy is down for some reason, my internal clients become unable to use the WS since they can't load the WSDL. 如果外部代理由于某种原因而关闭,我的内部客户端将无法使用WS,因为它们无法加载WSDL。

Is there a way to prevent JBoss from splitting the WSDL in multiple files, or to force it to use a relative path instead of a full URL inside the <wsdl:import/> tags? 有没有一种方法可以防止JBoss将WSDL拆分为多个文件,或者强制它使用相对路径而不是<wsdl:import />标记内的完整URL?

The answer given here prevents the WSDL from splitting by inlining other WSDL files in the main WSDL. 此处给出的答案通过在主WSDL中内联其他WSDL文件防止WSDL分裂。 I can confirm it works. 我可以确认它有效。 In order to do that, I just used the same targetNamespace in all @WebService annotations. 为了做到这一点,我只在所有@WebService批注中使用了相同的targetNamespace

@WebService(targetNamespace="<your namespace here>")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM