Search in sources :

Example 11 with MTOMFeature

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();
    }
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) Holder(jakarta.xml.ws.Holder) Closeable(java.io.Closeable) BindingProvider(jakarta.xml.ws.BindingProvider) DataHandler(jakarta.activation.DataHandler)

Example 12 with MTOMFeature

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()));
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) BindingProvider(jakarta.xml.ws.BindingProvider) DataHandler(jakarta.activation.DataHandler) StreamingDataHandler(com.sun.xml.ws.developer.StreamingDataHandler)

Example 13 with MTOMFeature

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);
}
Also used : QName(javax.xml.namespace.QName) MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) Service(jakarta.xml.ws.Service) BindingProvider(jakarta.xml.ws.BindingProvider) DataSource(jakarta.activation.DataSource)

Example 14 with MTOMFeature

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);
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) BindingProvider(jakarta.xml.ws.BindingProvider)

Example 15 with MTOMFeature

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());
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) WebServiceFeatureList(com.sun.xml.ws.binding.WebServiceFeatureList) BindingID(com.sun.xml.ws.api.BindingID) ServerRtException(com.sun.xml.ws.server.ServerRtException)

Aggregations

MTOMFeature (jakarta.xml.ws.soap.MTOMFeature)22 BindingProvider (jakarta.xml.ws.BindingProvider)7 WebServiceFeature (jakarta.xml.ws.WebServiceFeature)5 SOAPMessage (jakarta.xml.soap.SOAPMessage)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 IOException (java.io.IOException)4 MessageContextFactory (com.oracle.webservices.api.message.MessageContextFactory)3 Message (com.sun.xml.ws.api.message.Message)3 Packet (com.sun.xml.ws.api.message.Packet)3 DataHandler (jakarta.activation.DataHandler)3 AttachmentPart (jakarta.xml.soap.AttachmentPart)3 MessageFactory (jakarta.xml.soap.MessageFactory)3 MimeHeaders (jakarta.xml.soap.MimeHeaders)3 InputStream (java.io.InputStream)3 QName (javax.xml.namespace.QName)3 MessageContext (com.oracle.webservices.api.message.MessageContext)2 BindingID (com.sun.xml.ws.api.BindingID)2 ImpliesWebServiceFeature (com.sun.xml.ws.api.ImpliesWebServiceFeature)2 StreamingDataHandler (com.sun.xml.ws.developer.StreamingDataHandler)2