Search code examples
web-servicessoapjax-wswsimportwsit

How to Ignore wsit-client.xml when calling web service if exists


The application I am working on calls many webservice. Just recently I have intergrated another web service that requires wsit-client.xml for Soap authentication.

That is working now but all the other SOAP services have stopped working.

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?

Thanks


Solution

  • Fixed it by Using a Container and a Loader to configure a dynamic location for the wsit-client.xml. This way it is not automatically loaded. To do that, I first implemented a Container for the app as shown below

    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