本文整理汇总了Java中org.apache.cxf.jaxws.JaxWsServerFactoryBean.setServiceClass方法的典型用法代码示例。如果您正苦于以下问题:Java JaxWsServerFactoryBean.setServiceClass方法的具体用法?Java JaxWsServerFactoryBean.setServiceClass怎么用?Java JaxWsServerFactoryBean.setServiceClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.jaxws.JaxWsServerFactoryBean
的用法示例。
在下文中一共展示了JaxWsServerFactoryBean.setServiceClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
/**
* 接口测试 wsdl: http://localhost:9000/wSSample?wsdl
* @param args
*/
public static void main(String[] args) {
System.out.println("web service 启动中。。。");
WSSampleImpl implementor = new WSSampleImpl();
String address = "http://192.168.245.221:9000/wSSample";
if (TestEnv.onTTrue) {
address = "http://localhost:9000/wSSample";
}
JaxWsServerFactoryBean factoryBean = new JaxWsServerFactoryBean();
factoryBean.setAddress(address); // 设置地址
factoryBean.setServiceClass(WSSample.class); // 接口类
factoryBean.setServiceBean(implementor); // 设置实现类
factoryBean.create(); // 创建webservice接口
System.out.println("web service 启动成功。。");
}
示例2: setUp
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
template = context.createProducerTemplate();
JaxWsServerFactoryBean svrBean = new JaxWsServerFactoryBean();
svrBean.setAddress(getServerAddress());
svrBean.setServiceClass(Greeter.class);
svrBean.setServiceBean(new GreeterImpl());
SpringBusFactory bf = new SpringBusFactory();
URL cxfConfig = null;
if (getCxfServerConfig() != null) {
cxfConfig = ClassLoaderUtils.getResource(getCxfServerConfig(), this.getClass());
}
svrBean.setBus(bf.createBus(cxfConfig));
serviceEndpoint = svrBean.create();
}
示例3: createLocalJaxWsService
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
/**
* 构造服务,注意要自己释放
* @param intf
* @param bean
* @return
*/
private Server createLocalJaxWsService(Class<?> intf, Object bean) {
String url = "local://" + intf.getName();
ServiceDefinition ws = getFactory().processServiceDef(new ServiceDefinition(intf.getSimpleName(),intf,bean));
if (ws == null)
return null;
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(new CXFPlusServiceFactoryBean());
sf.setAddress(url);
sf.setServiceBean(ws.getServiceBean());
sf.setServiceClass(ws.getServiceClass());
if (printTrace()){
sf.getInInterceptors().add(new LoggingInInterceptor());
sf.getOutInterceptors().add(new LoggingOutInterceptor());
// sf.getHandlers().add(TraceHandler.getSingleton());
}
Server server = sf.create();
return server;
}
示例4: testDecoupledEndpoint
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
@Test
public void testDecoupledEndpoint() throws Exception {
JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
serverFactory.setAddress("zmq:(tcp://*:" + ZMQ_TEST_PORT + "?socketOperation=bind&socketType=pull)");
serverFactory.setServiceClass(HelloWorldImpl.class);
Server server = serverFactory.create();
JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean();
clientFactory.setServiceClass(HelloWorldPortType.class);
clientFactory.setAddress("zmq:(tcp://localhost:" + ZMQ_TEST_PORT + "?socketOperation=connect&socketType=push)");
clientFactory.getFeatures().add(new WSAddressingFeature());
HelloWorldPortType client = (HelloWorldPortType) clientFactory.create();
ClientProxy.getClient(client).getEndpoint()
.getEndpointInfo()
.setProperty("org.apache.cxf.ws.addressing.replyto",
"zmq:(tcp://127.0.0.1:5555?socketOperation=connect&socketType=push)");
String reply = client.sayHello("Claude");
server.stop();
assertEquals("Hello Claude", reply);
}
示例5: testConfigurationFromAPI
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
@Test
public void testConfigurationFromAPI() throws Exception {
JaxWsServerFactoryBean bean = new JaxWsServerFactoryBean();
bean.setAddress("zmq:(tcp://*:" + ZMQ_TEST_PORT + "?socketOperation=bind&socketType=rep)");
bean.setServiceClass(HelloWorldImpl.class);
Server server = bean.create();
ZMQ.Socket zmqSocket = zmqContext.socket(ZMQ.REQ);
zmqSocket.connect("tcp://localhost:" + ZMQ_TEST_PORT);
zmqSocket.send(FileUtils.readFileToString(new File(getClass().getResource("/samples/soap-request.xml").toURI())).getBytes(), 0);
byte[] reply = zmqSocket.recv(0);
zmqSocket.close();
server.stop();
XMLAssert.assertXMLEqual(FileUtils.readFileToString(new File(getClass().getResource("/samples/soap-reply.xml").toURI())), new String(reply));
}
示例6: testConfigurationFromWSDL
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
@Test
public void testConfigurationFromWSDL() throws Exception {
JaxWsServerFactoryBean bean = new JaxWsServerFactoryBean();
bean.setWsdlLocation("/wsdl/zmq_test.wsdl");
bean.setServiceClass(HelloWorldImpl.class);
Server server = bean.create();
ZMQ.Socket zmqSocket = zmqContext.socket(ZMQ.REQ);
zmqSocket.connect("tcp://localhost:" + ZMQ_TEST_PORT);
zmqSocket.send(FileUtils.readFileToString(new File(getClass().getResource("/samples/soap-request.xml").toURI())).getBytes(), 0);
byte[] reply = zmqSocket.recv(0);
zmqSocket.close();
server.stop();
XMLAssert.assertXMLEqual(FileUtils.readFileToString(new File(getClass().getResource("/samples/soap-reply.xml").toURI())), new String(reply));
}
示例7: Publish
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
static void Publish()
{
HelloWorldImpl implementor = new HelloWorldImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
System.setProperties(applyNoLimits(System.getProperties()));
svrFactory.setServiceClass(HelloWorld.class);
svrFactory.setAddress(Address);
svrFactory.setServiceBean(implementor);
TransferInterceptor.addServerHook(svrFactory, new MyServerHook());
TransferInterceptor.addServerHook(svrFactory,new MyLogHook());
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
svrFactory.create();
System.out.println("Published: " + implementor.getClass());
}
示例8: before
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
@Before
public void before() throws IOException {
Port = FindAvailablePort();
Address = String.format("http://localhost:%d/helloWorld", Port);
System.out.println("New Test's Address: " + Address);
// Create Server 'host'
HelloWorldImpl implementor = new HelloWorldImpl();
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
System.setProperties(ServerSide.applyNoLimits(System.getProperties()));
factory.setServiceClass(HelloWorld.class);
factory.setAddress(Address);
factory.setServiceBean(implementor);
TransferInterceptor.addServerHook(factory, new MyServerHook());
// factory.getInInterceptors().add(new LoggingInInterceptor());
// factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.create();
svrFactory = factory;
}
示例9: main
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) throws Exception{
Business service=new BusinessImpl();
JaxWsServerFactoryBean svrFactory=new JaxWsServerFactoryBean();
svrFactory.setServiceClass(Business.class);
svrFactory.setAddress("http://localhost:9527/business");
svrFactory.setServiceBean(service);
svrFactory.create();
}
示例10: initializeProcessEngine
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
@Override
protected void initializeProcessEngine() {
super.initializeProcessEngine();
webServiceMock = new WebServiceMockImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(WebServiceMock.class);
svrFactory.setAddress("http://localhost:63081/webservicemock");
svrFactory.setServiceBean(webServiceMock);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
server = svrFactory.create();
server.start();
}
示例11: initializeProcessEngine
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
@Override
protected void initializeProcessEngine() {
super.initializeProcessEngine();
webServiceMock = new WebServiceMockImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(WebServiceMock.class);
svrFactory.setAddress(WEBSERVICE_MOCK_ADDRESS);
svrFactory.setServiceBean(webServiceMock);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
server = svrFactory.create();
server.start();
}
示例12: main
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
public static void main(String[] args) {
System.out.println("web service 启动中。。。");
HelloWorld implementor= new HelloWorldImpl();
/**修改为自己电脑的IP**/
String address="http://192.168.1.19:9000/helloWorld";
JaxWsServerFactoryBean factoryBean=new JaxWsServerFactoryBean();
factoryBean.setAddress(address); // 设置地址
factoryBean.setServiceClass(HelloWorld.class); // 接口类
factoryBean.setServiceBean(implementor); // 设置实现类
factoryBean.create(); // 创建webservice接口
System.out.println("web service 启动成功。。");
}
示例13: initializeProcessEngine
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
@Override
protected void initializeProcessEngine() {
super.initializeProcessEngine();
counter = new CounterImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(Counter.class);
svrFactory.setAddress("http://localhost:12345/counter");
svrFactory.setServiceBean(counter);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
server = svrFactory.create();
server.start();
}
示例14: main
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
/**
* 独立启动WebService服务
*/
public static void main(String[] args) {
Counter counter = new CounterImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(Counter.class);
svrFactory.setAddress("http://localhost:12345/counter");
svrFactory.setServiceBean(counter);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
Server server = svrFactory.create();
server.start();
}
示例15: initializeProcessEngine
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; //导入方法依赖的package包/类
@Override
protected void initializeProcessEngine() {
super.initializeProcessEngine();
counter = new CounterImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(Counter.class);
svrFactory.setAddress("http://localhost:63081/counter");
svrFactory.setServiceBean(counter);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
server = svrFactory.create();
server.start();
}