如何在WebSphere Liberty中为SOAP客户端设置HTTP基本认证 [英] How to setup HTTP Basic Authentication for SOAP Client within WebSphere Liberty
问题描述
我们正在尝试在WebSphere Liberty上部署EAR.
我们的应用程序包含一个EJB模块,其中包含一个EJB,该EJB可以调用另一个SOAP服务器.
服务的WSDL使用http:BasicAuthentication xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http"/
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"/
部署后,当我们向应用程序发送请求时,这将触发该SOAP调用,因此会出现错误:None of the policy alternatives can be satisfied.
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.
我找到了一些有关如何解决此问题的Java代码
I found some java-code on how to solve this
HTTPConduit http = (HTTPConduit) client.getConduit();
http.getAuthorization().setUserName("user");
http.getAuthorization().setPassword("pass");
但是我不想在Java代码中执行此操作,但是我想使其成为服务器配置的一部分.
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?
推荐答案
您可以使用JNDI功能在server.xml中表示用户名和密码,然后让您的Java代码将其从JNDI中拉出.
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.