作業中のプロジェクトのWebサービスにアクセスしようとしています。JAX-WSを使用しており、アプリはweblogicにデプロイされています。WSにアクセスしようとすると、次の例外が発生します。
javax.portlet.PortletException: javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://xxx.xxxx.ro:40000/idm/ws/cup?wsdl. It failed with:
Response: '401: Unauthorized' for url: 'http://xxx.xxxx.ro:40000/idm/ws/cup?wsdl'.
at com.bea.portlet.container.PortletStub.processAction(PortletStub.java:346)
at com.bea.portlet.container.AppContainer.invokeProcessAction(AppContainer.java:678)
........
問題に関する多くの投稿を読み、さまざまな種類の認証を試しました。BindingProvider、basicHTTPAuthをさまざまなユースケースで使用し、HostnameVerifierを無効にしようとしましたが、それでも結果が得られませんでした。
以下は、最後に試したバージョンとしての私のコードの抜粋です。
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
username,
password.toCharArray());
}
});
ComputeUserProfileImplService computeUserProfileImplService = new ComputeUserProfileImplService(
new URL(null, endpointURL, new sun.net.www.protocol.http.Handler()),
new QName("http://xxx.xx.xxxxx.xxxxx.com/",
"ComputeUserProfileImplService"));
ComputeUserProfileImpl computeUserProfile = computeUserProfileImplService
.getComputeUserProfileImplPort();
ComputeUserProfileImplServiceコードは次のようになります。
private final static URL COMPUTEUSERPROFILEIMPLSERVICE_WSDL_LOCATION;
private final static Logger logger = Logger.getLogger(com.xxxxx.xxxxx.xx.xxxxx.cup.ComputeUserProfileImplService.class.getName());
static {
URL url = null;
try {
URL baseUrl;
baseUrl = com.xxxxx.xxxxx.xx.xxxxx.xxx.ComputeUserProfileImplService.class.getResource("");
url = new URL(baseUrl, "http://xxxx.xxxxx.ro:40000/idm/ws/cup?wsdl");
} catch (MalformedURLException e) {
logger.warning("Failed to create URL for the wsdl Location: 'xxxxxxxxxxxxxxxx', retrying as a local file");
logger.warning(e.getMessage());
}
COMPUTEUSERPROFILEIMPLSERVICE_WSDL_LOCATION = url;
}
リンクを置き換えて申し訳ありませんが、それはかなり有名な組織であるため、私はそれらを投稿する権限がありません。いくつかの提案で私を助けることができれば、私は感謝します。私は解決策を探し続けていますが、行き詰まっています..私はそれを理解することができません。これは、私に当てはまるこのweblogicの問題の回避策になるはずです...しかし、私はそれを見つけることができません。必要に応じて、他のスニペットを投稿します。私がこれでかなり明確だったことを願っています。
前もって感謝します !!