use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class EndpointImpl method publish.
public void publish(javax.xml.ws.spi.http.HttpContext context) {
ServerFactoryBean sf = getServerFactory();
if (sf.getDestinationFactory() == null) {
sf.setDestinationFactory(new JAXWSHttpSpiTransportFactory(context));
}
publish(context.getPath());
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class HeaderTest method testInvocation.
@Test
public void testInvocation() throws Exception {
JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
Bus bus = getBus();
bean.setBus(bus);
bean.setServiceClass(TestHeaderImpl.class);
Service service = bean.create();
OperationInfo op = service.getServiceInfos().get(0).getInterface().getOperation(new QName(service.getName().getNamespaceURI(), "testHeader5"));
assertNotNull(op);
List<MessagePartInfo> parts = op.getInput().getMessageParts();
assertEquals(1, parts.size());
MessagePartInfo part = parts.get(0);
assertNotNull(part.getTypeClass());
assertEquals(TestHeader5.class, part.getTypeClass());
parts = op.getOutput().getMessageParts();
assertEquals(2, parts.size());
part = parts.get(1);
assertNotNull(part.getTypeClass());
assertEquals(TestHeader5ResponseBody.class, part.getTypeClass());
part = parts.get(0);
assertNotNull(part.getTypeClass());
assertEquals(TestHeader5.class, part.getTypeClass());
// part = parts.get(1);
// assertNotNull(part.getTypeClass());
ServerFactoryBean svr = new ServerFactoryBean();
svr.setBus(bus);
svr.setServiceFactory(bean);
svr.setServiceBean(new TestHeaderImpl());
svr.setAddress("http://localhost:9104/SoapHeaderContext/SoapHeaderPort");
svr.setBindingConfig(new JaxWsSoapBindingConfiguration(bean));
svr.create();
Node response = invoke("http://localhost:9104/SoapHeaderContext/SoapHeaderPort", LocalTransportFactory.TRANSPORT_ID, "testHeader5.xml");
assertNotNull(response);
assertNoFault(response);
addNamespace("t", "http://apache.org/header_test/types");
assertValid("//s:Header/t:testHeader5", response);
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class JaxWsServerFactoryBeanTest method testSimpleServiceClass.
@Test
public void testSimpleServiceClass() throws Exception {
ServerFactoryBean factory = new ServerFactoryBean();
factory.setServiceClass(Hello.class);
String address = "http://localhost:9001/jaxwstest";
factory.setAddress(address);
Server server = factory.create();
Endpoint endpoint = server.getEndpoint();
ServiceInfo service = endpoint.getEndpointInfo().getService();
assertNotNull(service);
Bus bus = factory.getBus();
Definition def = new ServiceWSDLBuilder(bus, service).build();
WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter();
def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
Document doc = wsdlWriter.getDocument(def);
Map<String, String> ns = new HashMap<>();
ns.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
ns.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
XPathUtils xpather = new XPathUtils(ns);
xpather.isExist("/wsdl:definitions/wsdl:binding/soap:binding", doc, XPathConstants.NODE);
xpather.isExist("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='add']/soap:operation", doc, XPathConstants.NODE);
xpather.isExist("/wsdl:definitions/wsdl:service/wsdl:port[@name='add']/soap:address[@location='" + address + "']", doc, XPathConstants.NODE);
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class AnnotationInterceptorTest method setUp.
@Before
public void setUp() {
fb = new ServerFactoryBean();
fb.setAddress("local://localhost");
fb.setBus(getBus());
jfb = new JaxWsServerFactoryBean();
jfb.setAddress("local://localhost");
jfb.setBus(getBus());
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class Server method startServer.
public static void startServer() throws Exception {
HelloWorldImpl helloworldImpl = new HelloWorldImpl();
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setServiceClass(HelloWorld.class);
svrFactory.setAddress("http://localhost:9000/Hello");
svrFactory.setServiceBean(helloworldImpl);
svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());
svrFactory.create();
}
Aggregations