簡體   English   中英

如何僅為特定端點添加Apache cxf wsrm

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

我只想為特定端點添加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

我已經用下面的代碼做到了:

    <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