开发者

Get rid of client-config.wsdd in Axis

开发者 https://www.devze.com 2022-12-08 06:46 出处:网络
I am 开发者_StackOverflowsetting up my test environment and I need to programmatically register my handler/transport instead of using a client-config.wsdd:

I am 开发者_StackOverflowsetting up my test environment and I need to programmatically register my handler/transport instead of using a client-config.wsdd:

<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
 <handler name="MyClient" type="java:foo.bar.MyClient"/>
 <transport name="MyTransport" pivot="MyClient"/>
</deployment>

Would you know if it's possible?

Thanks in advance.


OK, I've checked Axis sources and the following code solved my problem:

AxisProperties.setProperty(EngineConfigurationFactory.SYSTEM_PROPERTY_NAME, "foo.bar.MyEngineConfigurationFactory");

...

import org.apache.axis.EngineConfiguration;
import org.apache.axis.EngineConfigurationFactory;
import org.apache.axis.configuration.BasicClientConfig;

public class MyEngineConfigurationFactory implements EngineConfigurationFactory {

    public static EngineConfigurationFactory newFactory(Object param) {
        return new MyEngineConfigurationFactory();
    }

    public EngineConfiguration getClientEngineConfig() {
        BasicClientConfig cfg = new BasicClientConfig();
        cfg.deployTransport("MyTransport", new MyClient());
        return cfg;
    }

    public EngineConfiguration getServerEngineConfig() {
        return null;
    }
}

That's it. I hope it helps someone.


in the other hand, you can add a new client-config.wsdd file to resource directory.

0

精彩评论

暂无评论...
验证码 换一张
取 消