调用Web服务肥皂,错误https URL主机名与客户端信任库中的服务器证书上的公用名(CN)不匹配

时间:2019-02-08 01:37:48

标签: java ssl soap ioexception saaj

嘿,我试图用SAAJ调用Soap Web服务

我使用Wildfly 10

我试图将此系统属性添加到standalone.xml,但不起作用

<system-properties>
    <property name="java.protocol.handler.pkgs" value="com.sun.net.ssl.internal.www.protocol"/>
    <property name="org.jboss.security.ignoreHttpsHost" value="true"/>
    <property name="cxf.tls-client.disableCNCheck" value="true"/>
</system-properties>

我遇到以下错误

20:53:08,208错误[stderr](默认任务21),原因是:java.io.IOException:IOException调用https://myip:port/b2cgw/PAGOS_B2C:https URL主机名与服务器上的公用名(CN)不匹配。客户端的信任库中的服务器证书。确保服务器证书正确,或者要禁用此检查(不建议用于生产),请将CXF客户端TLS配置属性“ disableCNCheck”设置为true。

私有静态ResponseEntity callSoapWebService(String soapEndpointUrl,String soapAction,String apikey,长时间戳){         尝试{             //创建SOAP连接             SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();             SOAPConnection soapConnection = soapConnectionFactory.createConnection();

        // Send SOAP Message to SOAP Server
        SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(soapAction, apikey, timestamp), soapEndpointUrl);

        // Print the SOAP Response
        System.out.println("Response SOAP Message:");
        soapResponse.writeTo(System.out);
        System.out.println();

        soapConnection.close();

        return new ResponseEntity(org.springframework.http.HttpStatus.OK);

    } catch (Exception e) {

        System.err.println("\nError occurred while sending SOAP Request to Server!\nMake sure you have the correct endpoint URL and SOAPAction!\n");

        e.printStackTrace();

        return new ResponseEntity(org.springframework.http.HttpStatus.BAD_REQUEST);
    }
}

请帮助,我没有任何cxf配置文件

0 个答案:

没有答案