Axis 2 Client支持同一Web服务端点的多个证书

时间:2017-09-25 02:17:10

标签: java authentication soap axis2 p12

我们有连接到soap服务器的客户端,他们已经提供了我们必须在我们的密钥库中安装的客户端证书。它工作正常,直到我们从服务器获得其他客户端证书。我们已经将它安装在密钥库中,并且第一次调用webservice工作正常但是对于其他用户的第二次调用我们得到以下异常:

org.apache.axis2.AxisFault: unknown
        at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:517)
        at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
        at com.auruspay.manager.issuer.participants.processor.credibanco.VPOSWS20SOAPStub.authorize(VPOSWS20SOAPStub.java:193)
        at com.auruspay.manager.issuer.participants.processor.credibanco.CredibancoCartridge.connect(CredibancoCartridge.java:107)
        at com.auruspay.manager.issuer.participants.processor.credibanco.PauseCredibancoProcessor.run(CredibancoParticipant.java:92)
        at java.lang.Thread.run(Thread.java:745)

这是我配置身份验证的方式:

org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=PKCS12
org.apache.ws.security.crypto.merlin.keystore.password=pass
org.apache.ws.security.crypto.merlin.file=/home/amandloi/Development/Kushki/Colombia/Prodcution_Certificate/COM5766.p12
org.apache.ws.security.crypto.merlin.keystore.alias=vposwscrypto
com.alignet.www.vpos2.services.vposws20soap.url=https://testecommerce.credibanco.com/vpos2/services/VPOSWS20SOAP?wsdl
com.alignet.www.vpos2.services.vposws20.time.out.client=15000
rutaram=/home/amandloi/Development/Kushki/Colombia/updated plugin/credibanco-plugin-api-java-2.1.0/resources

这是我要构建客户端并选择要使用的证书的代码段:

    ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("/home/test/resource/", null);

            VPOSWS20SOAPStub  serviceVPOSWS = new VPOSWS20SOAPStub(ctx, urlService);

            ServiceClient client = serviceVPOSWS._getServiceClient();
            client.engageModule("rampart");
            Options clientOptions = new Options();
            clientOptions.setProperty(WSSHandlerConstants.OUTFLOW_SECURITY, getOutflowConfiguration()); 
            clientOptions.setProperty(WSSHandlerConstants.INFLOW_SECURITY, getInflowConfiguration());
            //clientOptions.setUserName("client cert");
            //clientOptions.setPassword("k12345");
            clientOptions.setTo(new EndpointReference(urlService));
            //clientOptions.setTimeOutInMilliSeconds(1000);
            clientOptions.setProperty(HTTPConstants.SO_TIMEOUT, 10000);
            clientOptions.setProperty(HTTPConstants.CONNECTION_TIMEOUT, 10000);
            clientOptions.setManageSession(false);

            client.setOptions(clientOptions);
            client.setCachingOperationContext(false);
            System.out.println("URL :"+client.getOptions().getTo().getAddress());
            serviceVPOSWS._setServiceClient( client );



            System.out.println(new Date());
            reqResp = serviceVPOSWS.authorize(req);


 private  Parameter getOutflowConfiguration() { 
        OutflowConfiguration ofc = new OutflowConfiguration(); 
        ofc.setActionItems("Signature Encrypt Timestamp"); 
        String fileName= "COMKEYCONFIG_"+clientID+".properties";
        LOG.info(participant.getTxnLogKey() + " PROPERTIES FILE NAME:"+fileName);
        ofc.setSignaturePropFile(fileName);

        //ofc.setSignatureKeyIdentifier("X509KeyIdentifier");
        ofc.setSignatureKeyIdentifier("DirectReference") ;
        ofc.setUser("client cert"); 
        ofc.setPasswordCallbackClass("com.test.ClientPWCBHandler");
        ofc.setEncryptionPropFile(fileName); 
        ofc.setEncryptionUser("vposwscrypto");
        ofc.setEncryptionKeyIdentifier("X509KeyIdentifier"); 
        LOG.info("ofc.getProperty() OUTPUTFLOW : "+ofc.getProperty().toString());
        return ofc.getProperty(); 
    } 

    private  Parameter getInflowConfiguration() { 
        InflowConfiguration ifc = new InflowConfiguration();

        ifc.setActionItems("Signature Timestamp"); 
        String fileName= "COMKEYCONFIG_"+clientID+".properties";
        ifc.setSignaturePropFile(fileName);
        ifc.setPasswordCallbackClass("com.test.ClientPWCBHandler"); 

        LOG.info("ifc.getProperty() INPUTFLOW : "+ifc.getProperty().toString());
        return ifc.getProperty(); 
    }

代码我们在独立应用程序上工作并支持两个用户证书,但在树脂和JPOS框架上的代码上部署时,它无法正常运行并给我未知错误

0 个答案:

没有答案