Search in sources :

Example 21 with SOAPBinding

use of javax.xml.ws.soap.SOAPBinding in project cxf by apache.

the class JaxWsServiceFactoryBeanTest method testMtomFeature.

@Test
public void testMtomFeature() throws Exception {
    JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
    bean.setBus(getBus());
    bean.setServiceClass(GreeterImpl.class);
    bean.setWsdlURL(getClass().getResource("/wsdl/hello_world.wsdl"));
    bean.setWsFeatures(Arrays.asList(new WebServiceFeature[] { new MTOMFeature() }));
    Service service = bean.create();
    Endpoint endpoint = service.getEndpoints().values().iterator().next();
    assertTrue(endpoint instanceof JaxWsEndpointImpl);
    Binding binding = ((JaxWsEndpointImpl) endpoint).getJaxwsBinding();
    assertTrue(binding instanceof SOAPBinding);
    assertTrue(((SOAPBinding) binding).isMTOMEnabled());
}
Also used : Binding(javax.xml.ws.Binding) SOAPBinding(javax.xml.ws.soap.SOAPBinding) Endpoint(org.apache.cxf.endpoint.Endpoint) MTOMFeature(javax.xml.ws.soap.MTOMFeature) WebServiceFeature(javax.xml.ws.WebServiceFeature) Service(org.apache.cxf.service.Service) WebService(javax.jws.WebService) SOAPBinding(javax.xml.ws.soap.SOAPBinding) Test(org.junit.Test) AbstractJaxWsTest(org.apache.cxf.jaxws.AbstractJaxWsTest)

Example 22 with SOAPBinding

use of javax.xml.ws.soap.SOAPBinding in project cxf by apache.

the class MTOMBindingTypeTest method testEcho.

@Test
@org.junit.Ignore
public void testEcho() throws Exception {
    byte[] bytes = ImageHelper.getImageBytes(getImage("/java.jpg"), "image/jpeg");
    Holder<byte[]> image = new Holder<>(bytes);
    Hello port = getPort();
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
    binding.setMTOMEnabled(true);
    port.echoData(image);
    assertNotNull(image);
}
Also used : Hello(org.apache.cxf.systest.mtom_feature.Hello) Holder(javax.xml.ws.Holder) SOAPBinding(javax.xml.ws.soap.SOAPBinding) Test(org.junit.Test)

Example 23 with SOAPBinding

use of javax.xml.ws.soap.SOAPBinding in project cxf by apache.

the class ClientMtomXopWithJMSTest method createPort.

private static <T> T createPort(QName serviceName, QName portName, Class<T> serviceEndpointInterface, boolean enableMTOM) throws Exception {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setBus(bus);
    factory.setServiceName(serviceName);
    factory.setServiceClass(serviceEndpointInterface);
    factory.setWsdlURL(ClientMtomXopTest.class.getResource("/wsdl/mtom_xop.wsdl").toExternalForm());
    factory.setFeatures(Collections.singletonList(cff));
    factory.getInInterceptors().add(new TestMultipartMessageInterceptor());
    factory.getOutInterceptors().add(new TestAttachmentOutInterceptor());
    @SuppressWarnings("unchecked") T proxy = (T) factory.create();
    BindingProvider bp = (BindingProvider) proxy;
    SOAPBinding binding = (SOAPBinding) bp.getBinding();
    binding.setMTOMEnabled(true);
    return proxy;
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) SOAPBinding(javax.xml.ws.soap.SOAPBinding) BindingProvider(javax.xml.ws.BindingProvider)

Example 24 with SOAPBinding

use of javax.xml.ws.soap.SOAPBinding in project cxf by apache.

the class CXFServletTest method testGetBinding.

@Test
public void testGetBinding() throws Exception {
    Endpoint ep = Endpoint.create("http://schemas.xmlsoap.org/wsdl/soap/http", new HelloImpl());
    assertTrue(ep.getBinding() instanceof SOAPBinding);
}
Also used : Endpoint(javax.xml.ws.Endpoint) SOAPBinding(javax.xml.ws.soap.SOAPBinding) Test(org.junit.Test)

Example 25 with SOAPBinding

use of javax.xml.ws.soap.SOAPBinding in project cxf by apache.

the class JMSTestMtom method startServers.

@BeforeClass
public static void startServers() throws Exception {
    broker = new EmbeddedJMSBrokerLauncher();
    broker.startInProcess();
    bus = BusFactory.getDefaultBus();
    broker.updateWsdl(bus, "testutils/jms_test_mtom.wsdl");
    Object mtom = new JMSMTOMImpl();
    EndpointImpl ep = (EndpointImpl) Endpoint.publish("jms:jndi:dynamicQueues/test.cxf.jmstransport.queue&amp;receiveTimeout=10000", mtom);
    Binding binding = ep.getBinding();
    ((SOAPBinding) binding).setMTOMEnabled(true);
}
Also used : Binding(javax.xml.ws.Binding) SOAPBinding(javax.xml.ws.soap.SOAPBinding) EmbeddedJMSBrokerLauncher(org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) SOAPBinding(javax.xml.ws.soap.SOAPBinding) BeforeClass(org.junit.BeforeClass)

Aggregations

SOAPBinding (javax.xml.ws.soap.SOAPBinding)51 Test (org.junit.Test)20 URL (java.net.URL)19 BindingProvider (javax.xml.ws.BindingProvider)19 QName (javax.xml.namespace.QName)18 Service (javax.xml.ws.Service)14 DataHandler (javax.activation.DataHandler)13 WebServiceException (javax.xml.ws.WebServiceException)7 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)7 JBossWSTest (org.jboss.wsf.test.JBossWSTest)7 ArrayList (java.util.ArrayList)6 Holder (javax.xml.ws.Holder)6 Image (java.awt.Image)5 IOException (java.io.IOException)5 Binding (javax.xml.ws.Binding)5 File (java.io.File)4 Before (org.junit.Before)4 FileDataSource (javax.activation.FileDataSource)3 Handler (javax.xml.ws.handler.Handler)3 MTOMFeature (javax.xml.ws.soap.MTOMFeature)3