Reputation: 23
Following code works perfectly fine when compiled with JAVA-8 but does not work when compiled in JAVA-11. My project is a gradle build project. Inside this project I call a web service passing authentication details in the SOAP header.
When I trace the project in Wireshark, the difference I noticed in JAVA-8 compiled version and JAVA-11 compiled version is that SOAP Header doesn't add to the request in JAVA-11 compiled version hence getting the following error in the server.log also the response from the web service fails as the authentication details are missing in the header part.
server.log
2021-07-22 09:15:20,585 WARNING [com.sun.xml.ws.wspolicy.EffectiveAlternativeSelector] (default task-1) WSP0075: Policy assertion "{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}SupportingTokens" was evaluated as "UNKNOWN".
2021-07-22 09:15:20,585 WARNING [com.sun.xml.ws.wspolicy.EffectiveAlternativeSelector] (default task-1) WSP0019: Suboptimal policy alternative selected on the client side with fitness "UNKNOWN".
following are the two dependancies I use:-
[group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.4'],
[group: 'com.sun.xml.ws', name: 'jaxws-ri', version: '2.3.4']
SOAP Header is created as in the below class -
import javax.xml.ws.BindingProvider;
public abstract class AbstractHeaderProxy {
protected String endpoint;
protected static final String ENDPOINT_ADDRESS = "javax.xml.ws.service.endpoint.address";
public static final String WS_USERNAME = "ws-security.username";
public static final String WS_PASSWORD = "ws-security.password";
public void setupPort() {
final PropertyConfigData commnProps = getCommonProperties();
final String endpoint = "http://10.20.9.44:80/INVDetails/INVDetailsV2?WSDL";
final String username = "abc";
final String password = "abc123";
getPortBindingProvider().getRequestContext().put(ENDPOINT_ADDRESS, endpoint);
getPortBindingProvider().getRequestContext().put(WS_USERNAME, username);
getPortBindingProvider().getRequestContext().put(WS_PASSWORD, password);
}
public abstract String getEndPoint();
public abstract BindingProvider getPortBindingProvider();
}
Is there some dependencies I'm missing for JAVA-11? Or is there a way I can create this SOAP Header in a different way so it attaches to the request?
Upvotes: 2
Views: 612