WebServiceProtocol extends AbstractProxyProtocol { public WebServiceProtocol() { super(Fault.class); bus.setExtension(new ServletDestinationFactory(), HttpDestinationFactory.class); } WebServiceProtocol(); void setHttpBinder(HttpBinder httpBinder); @Override int getDefaultPort(); static final int DEFAULT_PORT; }
@Test public void testWebserviceProtocol() throws Exception { DemoService service = new DemoServiceImpl(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("webservice: service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("webservice: assertEquals(service.create(1,"kk").getName(), "kk"); assertEquals(service.getSize(null), -1); assertEquals(service.getSize(new String[]{"", "", ""}), 3); Object object = service.invoke("webservice: System.out.println(object); assertEquals("webservice: StringBuffer buf = new StringBuffer(); for (int i = 0; i < 1024 * 32 + 32; i++) buf.append('A'); assertEquals(32800,service.stringLength(buf.toString())); }
@Test public void testWebserviceProtocol() throws Exception { DemoService service = new DemoServiceImpl(); int port = NetUtils.getAvailablePort(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("webservice: service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("webservice: assertEquals(service.create(1, "kk").getName(), "kk"); assertEquals(service.getSize(null), -1); assertEquals(service.getSize(new String[]{"", "", ""}), 3); Object object = service.invoke("webservice: System.out.println(object); assertEquals("webservice: StringBuffer buf = new StringBuffer(); for (int i = 0; i < 1024 * 32 + 32; i++) buf.append('A'); assertEquals(32800, service.stringLength(buf.toString())); }