Cxf策略HTTPConduit不能满足任何策略备选方案

时间:2018-04-21 20:05:21

标签: java web-services soap wsdl policy

我使用CXF maven插件3.1.10和cxf的libs v.2.7.7为java WS生成了客户端,但是当我尝试调用在soapUI中导入的WS时,它会抛出异常“无法满足任何策略选择”< / p>

我的wsdl:

<wsp:Policy wsu:Id="WSHttpBinding_IPointOfSalesService_policy">
    <wsp:ExactlyOne>
        <wsp:All>
            <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                <wsp:Policy>
                    <sp:TransportToken>
                        <wsp:Policy>
                            <sp:HttpsToken RequireClientCertificate="false"/>
                        </wsp:Policy>
                    </sp:TransportToken>
                    <sp:AlgorithmSuite>
                        <wsp:Policy>
                            <sp:Basic256/>
                        </wsp:Policy>
                    </sp:AlgorithmSuite>
                    <sp:Layout>
                        <wsp:Policy>
                            <sp:Strict/>
                        </wsp:Policy>
                    </sp:Layout>
                </wsp:Policy>
            </sp:TransportBinding>
            <wsaw:UsingAddressing/>
        </wsp:All>
    </wsp:ExactlyOne>
</wsp:Policy>

Java代码:

try {
        service = new PointOfSalesService();
    } catch (Exception e) {
        Logger.error(this, e.getMessage());
        throw (e);
    }

    try {
        serviceBinding = service.getWSHttpBindingIPointOfSalesService();
        ((BindingProvider) serviceBinding).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                url);

        Client client = ClientProxy.getClient(serviceBinding);
        HTTPConduit http = (HTTPConduit) client.getConduit(); *<-- problem here*

        webserviceConfigured = true;
    } catch (Exception e) {
        Logger.error(this, e.getMessage());
    }

请帮忙!

0 个答案:

没有答案