Client giving error when invoking a secured web service

百般思念 提交于 2019-12-04 21:16:18

You need to set SOAP envelope along with SOAP body which carries your payload from Service Client. I think that cause this problem. Please refer this blog post and refactor your code to add that. http://amilachinthaka.blogspot.com/2009/09/sending-arbitrary-soap-message-with.html

A little late on the response here, but I ran into the same error message and after further digging it was due to some SSL certificate failures.

There were 2 ways to fix this:

  • Adding trusted certificate to Java using the keytool command.

OR

  • Using your own custom code to accept all certs (ex. below with a acceptallCerts() method)

    public class SslUtil {
    
    private static class SmacsTrustManager implements X509TrustManager {
    
        @Override
        public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {}
    
        @Override
        public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {}
    
        @Override
        public X509Certificate[] getAcceptedIssuers() {
            return null;
        }
    }
    
    
    public static void acceptAllCerts(){
        try{
            SSLContext ctx = SSLContext.getInstance("TLS");
            ctx.init(new KeyManager[0], new TrustManager[] {new SmacsTrustManager()}, new SecureRandom());
            SSLContext.setDefault(ctx);
    
        }catch (Exception e){
    
        }
      }
    }
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!