Search in sources :

Example 1 with XMLBinding

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);
    }
}
Also used : MTOMFeature(javax.xml.ws.soap.MTOMFeature) SOAPBinding(javax.xml.ws.soap.SOAPBinding) DefaultBindingImpl(org.apache.cxf.jaxws.binding.DefaultBindingImpl) SOAPBindingImpl(org.apache.cxf.jaxws.binding.soap.SOAPBindingImpl) XMLBinding(org.apache.cxf.binding.xml.XMLBinding) SoapBinding(org.apache.cxf.binding.soap.SoapBinding) HTTPBindingImpl(org.apache.cxf.jaxws.binding.http.HTTPBindingImpl)

Example 2 with XMLBinding

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);
}
Also used : QName(javax.xml.namespace.QName) ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) XMLBinding(org.apache.cxf.binding.xml.XMLBinding) JaxbElementTest(org.apache.cxf.jaxb_element_test.JaxbElementTest) Test(org.junit.Test)

Example 3 with XMLBinding

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);
}
Also used : Binding(org.apache.cxf.binding.Binding) SoapBinding(org.apache.cxf.binding.soap.SoapBinding) XMLBinding(org.apache.cxf.binding.xml.XMLBinding) JaxWsServiceFactoryBean(org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean) ServerImpl(org.apache.cxf.endpoint.ServerImpl) Endpoint(org.apache.cxf.endpoint.Endpoint) Node(org.w3c.dom.Node) Service(org.apache.cxf.service.Service) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo) XMLBinding(org.apache.cxf.binding.xml.XMLBinding) JAXWSMethodInvoker(org.apache.cxf.jaxws.JAXWSMethodInvoker) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractJaxWsTest(org.apache.cxf.jaxws.AbstractJaxWsTest)

Aggregations

XMLBinding (org.apache.cxf.binding.xml.XMLBinding)3 SoapBinding (org.apache.cxf.binding.soap.SoapBinding)2 Test (org.junit.Test)2 QName (javax.xml.namespace.QName)1 MTOMFeature (javax.xml.ws.soap.MTOMFeature)1 SOAPBinding (javax.xml.ws.soap.SOAPBinding)1 Binding (org.apache.cxf.binding.Binding)1 Endpoint (org.apache.cxf.endpoint.Endpoint)1 ServerImpl (org.apache.cxf.endpoint.ServerImpl)1 ClientProxyFactoryBean (org.apache.cxf.frontend.ClientProxyFactoryBean)1 JaxbElementTest (org.apache.cxf.jaxb_element_test.JaxbElementTest)1 AbstractJaxWsTest (org.apache.cxf.jaxws.AbstractJaxWsTest)1 JAXWSMethodInvoker (org.apache.cxf.jaxws.JAXWSMethodInvoker)1 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)1 DefaultBindingImpl (org.apache.cxf.jaxws.binding.DefaultBindingImpl)1 HTTPBindingImpl (org.apache.cxf.jaxws.binding.http.HTTPBindingImpl)1 SOAPBindingImpl (org.apache.cxf.jaxws.binding.soap.SOAPBindingImpl)1 JaxWsServiceFactoryBean (org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean)1 Service (org.apache.cxf.service.Service)1 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)1