Search in sources :

Example 11 with SOAPBinding

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

the class XOPWrappedTestCase method testParameterAnnotation.

@Test
@RunAsClient
public void testParameterAnnotation() throws Exception {
    QName serviceName = new QName("http://doclit.xop.samples.jaxws.ws.test.jboss.org/", "WrappedService");
    URL wsdlURL = new URL(baseURL + "wrapped?wsdl");
    Service service = Service.create(wsdlURL, serviceName);
    WrappedEndpoint port = service.getPort(WrappedEndpoint.class);
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
    binding.setMTOMEnabled(true);
    DataHandler request = new DataHandler("Client data", "text/plain");
    DataHandler response = port.parameterAnnotation(request);
    assertNotNull(response);
    Object content = getContent(response);
    String contentType = response.getContentType();
    assertEquals("Server data", content);
    assertEquals("text/plain", contentType);
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) SOAPBinding(javax.xml.ws.soap.SOAPBinding) DataHandler(javax.activation.DataHandler) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 12 with SOAPBinding

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

the class JBWS2000TestCase method testFileTransfer.

@Test
@RunAsClient
public void testFileTransfer() throws Exception {
    URL wsdlURL = new URL(baseURL + "/jaxws-jbws2000/FileTransfer?wsdl");
    QName serviceName = new QName("http://service.mtom.test.net/", "FileTransferServiceImplService");
    Service service = Service.create(wsdlURL, serviceName);
    FileTransferService port = service.getPort(FileTransferService.class);
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
    binding.setMTOMEnabled(true);
    // avoid going beyond Undertow default max post size
    GeneratorDataSource source = new GeneratorDataSource(1024 * 1204 * 8);
    DataHandler dh = new DataHandler(source);
    boolean success = port.transferFile("JBWS2000.data", dh);
    assertTrue("Failed to transfer file", success);
}
Also used : QName(javax.xml.namespace.QName) GeneratorDataSource(org.jboss.test.ws.jaxws.samples.xop.doclit.GeneratorDataSource) Service(javax.xml.ws.Service) SOAPBinding(javax.xml.ws.soap.SOAPBinding) DataHandler(javax.activation.DataHandler) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 13 with SOAPBinding

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

the class JBWS2259TestCase method testCall.

@Test
@RunAsClient
public void testCall() throws Exception {
    URL wsdlURL = new URL(baseURL + "?wsdl");
    QName serviceName = new QName("http://ws.jboss.org/jbws2259", "EndpointService");
    Service service = Service.create(wsdlURL, serviceName);
    Endpoint port = service.getPort(Endpoint.class);
    BindingProvider bindingProvider = (BindingProvider) port;
    SOAPBinding soapBinding = (SOAPBinding) bindingProvider.getBinding();
    soapBinding.setMTOMEnabled(true);
    File sharkFile = getResourceFile("jaxws/jbws2259/attach.jpeg");
    DataSource ds = new FileDataSource(sharkFile);
    DataHandler handler = new DataHandler(ds);
    String expectedContentType = "image/jpeg";
    Photo p = new Photo();
    p.setCaption("JBWS2259 Smile :-)");
    p.setExpectedContentType(expectedContentType);
    p.setImage(handler);
    Photo reponse = port.echo(p);
    DataHandler dhResponse = reponse.getImage();
    String contentType = dhResponse.getContentType();
    assertEquals("content-type", expectedContentType, contentType);
}
Also used : QName(javax.xml.namespace.QName) FileDataSource(javax.activation.FileDataSource) Service(javax.xml.ws.Service) SOAPBinding(javax.xml.ws.soap.SOAPBinding) BindingProvider(javax.xml.ws.BindingProvider) DataHandler(javax.activation.DataHandler) File(java.io.File) URL(java.net.URL) FileDataSource(javax.activation.FileDataSource) DataSource(javax.activation.DataSource) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 14 with SOAPBinding

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

the class CxfEndpoint method doPublish.

protected void doPublish(String address) {
    JaxWsServerFactoryBean svrFactory = new NoInitJaxWsServerFactoryBean();
    svrFactory.setBus(bus);
    svrFactory.setAddress(address);
    svrFactory.setServiceFactory(serviceFactory);
    svrFactory.setStart(false);
    svrFactory.setServiceBean(implementor);
    svrFactory.setDestinationFactory(destinationFactory);
    svrFactory.setServiceClass(serviceFactory.getServiceClass());
    final Properties beanConfig = serviceConfiguration.getProperties();
    // endpoint properties
    if (beanConfig != null) {
        final String schemaLocations = beanConfig.getProperty(CXF_JAXWS_PREFIX + "schema-locations");
        if (schemaLocations != null) {
            svrFactory.setSchemaLocations(Arrays.asList(schemaLocations.split(",")));
        }
        final String wsdlLocation = beanConfig.getProperty(CXF_JAXWS_PREFIX + "wsdl-location");
        if (wsdlLocation != null) {
            svrFactory.setWsdlLocation(wsdlLocation);
        }
    }
    // look for bean info if exists
    CxfUtil.configureEndpoint(svrFactory, serviceConfiguration, CXF_JAXWS_PREFIX);
    if (HTTPBinding.HTTP_BINDING.equals(implInfo.getBindingType())) {
        svrFactory.setTransportId("http://cxf.apache.org/bindings/xformat");
    }
    final Level level = SERVER_IMPL_LOGGER.getLevel();
    try {
        SERVER_IMPL_LOGGER.setLevel(Level.SEVERE);
    } catch (final UnsupportedOperationException uoe) {
    // no-op
    }
    try {
        server = svrFactory.create();
    } finally {
        try {
            SERVER_IMPL_LOGGER.setLevel(level);
        } catch (final UnsupportedOperationException uoe) {
        // no-op
        }
    }
    init();
    if (getBinding() instanceof SOAPBinding) {
        ((SOAPBinding) getBinding()).setMTOMEnabled(port.isMtomEnabled());
    }
    server.start();
}
Also used : SOAPBinding(javax.xml.ws.soap.SOAPBinding) Level(java.util.logging.Level) Properties(java.util.Properties) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 15 with SOAPBinding

use of javax.xml.ws.soap.SOAPBinding 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)

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