use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class RountripTest method testOneWay.
@Test
public void testOneWay() throws Exception {
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress("http://localhost/Hello2");
svrBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
svrBean.setServiceBean(new GreeterImplDoc());
svrBean.setServiceClass(Greeter.class);
svrBean.setEndpointName(new QName("http://apache.org/hello_world_doc_lit", "SoapPort"));
svrBean.setServiceName(new QName("http://apache.org/hello_world_doc_lit", "SOAPService"));
svrBean.setWsdlLocation("testutils/hello_world_doc_lit.wsdl");
svrBean.setBus(getBus());
svrBean.create();
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class StaxDatabindingTest method testCallback.
@Test
public void testCallback() throws Exception {
String address = "local://foo";
ServerFactoryBean sf = new ServerFactoryBean();
sf.setServiceBean(new CallbackService());
sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
sf.setAddress(address);
sf.setDataBinding(new StaxDataBinding());
sf.getFeatures().add(new StaxDataBindingFeature());
sf.setBus(getBus());
sf.create();
Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "req.xml");
assertValid("//bleh", res);
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class StaxDatabindingTest method testCopy.
@Test
public void testCopy() throws Exception {
String address = "local://foo";
ServerFactoryBean sf = new ServerFactoryBean();
sf.setServiceBean(new CopyService());
sf.setBus(getBus());
sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
sf.setAddress(address);
sf.setDataBinding(new StaxDataBinding());
sf.getFeatures().add(new StaxDataBindingFeature());
sf.create().start();
Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "req.xml");
// DOMUtils.writeXml(res, System.out);
addNamespace("a", "http://stax.service.cxf.apache.org/");
assertValid("//a:bleh", res);
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class GenericAegisTest method testGenerateJavascript.
// the claim is that code generation makes this go boom.
@Test
public void testGenerateJavascript() throws Exception {
// Create our service implementation
GenericGenericClass<String> impl = new GenericGenericClass<String>();
// Create our Server
ServerFactoryBean svrFactory = new ServerFactoryBean();
// we sure can't get a .class for the interface, can we?
svrFactory.setServiceClass(impl.getClass());
svrFactory.setAddress("http://localhost:" + PORT + "/aegisgeneric");
svrFactory.setServiceBean(impl);
Server server = svrFactory.create();
ServiceInfo serviceInfo = ((EndpointImpl) server.getEndpoint()).getEndpointInfo().getService();
Collection<SchemaInfo> schemata = serviceInfo.getSchemas();
BasicNameManager nameManager = BasicNameManager.newNameManager(serviceInfo);
NamespacePrefixAccumulator prefixManager = new NamespacePrefixAccumulator(serviceInfo.getXmlSchemaCollection());
for (SchemaInfo schema : schemata) {
SchemaJavascriptBuilder builder = new SchemaJavascriptBuilder(serviceInfo.getXmlSchemaCollection(), prefixManager, nameManager);
String allThatJavascript = builder.generateCodeForSchema(schema.getSchema());
assertNotNull(allThatJavascript);
}
ServiceJavascriptBuilder serviceBuilder = new ServiceJavascriptBuilder(serviceInfo, null, prefixManager, nameManager);
serviceBuilder.walk();
String serviceJavascript = serviceBuilder.getCode();
assertNotNull(serviceJavascript);
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class CodeFirstWSDLTest method createService.
private Definition createService(Class<?> clazz) throws Exception {
JaxWsImplementorInfo info = new JaxWsImplementorInfo(clazz);
ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean(info);
Bus bus = getBus();
bean.setBus(bus);
Service service = bean.create();
InterfaceInfo i = service.getServiceInfos().get(0).getInterface();
assertEquals(5, i.getOperations().size());
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setBus(bus);
svrFactory.setServiceFactory(bean);
svrFactory.setServiceBean(clazz.newInstance());
svrFactory.setAddress(address);
svrFactory.create();
Collection<BindingInfo> bindings = service.getServiceInfos().get(0).getBindings();
assertEquals(1, bindings.size());
ServiceWSDLBuilder wsdlBuilder = new ServiceWSDLBuilder(bus, service.getServiceInfos().get(0));
return wsdlBuilder.build();
}
Aggregations