我正在尝试将 WS-security 与我的 Apache CXF 客户端一起使用。我需要获取客户端端点,以便添加 WSS4J 拦截器。但是,当我打电话时,ClientProxy.getClient()
我收到IllegalArgumentException
以下消息:
不是代理实例
代码:
MailingService_ServiceLocator serviceLocator = new MailingService_ServiceLocator();
MailingService_PortType port = serviceLocator.getMailingServicePort();
Client client = ClientProxy.getClient(port); // throws exception
...
// Create client interceptor
AuthenticationInterceptor authenticationInterceptor =
new AuthenticationInterceptor(schemaNS, outprops, organizationName, null);
client.getEndpoint().getOutInterceptors().add(authenticationInterceptor);
痕迹:
java.lang.IllegalArgumentException: not a proxy instance
at java.lang.reflect.Proxy.getInvocationHandler(Unknown Source)
at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93)