[英]How to Ignore wsit-client.xml when calling web service if exists
The application I am working on calls many webservice. 我正在处理的应用程序调用许多webservice。 Just recently I have intergrated another web service that requires wsit-client.xml for Soap authentication.
就在最近,我整合了另一个需要wsit-client.xml进行Soap身份验证的Web服务。
That is working now but all the other SOAP services have stopped working. 这是现在工作,但所有其他SOAP服务已停止工作。
Whenever any of them is being called, I see messages like 无论何时调用它们,我都会看到类似的消息
INFO: WSP5018: Loaded WSIT configuration from file: jar:file:/opt/atlasconf/atlas.20130307/bin/soap-sdd-1.0.0.jar!/META-INF/wsit-client.xml.
I suspect this is what is causing the Service calls to fail. 我怀疑这是导致服务调用失败的原因。
How can I cause the wsit-client.xml to be ignored for certain soap service calls? 如何在某些soap服务调用中忽略wsit-client.xml?
Thanks 谢谢
Fixed it by Using a Container and a Loader to configure a dynamic location for the wsit-client.xml. 通过使用Container和Loader为wsit-client.xml配置动态位置来修复它。 This way it is not automatically loaded.
这样它就不会自动加载。 To do that, I first implemented a Container for the app as shown below
为此,我首先为应用程序实现了一个Container,如下所示
public class WsitClientConfigurationContainer extends Container {
private static final String CLIENT_CONFIG = "custom/location/wsit-client.xml";
private final ResourceLoader loader = new ResourceLoader() {
public URL getResource(String resource) {
return getClass().getClassLoader().getResource(CLIENT_CONFIG);
}
};
@Override
public <T> T getSPI(Class<T> spiType) {
if (spiType == ResourceLoader.class) {
return spiType.cast(loader);
}
return null;
}
} }
Then to use it in the Code I do this 然后在代码中使用它我这样做
URL WSDL_LOCATION = this.getClass().getResource("/path/to/wsdl/mysvc.wsdl");
WSService.InitParams initParams = new WSService.InitParams();
initParams.setContainer(new WsitClientConfigurationContainer());
secGtwService = WSService.create(WSDL_LOCATION, SECGTWSERVICE_QNAME, initParams);
And it works like magic 它就像魔法一样
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.