Https WebService message: message does not contain a valid security element

I am using axis 2 webservice client.

The first https call to the webservice throws an exception with the message: "The message does not contain a valid security element."

I think the problem may be in security mode: perhaps it should be message-level security. In this case, how can I adjust it on the axis ?.

The code:

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(...);
+3
source share
3 answers

http://ws.apache.org/wss4j/package.html, client-config.wsdd, , / ( ws-security, ). .

+1

Watch the clock. If the time stamp in the security element provided by the client is too far from the past or future from the point of view of the server, it can reject it with this message.

+1
source

Source: https://habr.com/ru/post/1699262/


All Articles