use of org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean in project jbossws-cxf by jbossws.
the class BeanCustomizer method configureClientProxyFactoryBean.
/**
* Configure the client proxy factory; currently set the binding customization in the databinding (Client Side).
*
* @param factory
*/
protected void configureClientProxyFactoryBean(ClientProxyFactoryBean factory) {
// Configure binding customization
if (customization != null) {
// customize default databinding (early pulls in ServiceFactory default databinding and configure it, as it's lazily loaded)
ReflectionServiceFactoryBean serviceFactory = factory.getServiceFactory();
serviceFactory.reset();
DataBinding serviceFactoryDataBinding = serviceFactory.getDataBinding(true);
configureBindingCustomization(serviceFactoryDataBinding, customization);
serviceFactory.setDataBinding(serviceFactoryDataBinding);
// customize user provided databinding (CXF later overrides the ServiceFactory databinding using the user provided one)
if (factory.getDataBinding() == null) {
// set the endpoint factory's databinding to prevent CXF resetting everything because user did not provide anything
factory.setDataBinding(serviceFactoryDataBinding);
} else {
configureBindingCustomization(factory.getDataBinding(), customization);
}
}
// add other configurations here below
}
use of org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean in project jbossws-cxf by jbossws.
the class BeanCustomizer method configureEndpointFactory.
/**
* Configure the endpoint factory
*
* @param factory
*/
protected void configureEndpointFactory(AbstractWSDLBasedEndpointFactory factory) {
// Configure binding customization
if (customization != null) {
ReflectionServiceFactoryBean serviceFactory = factory.getServiceFactory();
// customize default databinding (early pulls in ServiceFactory default databinding and configure it, as it's lazily loaded)
serviceFactory.reset();
DataBinding serviceFactoryDataBinding = serviceFactory.getDataBinding(true);
configureBindingCustomization(serviceFactoryDataBinding, customization);
serviceFactory.setDataBinding(serviceFactoryDataBinding);
// customize user provided databinding (CXF later overrides the ServiceFactory databinding using the user provided one)
if (factory.getDataBinding() == null) {
// set the endpoint factory's databinding to prevent CXF resetting everything because user did not provide anything
factory.setDataBinding(serviceFactoryDataBinding);
} else {
configureBindingCustomization(factory.getDataBinding(), customization);
}
}
// add other configurations here below
}
use of org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean in project cxf by apache.
the class JaxWsServiceFactoryBeanTest method testWrappedDocLit.
@Test
public void testWrappedDocLit() throws Exception {
ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
Bus bus = getBus();
bean.setBus(bus);
bean.setServiceClass(org.apache.hello_world_doc_lit.Greeter.class);
Service service = bean.create();
ServiceInfo si = service.getServiceInfos().get(0);
InterfaceInfo intf = si.getInterface();
assertEquals(4, intf.getOperations().size());
String ns = si.getName().getNamespaceURI();
assertEquals("http://apache.org/hello_world_doc_lit", ns);
OperationInfo greetMeOp = intf.getOperation(new QName(ns, "greetMe"));
assertNotNull(greetMeOp);
assertEquals("greetMe", greetMeOp.getInput().getName().getLocalPart());
assertEquals("http://apache.org/hello_world_doc_lit", greetMeOp.getInput().getName().getNamespaceURI());
List<MessagePartInfo> messageParts = greetMeOp.getInput().getMessageParts();
assertEquals(1, messageParts.size());
MessagePartInfo inMessagePart = messageParts.get(0);
assertEquals("http://apache.org/hello_world_doc_lit", inMessagePart.getName().getNamespaceURI());
assertEquals("http://apache.org/hello_world_doc_lit/types", inMessagePart.getElementQName().getNamespaceURI());
// test output
messageParts = greetMeOp.getOutput().getMessageParts();
assertEquals(1, messageParts.size());
assertEquals("greetMeResponse", greetMeOp.getOutput().getName().getLocalPart());
MessagePartInfo outMessagePart = messageParts.get(0);
// assertEquals("result", outMessagePart.getName().getLocalPart());
assertEquals("http://apache.org/hello_world_doc_lit", outMessagePart.getName().getNamespaceURI());
assertEquals("http://apache.org/hello_world_doc_lit/types", outMessagePart.getElementQName().getNamespaceURI());
OperationInfo greetMeOneWayOp = si.getInterface().getOperation(new QName(ns, "greetMeOneWay"));
assertEquals(1, greetMeOneWayOp.getInput().getMessageParts().size());
assertNull(greetMeOneWayOp.getOutput());
Collection<SchemaInfo> schemas = si.getSchemas();
assertEquals(1, schemas.size());
}
use of org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean in project cxf by apache.
the class JaxWsServiceFactoryBeanTest method testDocLiteralPartWithType.
@Test
public void testDocLiteralPartWithType() throws Exception {
ReflectionServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
serviceFactory.setBus(getBus());
serviceFactory.setServiceClass(NoBodyPartsImpl.class);
Service service = serviceFactory.create();
ServiceInfo serviceInfo = service.getServiceInfos().get(0);
QName qname = new QName("urn:org:apache:cxf:no_body_parts/wsdl", "operation1");
MessageInfo mi = serviceInfo.getMessage(qname);
qname = new QName("urn:org:apache:cxf:no_body_parts/wsdl", "mimeAttachment");
MessagePartInfo mpi = mi.getMessagePart(qname);
QName elementQName = mpi.getElementQName();
XmlSchemaElement element = serviceInfo.getXmlSchemaCollection().getElementByQName(elementQName);
assertNotNull(element);
}
use of org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean in project cxf by apache.
the class GreeterTest method testEndpoint.
@Test
public void testEndpoint() throws Exception {
ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(resource);
bean.setWsdlURL(resource.toString());
bean.setBus(bus);
bean.setServiceClass(GreeterImpl.class);
GreeterImpl greeter = new GreeterImpl();
BeanInvoker invoker = new BeanInvoker(greeter);
Service service = bean.create();
assertEquals("SOAPService", service.getName().getLocalPart());
assertEquals("http://apache.org/hello_world_soap_http", service.getName().getNamespaceURI());
ServerFactoryBean svr = new ServerFactoryBean();
svr.setBus(bus);
svr.setServiceFactory(bean);
svr.setInvoker(invoker);
svr.create();
Node response = invoke("http://localhost:9000/SoapContext/SoapPort", LocalTransportFactory.TRANSPORT_ID, "GreeterMessage.xml");
assertEquals(1, greeter.getInvocationCount());
assertNotNull(response);
addNamespace("h", "http://apache.org/hello_world_soap_http/types");
assertValid("/s:Envelope/s:Body", response);
assertValid("//h:sayHiResponse", response);
}
Aggregations