bookservicetest.java

来自「Xfire文件 用于开发web service 的一个开源工具 很好用的」· Java 代码 · 共 43 行

JAVA
43
字号
package org.codehaus.xfire.demo;import org.codehaus.xfire.XFire;import org.codehaus.xfire.aegis.AbstractXFireAegisTest;import org.codehaus.xfire.client.XFireProxyFactory;import org.codehaus.xfire.service.Service;import org.codehaus.xfire.service.ServiceFactory;import org.codehaus.xfire.service.binding.ObjectServiceFactory;import org.codehaus.xfire.service.invoker.ObjectInvoker;/** * @author <a href="mailto:nathanyp@hotmail.com">Nathan Peles</a> */public class BookServiceTest extends AbstractXFireAegisTest{    public void setUp() throws Exception    {        super.setUp();                // Register the web service.        XFire xfire = getXFire();        ServiceFactory factory = new ObjectServiceFactory(xfire.getTransportManager(), null);                Service service = factory.create(BookService.class);        service.setProperty(ObjectInvoker.SERVICE_IMPL_CLASS, BookServiceImpl.class);        xfire.getServiceRegistry().register(service);    }        public void testClient() throws Exception    {        Service serviceModel = getXFire().getServiceRegistry().getService("BookService");        XFireProxyFactory serviceFactory = new XFireProxyFactory(getXFire());                // Connect to web service.        BookService service = (BookService) serviceFactory.create(serviceModel, "xfire.local://BookService");        assertNotNull(service);                // Call web service.        Book[] books = service.getBooks();        assertNotNull(books);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?