How to setup HTTP Basic Authentication for SOAP Client within WebSphere Liberty

早过忘川 提交于 2019-12-23 01:02:08

问题


We are trying to deploy an EAR on WebSphere Liberty. Our application contains an EJB-module, which contains and EJB that makes a call to another SOAP server. The WSDL of the service defines a wsp:Policy with ExactlyOne of http:BasicAuthentication xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http"/

After deployment when we send a request to our application, which would trigger that SOAP-call we get an error: None of the policy alternatives can be satisfied.

I found some java-code on how to solve this

HTTPConduit http = (HTTPConduit) client.getConduit(); 
http.getAuthorization().setUserName("user");
http.getAuthorization().setPassword("pass");

But I do not want to do this in the Java-code but I want to make it part of the server config.

I found several helpful links, but still could not get it working. Does anybody have any suggestions on how I can set this up?

https://www.ibm.com/support/knowledgecenter/en/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/twlp_wssec_migrating.html

https://www.ibm.com/support/knowledgecenter/en/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/twlp_sec_ws_clientcert.html


回答1:


You could use the JNDI feature to express the userid and password in server.xml, then have your java code pull it out of JNDI.

https://www.ibm.com/support/knowledgecenter/en/SSD28V_8.5.5/com.ibm.websphere.wlp.core.doc/ae/twlp_dep_jndi.html



来源:https://stackoverflow.com/questions/49509415/how-to-setup-http-basic-authentication-for-soap-client-within-websphere-liberty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!