【问题标题】:How to add Apache cxf wsrm for particular endpoint only如何仅为特定端点添加 Apache cxf wsrm
【发布时间】:2015-12-15 13:49:11
【问题描述】:

我只想为特定端点添加 Apache CXF wsrm,而不是在总线级别

我尝试了下面的代码,但它给出了异常:

<jaxws:endpoint id="testService" implementor="#testService" address="/testService" publishedEndpointUrl="${tomcat.url}/${context.name}/testService" >
    <jaxws:features>
        <wsp:Policy>
            <wsrm:RMAssertion xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
                <wsrm:AcknowledgementInterval Milliseconds="2000" />
            </wsrm:RMAssertion>
            <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
                <wsp:Policy>
                    <wsam:NonAnonymousResponses/>
                </wsp:Policy>
            </wsam:Addressing>
        </wsp:Policy>
    </jaxws:features>
</jaxws:endpoint>

但我得到了以下异常

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.util.List' for property 'features'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.apache.cxf.ws.policy.PolicyBean] to required type [org.apache.cxf.feature.AbstractFeature] for property 'features[0]': no matching editors or conversion strategy found
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:455)
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:491)
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:485)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1476)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1216)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    ... 24 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.apache.cxf.ws.policy.PolicyBean] to required type [org.apache.cxf.feature.AbstractFeature] for property 'features[0]': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:287)
    at org.springframework.beans.TypeConverterDelegate.convertToTypedCollection(TypeConverterDelegate.java:557)
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:216)
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:440)
    ... 30 more

【问题讨论】:

    标签: java web-services soap cxf ws-reliablemessaging


    【解决方案1】:

    我已经用下面的代码做到了:

        <wsp:Policy wsu:Id="RM" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsrm:RMAssertion xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
            <wsrm:AcknowledgementInterval Milliseconds="2000" />
        </wsrm:RMAssertion>
        <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
            <wsam:NonAnonymousResponses />
        </wsam:Addressing>
    </wsp:Policy>
    
    
    <jaxws:endpoint id="Service" implementor="#Serv" address="/Webservice" publishedEndpointUrl="${tomcat.url}/${context.name}/Webservice">
        <jaxws:features>
            <cxf:logging/>
            <p:policies>
                <wsp:PolicyReference URI="#RM" />
            </p:policies>
        </jaxws:features>
    </jaxws:endpoint>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-02
      • 1970-01-01
      • 1970-01-01
      • 2018-02-10
      • 2015-02-09
      • 1970-01-01
      • 1970-01-01
      • 2013-02-18
      相关资源
      最近更新 更多