Spring-ws:多个端点/wsdl/xsd/you-name-it

发布于 2024-12-09 14:07:46 字数 1499 浏览 0 评论 0原文

信息:我正在使用 Spring-ws 1.5.9 和 Spring 2.5.6

我目前正在构建大量 Web 服务,并且有一些关于架构应该如何的问题。

现在我只有一个网络服务。它(当然)包含一个 wsdl 和一个端点等等。

我目前正在扩展 Web 服务,并在那里创建了另一个 xsd、使用 JAXB2 (xjc) 的自动生成代码等。

现在,我应该如何处理这些 xsd、wsdl、代码等等?我看不到 Spring-ws 的建议...

我的架构师想要一个单一的 wsdl,可以使用以下方法来实现:

<bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="xsds">
    <list>
        <value>one.xsd</value>
        <value>two.xsd</value>
    </list>
</property>
<property name="inline" value="true"/>

这是一个好方法吗?我最终会得到大约 10-15 个 Web 服务,因此是一个大型 wsdl。

端点怎么样?我应该创建一个端点并测试请求的类型(例如使用instanceof)吗?我自己认为将一个端点映射到一个请求会更加优雅/干净。

最后,编组怎么样?我有这个(带有一个 ws/schema):

    <oxm:jaxb2-marshaller id="marshaller" contextPath="mydomain.signals.one.v1_0.schemas"/>
<oxm:jaxb2-marshaller id="unmarshaller" contextPath="mydomain.signals.v1_0.schemas"/>

但是,我应该如何添加另一个架构?我正在尝试类似以下的操作,但现在似乎对我不起作用:

    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="contextPaths">
        <list>
            <value>mydomain.signals.one.v1_0.schemas</value>
            <value>mydomain.signals.two.v1_0.schemas</value>
        </list>
    </property>
</bean>

我希望这是有道理的。我的目标是关于我应该做什么的指示和提示。

Info: I'm using Spring-ws 1.5.9 and Spring 2.5.6

I'm currently in the process of build a lot of web services and have a few questions as to how the architecture should be.

Right now I have a single web service. It (of course) contains a single wsdl and a single endpoints and so forth.

I'm currently extending the web service, and there I have created another xsd, auto-gen code using JAXB2 (xjc) and so forth.

Now, how should I handle these xsds, wsdl(s), code and so forth? I cannot see what Spring-ws recommends...

My architect would like to have a single wsdl, which can be achieved using the following:

<bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="xsds">
    <list>
        <value>one.xsd</value>
        <value>two.xsd</value>
    </list>
</property>
<property name="inline" value="true"/>

Is this a good way to do this? I'm gonna end up with like 10-15 web services thus a large wsdl.

How about endpoints? Should I create a single endpoint and test for the type of request (e.g. using instanceof)? I myself think that having one endpoint mapping to one request is more elegant/clean.

Finally, what about marshalling? I have this (with one ws/schema):

    <oxm:jaxb2-marshaller id="marshaller" contextPath="mydomain.signals.one.v1_0.schemas"/>
<oxm:jaxb2-marshaller id="unmarshaller" contextPath="mydomain.signals.v1_0.schemas"/>

But, how should I add another schema to this?? I'm trying something like the following, which doesn't seem to be working for me right now:

    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="contextPaths">
        <list>
            <value>mydomain.signals.one.v1_0.schemas</value>
            <value>mydomain.signals.two.v1_0.schemas</value>
        </list>
    </property>
</bean>

I hope this makes sense. What I'm aiming for is pointers and hints as to what I should do.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪化雨蝶 2024-12-16 14:07:46

如果您有 10-15 个 Web 服务,那么没有一个巨大的 wsdl 是没有办法的。如果目标是单个 wsdl,那么您所做的似乎是可以接受的。

我更喜欢每个请求的端点。

另外,您是否尝试过在上下文路径中使用冒号分隔的值列表?因此,不要使用列表,只需使用一个长字符串,每个上下文路径用冒号分隔。

来自 Spring-WS 文档:

上下文路径是冒号 (:) 分隔的 Java 包名称的列表
包含架构派生类。

我知道该段落适用于 Jaxb1,但我很确定它仍然适用于 Jaxb2Marshaller。我认为如果您指定类,您只会使用列表变体。

http://static.springsource.org/spring-ws/site /reference/html/oxm.html

If you have 10-15 web services there's no way around not having a huge wsdl. If the goal is a single wsdl, what you are doing seems acceptable.

I would prefer endpoints for each request.

Also, have you tried using a colon separated list of values for your context path? So, don't use the list, just have one long string with each context path separated by colons.

From the Spring-WS documentation:

The context path is a list of colon (:) separated Java package names
that contain schema derived classes.

I know that passage is for Jaxb1 but I'm pretty sure it still applies to the Jaxb2Marshaller. I think you'd only use the list variant if you were specifying classes.

http://static.springsource.org/spring-ws/site/reference/html/oxm.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文