简体   繁体   English

如何仅为特定端点添加Apache cxf wsrm

[英]How to add Apache cxf wsrm for particular endpoint only

I want to add Apache CXF wsrm for particular endpoint only,not at bus level : 我只想为特定端点添加Apache CXF wsrm,而不是在总线级别添加

I have tried below code but it gives exception : 我试过下面的代码,但它给出了异常:

<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>

but i got below exception 但我低于例外

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

I have done this with below code : 我已经用下面的代码做到了:

    <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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM