我做了你告诉我的改变" pedrofb"和异常更改,我错误地调用请求的输出exept(cxfEndpoint.getInInterceptors()。添加(新的PropertiesWSS4JOutInterceptor(outProps,cryto)),当它真的是cxfEndpoint.getOutInterceptors()。add(new PropertiesWSS4JOutInterceptor(outProps, cryto))。使用" cxfEndpoint.getOutInterceptors()。添加(new LoggingOutInterceptor())"正如你告诉我的那样但是它无法在控制台中记录任何东西。但错误仍然存在,现在它给出了我是另一个例外:
oct 17, 2017 5:06:14 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFORMACIÓN: Creating Service {DGI_Modernizacion_Consolidado}WSPersonaGetActEmpresarialSoapPortService from class dgi_modernizacion_consolidado.WSPersonaGetActEmpresarialSoapPort
oct 17, 2017 5:06:17 PM org.apache.cxf.phase.PhaseInterceptorChain add
ADVERTENCIA: Skipping interceptor org.apache.cxf.binding.soap.saaj.SAAJInInterceptor$SAAJPreInInterceptor: Phase read specified does not exist.
oct 17, 2017 5:06:18 PM org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor checkActions
ADVERTENCIA: Security processing failed (actions mismatch)
oct 17, 2017 5:06:18 PM org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor handleMessage
ADVERTENCIA:
org.apache.ws.security.WSSecurityException: An error was discovered processing the <wsse:Security> header
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.checkActions(WSS4JInInterceptor.java:361)
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:317)
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:96)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133)
at com.sun.proxy.$Proxy34.execute(Unknown Source)
at t2voice.dgi.client_dgi.App.main(App.java:201)
我有很多变化,这就是为什么我让你感到困惑,对不起,请原谅我。这是与新错误相对应的代码。我可能做错了什么?
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(WSPersonaGetActEmpresarialSoapPort.class);
factory.setAddress("https://server.info.digitalsound.gub:6000/ePrueba/ws_personaGetActEmpresarialPrueba?wsdl");
WSPersonaGetActEmpresarialSoapPort port = (WSPersonaGetActEmpresarialSoapPort) factory.create();
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
Endpoint cxfEndpoint = client.getEndpoint();
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
outProps.put(WSHandlerConstants.USER, "alias");
outProps.put(WSHandlerConstants.SIG_PROP_FILE, "ws.properties");
outProps.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,ClientPasswordCallback.class.getName());
Map<String, Object> inProps = new HashMap<String, Object>();
inProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
inProps.put(WSHandlerConstants.USER, "alias");
inProps.put(WSHandlerConstants.SIG_PROP_FILE, "ws.properties");
inProps.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
cxfEndpoint.getInInterceptors().add(new PropertiesWSS4JInInterceptor(inProps, cryto));
cxfEndpoint.getOutInterceptors().add(new PropertiesWSS4JOutInterceptor(outProps, cryto));
WSPersonaGetActEmpresarialExecute parameters = new WSPersonaGetActEmpresarialExecute();
parameters.setRut("43557783445");
WSPersonaGetActEmpresarialExecuteResponse resp = port.execute(parameters);
这是相应的ws.properties
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.alias=alias
org.apache.ws.security.crypto.merlin.keystore.type = PKCS12
org.apache.ws.security.crypto.merlin.keystore.password=keystore_pass
org.apache.ws.security.crypto.merlin.file=keystore.pfx