在 Spring WS 中转换 XSD 导入以用于 WSDL
我尝试扩展 Spring WS 指南第 5 章中的示例。我正在使用 Spring WS 1.5.9 。
我已经添加了...
<import namespace="http://myco.com/schemas/promotion/v1_2"
schemaLocation="http://localhost:8080/ordersService/Promotion_1_2.xsd" /> ...
但是 spring 似乎并没有像端口那样改变导入的位置。因此,在我的公司网站上,它仍然显示“localhost:8080”,
我已将 WSDL 生成定义为这样
<bean id="orders" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name="schema" ref="schema" />
<property name="portTypeName" value="Orders" />
<property name="locationUri" value="http://localhost:8080/ordersService/" />
,Spring Framework 是否/可以以某种方式转换导入???
更新:更多背景信息......
我们使用与 maven JaxB2 插件相同的 XSD 来构建我们的响应模式对象。一切都很好,我们使用目录解析器在包含的 JAR 文件中实际查找附加业务域 XSD。我们有 100 个 XSD 来描述我们的业务领域。
所以我尽量不打破这一点。
我想看到的是一个更详细的例子。使用 JaxB2 和 XSD 的示例 -> WSDL 功能。
我应该重构 XSD 吗? 我应该使用 WSDL 而不是 XSD 如何正确识别要 spring 的 XSD? 我是否使用“classpath:My_file.xsd”?我是否必须向 schemaCollection 列出可能有 100 个 XSD?
spring 文档很棒,但我想要一个匹配的实际示例。
I'm tring to extend the example in chapter 5 of the Spring WS guide. I'm using Spring WS 1.5.9 .
I've added ...
<import namespace="http://myco.com/schemas/promotion/v1_2"
schemaLocation="http://localhost:8080/ordersService/Promotion_1_2.xsd" /> ...
But spring doesn't appear to be transforming the location of the import like it does for the port. So on my company website it still shows "localhost:8080"
I have the WSDL generation defined as such
<bean id="orders" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name="schema" ref="schema" />
<property name="portTypeName" value="Orders" />
<property name="locationUri" value="http://localhost:8080/ordersService/" />
Does/Can Spring Framework transform the imports some way ???
UPDATE: Some more background....
We use the same XSD with the maven JaxB2 plugin to build our response schema objects. That all works great, and we use the Catalog resolver to actually find the addional business domain XSDs in an included JAR file. We have 100's of XSDs that describe our business domain.
SO i'm trying not to break that.
What I would like to see is a more detailed example. An example where JaxB2 is used and XSD -> WSDL functionality.
Should I refactor the XSDs ?
Should I use a WSDL and not an XSD
How do I properly idenitfy the XSDs to spring ?
Do I use "classpath:My_file.xsd" ? Will I have to list possibly 100's of XSDs to schemaCollection ?
The spring Docs are great but I would like a practical example that matches.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想添加有关我们最终得到的解决方案的详细信息。我们已经转向 Spring WS 2x。这是更新的链接...
http://static.springsource.org/spring-ws/site/reference/html/server.html#server-automatic-wsdl-exposure
技巧/关键在该部分,它说......“如果如果您想通过包含或导入来使用多个模式,您将需要放置 Commons XMLSchema”,
这就是将其添加到我们项目中的最终答案。
现在 spring 启用了额外的功能来允许类路径解析工作。
I want to add detail on the solution we ended up with. We have been moving to Spring WS 2x. Here's an updated link...
http://static.springsource.org/spring-ws/site/reference/html/server.html#server-automatic-wsdl-exposure
The trick / key was in that section it says... "If you want to use multiple schemas, either by includes or imports, you will want to put Commons XMLSchema"
So that was the final answer to add that to our project.
Now spring enables additional functionality to allow classpath resolution to work.
Spring-WS 可以自动将所有模式元素直接内联到 WSDL 中,以便它们显示为单个文档。这避免了无法访问
URL 的问题。请参阅该部分 讨论了
CommonsXsdSchemaCollection
。Spring-WS can automagically inline all schema elements directly into the WSDL, so that they appear as a single document. This avoids the problem of inaccessible
<import>
URLs.See the section of the Spring WS manual which talks about
CommonsXsdSchemaCollection
.