use of com.creditease.monitorframework.fat.client.CECXFClient in project uavstack by uavorg.
the class DoTestJaxWSHook method main.
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void main(String[] args) {
ConsoleLogger cl = new ConsoleLogger("test");
cl.setDebugable(true);
UAVServer.instance().setLog(cl);
UAVServer.instance().putServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR, ServerVendor.TOMCAT);
Map config = new HashMap();
Map adapts = JSONHelper.toObject("{\"org.apache.cxf.frontend.ClientProxy\":{\"getClient\":{args:[\"java.lang.Object\"],target:0}}}", Map.class);
config.put("adapts", adapts);
JaxWSHookProxy jp = new JaxWSHookProxy("test", config);
jp.doInstallDProxy(null, "test");
TestService_Service s = new TestService_Service();
TestService ts = s.getTestServicePort();
// 设置客户端的配置信息,超时等.
Client proxy = ClientProxy.getClient(ts);
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
// 连接服务器超时时间
policy.setConnectionTimeout(30000);
// 等待服务器响应超时时间
policy.setReceiveTimeout(30000);
conduit.setClient(policy);
ts.echo();
try {
ts.echoFault();
} catch (Exception e) {
e.printStackTrace();
}
Dispatch<SOAPMessage> d = s.createDispatch(new QName("http://service.fat.monitorframework.creditease.com/", "TestServicePort"), SOAPMessage.class, Mode.MESSAGE);
try {
SOAPMessage msg = MessageFactory.newInstance().createMessage();
d.invoke(msg);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("--------------->CECXFClient");
CECXFClient client = new CECXFClient(TestService_Service.class, TestService.class, TestService_Service.TestServicePort);
client.setConnectTimeout(30000);
client.setReceiveTimeout(30000);
try {
client.invoke("echo", null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Aggregations