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);
}
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);
}
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);
}
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();
}
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);
}
}
Aggregations