use of org.apache.cxf.binding.xml.XMLBinding in project cxf by apache.
the class JaxWsEndpointImpl method createJaxwsBinding.
final void createJaxwsBinding() {
if (getBinding() instanceof SoapBinding) {
jaxwsBinding = new SOAPBindingImpl(getEndpointInfo().getBinding(), this);
MTOMFeature mtomFeature = getMTOMFeature();
if (mtomFeature != null && mtomFeature.isEnabled()) {
((SOAPBinding) jaxwsBinding).setMTOMEnabled(true);
}
} else if (getBinding() instanceof XMLBinding) {
jaxwsBinding = new HTTPBindingImpl(getEndpointInfo().getBinding(), this);
} else {
// REVISIT: Should not get here, though some bindings like JBI
// did not implement their own Binding type.
jaxwsBinding = new DefaultBindingImpl(this);
}
}
use of org.apache.cxf.binding.xml.XMLBinding in project cxf by apache.
the class ClientServerMiscTest method testSimpleClientWithWsdlAndBindingId.
@Test
public void testSimpleClientWithWsdlAndBindingId() throws Exception {
QName portName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService", "DocLitWrappedCodeFirstServicePort");
QName servName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService", "DocLitWrappedCodeFirstService");
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setBindingId("http://cxf.apache.org/bindings/xformat");
factory.setWsdlURL(ServerMisc.DOCLIT_CODEFIRST_URL_XMLBINDING + "?wsdl");
factory.setServiceName(servName);
factory.setServiceClass(DocLitWrappedCodeFirstService.class);
factory.setEndpointName(portName);
factory.setAddress(ServerMisc.DOCLIT_CODEFIRST_URL_XMLBINDING);
DocLitWrappedCodeFirstService port = (DocLitWrappedCodeFirstService) factory.create();
assertNotNull(port);
assertEquals(factory.getBindingId(), "http://cxf.apache.org/bindings/xformat");
assertTrue(ClientProxy.getClient(port).getEndpoint().getBinding() instanceof XMLBinding);
String echoMsg = port.echo("Hello");
assertEquals("Hello", echoMsg);
}
use of org.apache.cxf.binding.xml.XMLBinding in project cxf by apache.
the class ProviderServiceFactoryTest method testXMLBindingFromCode.
@Test
public void testXMLBindingFromCode() throws Exception {
JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
bean.setServiceClass(DOMSourcePayloadProvider.class);
bean.setBus(getBus());
bean.setInvoker(new JAXWSMethodInvoker(new DOMSourcePayloadProvider()));
Service service = bean.create();
assertEquals("DOMSourcePayloadProviderService", service.getName().getLocalPart());
InterfaceInfo intf = service.getServiceInfos().get(0).getInterface();
assertNotNull(intf);
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setBus(getBus());
svrFactory.setServiceFactory(bean);
String address = "http://localhost:9000/test";
svrFactory.setAddress(address);
svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
ServerImpl server = (ServerImpl) svrFactory.create();
assertEquals(1, service.getServiceInfos().get(0).getEndpoints().size());
Endpoint endpoint = server.getEndpoint();
Binding binding = endpoint.getBinding();
assertTrue(binding instanceof XMLBinding);
Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/provider/sayHi.xml");
addNamespace("j", "http://service.jaxws.cxf.apache.org/");
assertValid("/j:sayHi", res);
}
Aggregations