spring-ws 错误动态创建 wsdl

发布于 2024-11-15 11:30:05 字数 3333 浏览 2 评论 0原文

我想通过 spring-ws 自动创建我的 wsdl ,并将下面的代码插入到我的应用程序上下文文件中,但出现错误;

“无法找到元素 [dynamic-wsdl] 的 BeanDefinitionParser”

这是什么意思以及我能做什么? tnx

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org   /schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">


<bean id="payloadMapping"
       class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
    <property name="defaultEndpoint" ref="inferenceEndPoint" />
    <property name="interceptors">
        <list>
            <ref local="validatingInterceptor" />
            <ref local="payLoadInterceptor" />
        </list>
    </property>
</bean>

<bean id="payLoadInterceptor"
    class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" />

<bean id="validatingInterceptor"
    class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
    <description>
        This interceptor validates the incoming
        message contents
        according to the 'Request.xsd' XML
        Schema file.
    </description>
    <property name="schema" value="/WEB-INF/schemas/Request.xsd" />
    <property name="validateRequest" value="true" />
    <property name="validateResponse" value="false" />
</bean>

<bean id="inferenceEndPoint" class="com.mywebsite.ws.web.InferenceEndPoint">
    <property name="messageService" ref="messageService" />
</bean>

<bean id="messageService" class="com.mywebsite.ws.service.MessageService">
    <property name="inferenceService" ref="inferenceService" />
</bean>

<bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema">
    <property name="xsd" value="/WEB-INF/schemas/Request.xsd" />
</bean>

  <sws:dynamic-wsdl id="mtwsdl"
    portTypeName="mtWS"
    locationUri="http://localhost:8080/mws/">
<sws:xsd location="/WEB-INF/schemas/Request.xsd" />
   </sws:dynamic-wsdl>
<bean id="inferenceService" class="com.mywebsite.ws.im.InferenceService">
    <property name="webServiceConfiguration" ref="playerConfiguration" />
</bean>

<!-- <bean id="inferenceConfig" class="com.mywebsite.ws.im.InferenceService"> 
    <constructor-arg ref="playerConfiguration"/> </bean> -->

<!-- ~~~~~~~ Application beans ~~~~~~~ -->
<bean id="playerConfiguration"
    class="com.mywebsite.ws.configuration.WebServiceConfiguration"
    init-method="init">
    <property name="playerConfigXml" value="/WEB-INF/config/webserviceconfiguration.xml" />
    <property name="executingPathResource" value="/WEB-INF" />
    <property name="developmentMode" value="true" />
</bean>

I want to create my wsdl by spring-ws automatically and I inserted the code below to my app context file, but I got the error;

"Cannot locate BeanDefinitionParser for element [dynamic-wsdl]"

what does that mean and what can I do? tnx

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org   /schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">


<bean id="payloadMapping"
       class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
    <property name="defaultEndpoint" ref="inferenceEndPoint" />
    <property name="interceptors">
        <list>
            <ref local="validatingInterceptor" />
            <ref local="payLoadInterceptor" />
        </list>
    </property>
</bean>

<bean id="payLoadInterceptor"
    class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" />

<bean id="validatingInterceptor"
    class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
    <description>
        This interceptor validates the incoming
        message contents
        according to the 'Request.xsd' XML
        Schema file.
    </description>
    <property name="schema" value="/WEB-INF/schemas/Request.xsd" />
    <property name="validateRequest" value="true" />
    <property name="validateResponse" value="false" />
</bean>

<bean id="inferenceEndPoint" class="com.mywebsite.ws.web.InferenceEndPoint">
    <property name="messageService" ref="messageService" />
</bean>

<bean id="messageService" class="com.mywebsite.ws.service.MessageService">
    <property name="inferenceService" ref="inferenceService" />
</bean>

<bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema">
    <property name="xsd" value="/WEB-INF/schemas/Request.xsd" />
</bean>

  <sws:dynamic-wsdl id="mtwsdl"
    portTypeName="mtWS"
    locationUri="http://localhost:8080/mws/">
<sws:xsd location="/WEB-INF/schemas/Request.xsd" />
   </sws:dynamic-wsdl>
<bean id="inferenceService" class="com.mywebsite.ws.im.InferenceService">
    <property name="webServiceConfiguration" ref="playerConfiguration" />
</bean>

<!-- <bean id="inferenceConfig" class="com.mywebsite.ws.im.InferenceService"> 
    <constructor-arg ref="playerConfiguration"/> </bean> -->

<!-- ~~~~~~~ Application beans ~~~~~~~ -->
<bean id="playerConfiguration"
    class="com.mywebsite.ws.configuration.WebServiceConfiguration"
    init-method="init">
    <property name="playerConfigXml" value="/WEB-INF/config/webserviceconfiguration.xml" />
    <property name="executingPathResource" value="/WEB-INF" />
    <property name="developmentMode" value="true" />
</bean>

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

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

发布评论

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

评论(3

遥远的她 2024-11-22 11:30:05

替换您定义命名空间的应用程序上下文的第一部分:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

Replace the first section of your appcontext where you define namespaces:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
音栖息无 2024-11-22 11:30:05

我强烈建议使用 Maven。您收到的错误是由于缺少库造成的。在 Maven 中,您应该有一个如下所示的条目。

    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
        <version>2.1.0.RELEASE</version>
    </dependency>

I highly suggest to use Maven. The error you are getting is due to a missing library. In Maven you should have an entry like the following.

    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
        <version>2.1.0.RELEASE</version>
    </dependency>
怪我太投入 2024-11-22 11:30:05

我建议您查看类路径和服务器运行时路径,我认为您可能在编译/运行时路径中同时拥有(spring-ws 1.5.x 和 spring-ws 2.x)版本的 jar 文件。如果不是这种情况,请清理类和运行时路径并仅添加 spring-ws 2.x jar 文件。

至于区别,当spring框架名称空间处理程序(WebServicesNamespaceHandler)遇到(spring context文件中的dynamic-wsdl标签)时,它会注册一个(DynamicWsdlBeanDefinitionParser)bean动态 wsdl 标记中指定的属性。它本质上与您在 spring 上下文中注册 (DefaultWsdl11Definition) bean 相同。

I suggest you look at the class path and also server run time path, I think you may have both (spring-ws 1.5.x and spring-ws 2.x) version's of jar files either in the compile/run time path. If that is not the case clean up the both class and run time path and add only spring-ws 2.x jar files.

As for the differences, when spring framework name space handler (WebServicesNamespaceHandler) encounters (dynamic-wsdl tag in spring context file), It will register a (DynamicWsdlBeanDefinitionParser) bean with all the properties specified in the dynamic wsdl tag. It is essentially same as you registering (DefaultWsdl11Definition) bean in spring context.

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