Search in sources :

Example 6 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) {
    try {
        MtomSample port = new MtomService().getMtomPort(new MTOMFeature());
        if (port == null) {
            System.out.println("FAILURE: Couldnt get port!");
            System.exit(-1);
        }
        testUpload(port);
        testDownload(port);
    } catch (Exception ex) {
        System.out.println("SOAP 1.1 MtomApp FAILED!");
        ex.printStackTrace();
    }
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) IOException(java.io.IOException)

Example 7 with MTOMFeature

use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.

the class SOAPBindingCodec method postDecode.

/**
 * Should be called after decode().
 * Set the state so that such state is used by encode().
 */
private void postDecode(Packet p) {
    p.setFastInfosetDisabled(isFastInfosetDisabled);
    if (features.isEnabled(MTOMFeature.class))
        p.checkMtomAcceptable();
    // p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) );
    MTOMFeature mtomFeature = features.get(MTOMFeature.class);
    if (mtomFeature != null) {
        p.setMtomFeature(mtomFeature);
    }
    if (!useFastInfosetForEncoding) {
        useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType);
    // useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes);
    }
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature)

Example 8 with MTOMFeature

use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.

the class DeploymentDescriptorParser method parseAdapters.

private List<A> parseAdapters(XMLStreamReader reader) throws IOException, XMLStreamException {
    if (!reader.getName().equals(QNAME_ENDPOINTS)) {
        failWithFullName("runtime.parser.invalidElement", reader);
    }
    List<A> adapters = new ArrayList<>();
    String version = getMandatoryNonEmptyAttribute(reader, ATTR_VERSION);
    if (!version.equals(ATTRVALUE_VERSION_1_0)) {
        failWithLocalName("sun-jaxws.xml's version attribut runtime.parser.invalidVersionNumber", reader, version);
    }
    while (nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        if (reader.getName().equals(QNAME_ENDPOINT)) {
            String name = getMandatoryNonEmptyAttribute(reader, ATTR_NAME);
            if (!names.add(name)) {
                logger.log(Level.WARNING, "sun-jaxws.xml contains duplicate endpoint names. " + "The first duplicate name is = {0}", name);
            }
            String implementationName = getMandatoryNonEmptyAttribute(reader, ATTR_IMPLEMENTATION);
            Class<?> implementorClass = getImplementorClass(implementationName, reader);
            QName serviceName = getQNameAttribute(reader, ATTR_SERVICE);
            QName portName = getQNameAttribute(reader, ATTR_PORT);
            ArrayList<WebServiceFeature> features = new ArrayList<>();
            // get enable-mtom attribute value
            String enable_mtom = getAttribute(reader, ATTR_ENABLE_MTOM);
            String mtomThreshold = getAttribute(reader, ATTR_MTOM_THRESHOLD_VALUE);
            if (Boolean.valueOf(enable_mtom)) {
                if (mtomThreshold != null) {
                    features.add(new MTOMFeature(true, Integer.parseInt(mtomThreshold)));
                } else {
                    features.add(new MTOMFeature(true));
                }
            }
            String bindingId = getAttribute(reader, ATTR_BINDING);
            if (bindingId != null) {
                // Convert short-form tokens to API's binding ids
                bindingId = getBindingIdForToken(bindingId);
            }
            String urlPattern = getMandatoryNonEmptyAttribute(reader, ATTR_URL_PATTERN);
            // boolean handlersSetInDD = setHandlersAndRoles(binding, reader, serviceName, portName);
            nextElementContent(reader);
            ensureNoContent(reader);
            List<Source> metadata = new ArrayList<>();
            for (URL url : docs) {
                Source source = new StreamSource(url.openStream(), url.toExternalForm());
                metadata.add(source);
            }
            adapters.add(adapterFactory.createAdapter(name, urlPattern, implementorClass, serviceName, portName, bindingId, metadata, features.toArray(new WebServiceFeature[0])));
        } else {
            failWithLocalName("runtime.parser.invalidElement", reader);
        }
    }
    return adapters;
}
Also used : QName(javax.xml.namespace.QName) MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) StreamSource(javax.xml.transform.stream.StreamSource) ArrayList(java.util.ArrayList) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) URL(java.net.URL) WebServiceFeature(jakarta.xml.ws.WebServiceFeature)

Example 9 with MTOMFeature

use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.

the class MessageContextFactory method packet.

private Packet packet(Message m) {
    final Packet p = new Packet();
    // TODO when do we use xmlCodec?
    p.codec = soapCodec;
    if (m != null)
        p.setMessage(m);
    MTOMFeature mf = features.get(MTOMFeature.class);
    if (mf != null) {
        p.setMtomFeature(mf);
    }
    p.setSAAJFactory(saajFactory);
    return p;
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature)

Example 10 with MTOMFeature

use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.

the class MTOMActionEncodingTest method test.

public void test() throws UnsupportedEncodingException {
    Echo echoPort = new EchoService().getEchoPort(new MTOMFeature());
    String echoed = echoPort.echo(ALMOST_BINARY_CONTENT.getBytes("UTF-8"));
    assertEquals(echoed, ALMOST_BINARY_CONTENT);
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature)

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