use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class MtomAppTest method testUpload.
public void testUpload() throws Exception {
int size = 123 * 1000 * 1000;
Hello port = new HelloService().getHelloPort(new MTOMFeature());
Map<String, Object> ctxt = ((BindingProvider) port).getRequestContext();
// At present, JDK internal property - not supported
ctxt.put("com.sun.xml.internal.ws.transport.http.client.streaming.chunk.size", 8192);
// Add this one to run with standalone RI bits
ctxt.put("com.sun.xml.ws.transport.http.client.streaming.chunk.size", 8192);
Holder<Integer> total = new Holder<Integer>(size);
Holder<String> name = new Holder<String>("huge");
Holder<DataHandler> dh = new Holder<DataHandler>(getDataHandler(total.value));
port.upload(total, name, dh);
if (!"hugehuge".equals(name.value)) {
fail("FAIL: Expecting: hugehuge Got: " + name.value);
}
if (!total.value.equals(size + 1)) {
fail("FAIL: Expecting size: " + (size + 1) + " Got: " + total.value);
}
System.out.println("SUCCESS: Got: " + name.value);
System.out.println("Going to verify DataHandler. This would take some time");
validateDataHandler(total.value, dh.value);
System.out.println("SUCCESS: DataHandler is verified");
if (dh.value instanceof Closeable) {
System.out.println("Client:Received DH is closeable");
((Closeable) dh.value).close();
}
}
use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class MtomAppTest method testUpload.
public void testUpload() throws Exception {
Hello port = new HelloService().getHelloPort(new MTOMFeature());
Map<String, Object> ctxt = ((BindingProvider) port).getRequestContext();
ctxt.put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192);
int total = 123456;
String name = "huge_oneway";
DataHandler dh = getDataHandler(total);
port.upload(total, name, dh);
// Thread.sleep(2000);
// assertTrue(port.verify(new VerifyType()));
}
use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class Issue671Test method setUp.
protected void setUp() throws Exception {
mtom_proxy = new HelloService().getHelloPort(new MTOMFeature());
no_mtom_proxy = new HelloService().getHelloPort();
provider_proxy = new HelloService().getHelloProviderPort(new MTOMFeature());
String helloPortAddress = (String) ((BindingProvider) mtom_proxy).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
QName serviceName = new QName("http://example.org/mtom", "Hello");
QName portName = new QName("http://example.org/mtom", "HelloPort");
Service service = Service.create(serviceName);
service.addPort(portName, HTTPBinding.HTTP_BINDING, helloPortAddress);
dispatch = service.createDispatch(portName, DataSource.class, Service.Mode.MESSAGE);
}
use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class MtomApp method main.
public static void main(String[] args) throws Exception {
Hello port = new HelloService().getHelloPort(new MTOMFeature());
Map<String, Object> ctxt = ((BindingProvider) port).getRequestContext();
ctxt.put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192);
testUpload(port);
}
use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class DeploymentDescriptorParser method createBinding.
/**
* @param ddBindingId binding id explicitlyspecified in the DeploymentDescriptor or parameter
* @param implClass Endpoint Implementation class
* @param mtomEnabled represents mtom-enabled attribute in DD
* @param mtomThreshold threshold value specified in DD
* @return is returned with only MTOMFeature set resolving the various precendece rules
*/
private static WSBinding createBinding(String ddBindingId, Class implClass, String mtomEnabled, String mtomThreshold, String dataBindingMode) {
// Features specified through DD
WebServiceFeatureList features;
MTOMFeature mtomfeature = null;
if (mtomEnabled != null) {
if (mtomThreshold != null) {
mtomfeature = new MTOMFeature(Boolean.valueOf(mtomEnabled), Integer.parseInt(mtomThreshold));
} else {
mtomfeature = new MTOMFeature(Boolean.valueOf(mtomEnabled));
}
}
BindingID bindingID;
if (ddBindingId != null) {
bindingID = BindingID.parse(ddBindingId);
features = bindingID.createBuiltinFeatureList();
if (checkMtomConflict(features.get(MTOMFeature.class), mtomfeature)) {
throw new ServerRtException(ServerMessages.DD_MTOM_CONFLICT(ddBindingId, mtomEnabled));
}
} else {
bindingID = BindingID.parse(implClass);
// Since bindingID is coming from implclass,
// mtom through Feature annotation or DD takes precendece
features = new WebServiceFeatureList();
if (mtomfeature != null) {
// this wins over MTOM setting in bindingID
features.add(mtomfeature);
}
features.addAll(bindingID.createBuiltinFeatureList());
}
if (dataBindingMode != null) {
features.add(new DatabindingModeFeature(dataBindingMode));
}
return bindingID.createBinding(features.toArray());
}
Aggregations