java-Https WebService message: message does not contain a valid Security element

I am using axis 2 Web service client.

 

Https first call to the Web service throws an exception the following message: "Message does not contain a valid security elements."

I think the problem may be in the safe mode: may have to be message-level security in this case, how to configure the shaft.?

coding:

 

System.setProperty("javax.net.ssl.keyStore", jksFile);
System.setProperty("javax.net.ssl.keyStorePassword", jksPassword);

MyServicePortProxy proxy = new MyServicePortProxy();
Stub stub = (Stub) proxy.getMyServicePort();

proxy.setEndpoint(endpoint);
stub.setUsername(username);
stub.setPassword(password);

// throws exception with the above message:
proxy.serviceMethod(...);

Best answer

Look http://ws.apache.org/wss4j/package.html , we must define a client-config.wsdd, it tells axis including the user name / password (if you are using ws-security). For different standards and the difference between them, I am a little weak.

Published 566 original articles · won praise 0 · Views 2823

Guess you like

Origin blog.csdn.net/weixin_44109689/article/details/103996705
Recommended