packagecom.sf.cbte;
importjava.util.ArrayList;
importjava.util.List;
importorg.apache.cxf.endpoint.Client;
importorg.apache.cxf.frontend.ClientProxy;
importorg.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.transport.http.HTTPConduit;
importorg.apache.cxf.transports.http.configuration.HTTPClientPolicy;
importcom.sf.ams.webservice.cbte.CBTETrackEventWebService;
import com.sf.ams.webservice.cbte.dto.TrackOrderEventsDTO;
publicclassTestServiceClient {
/**
* @throws InterruptedException
* @Description: TODO
* @author郭龙
* @return void
* @throws
*/
publicstaticvoidmain(String[] args) throwsInterruptedException {
//代理工厂
JaxWsProxyFactoryBean factory = newJaxWsProxyFactoryBean();
factory.setServiceClass(CBTETrackEventWebService.class);//设置请求接口
factory.setAddress("http://localhost:8084/ams/services/cBTETrackEventWebService");
CBTETrackEventWebService esbServer = (CBTETrackEventWebService)factory.create(); //创建客户端对象
//设置客户端的配置信息,超时等.
Client proxy = ClientProxy.getClient(esbServer);
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
HTTPClientPolicy policy = newHTTPClientPolicy();
policy.setConnectionTimeout(10000); //连接超时时间
policy.setReceiveTimeout(120000);//请求超时时间.
conduit.setClient(policy);
List<TrackOrderEventsDTO>trackOrderEventsDtoList = new ArrayList<TrackOrderEventsDTO>();
for(intj=0;j<500;j++){
TrackOrderEventsDTOtrackOrderEventsDTO = new TrackOrderEventsDTO();
trackOrderEventsDTO.setBsCode("xxx");
trackOrderEventsDTO.setEventCode("xx001");
trackOrderEventsDTO.setTrackChannelCode("xx");
trackOrderEventsDTO.setOrderNo("xxx000004DH"+j);
trackOrderEventsDTO.setEventDesc("ddd");
trackOrderEventsDtoList.add(trackOrderEventsDTO);
}
esbServer.addEvents(trackOrderEventsDtoList);
Thread.currentThread().sleep(60*1000);
}
}