我有一个Web服务(使用Spring-WS).
我有一个包含几个架构(schema1.xsd,schema2.xsd和schema3.xsd)的jar,它们包含在我的Web服务中.
在我的Web服务wep应用程序中,有没有办法通过servlet通过jar公开模式?
我的Spring MessageDispatcherServlet映射到/ ws /
我希望将架构公开给/schemas/schema1.xsd /schemas/schema2.xsd,依此类推.
我有一个如何使用servlet的想法,但是它太冗长,必须有更好的方法.
我的想法是拥有一个servlet过滤器,并击中/ schemas /的所有内容检查它是否在我允许的资源列表中并显示它.
谢谢.
解决方法:
又是我!看到您对原始问题的评论后,我想我会提供一种替代解决方案.
如果我理解您的问题,似乎您有一个WSDL(由Spring-WS生成),其中包含对各种模式的引用.当客户端尝试遵循这些架构引用时,它会失败,因为没有此类资源.
Spring-WS提供了一种解决此问题的好方法,如section on WSDL exposure中所述:
If you want to use multiple schemas,
either by includes or imports, you
might want to use the
CommonsXsdSchemaCollection, and refer
to that from the
DefaultWsdl11Definition, like so:
classpath:/path/to/schema1.xsd
classpath:/path/to/schema2.xsd
When the inline property is enabled,
it follows all XSD imports and
includes, and inlines them in the
WSDL. This greatly simplifies the
deloyment of the schemas, which still
making it possible to edit them
separately.
因此,您得到的是生成的WSDL,其中内联了所有引用的架构,因此没有可供客户端遵循的引用.它非常漂亮,这意味着您不必单独公开架构文件.
标签:jar,spring,java,resources
来源: https://codeday.me/bug/20191024/1918239.html