Search in sources :

Example 6 with Codec

use of com.sun.xml.ws.api.pipe.Codec in project metro-jax-ws by eclipse-ee4j.

the class ReferenceParametersTest method useStreamCodec.

Message useStreamCodec(String msg) throws IOException {
    Codec codec = Codecs.createSOAPEnvelopeXmlCodec(SOAPVersion.SOAP_11);
    Packet packet = new Packet();
    ByteArrayInputStream in = new ByteArrayInputStream(msg.getBytes());
    codec.decode(in, "text/xml", packet);
    return packet.getMessage();
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) Codec(com.sun.xml.ws.api.pipe.Codec) ByteArrayInputStream(java.io.ByteArrayInputStream)

Example 7 with Codec

use of com.sun.xml.ws.api.pipe.Codec in project metro-jax-ws by eclipse-ee4j.

the class GlobalNsDeclTest method useStreamCodec.

Message useStreamCodec(String msg) throws IOException {
    Codec codec = Codecs.createSOAPEnvelopeXmlCodec(SOAPVersion.SOAP_11);
    Packet packet = new Packet();
    ByteArrayInputStream in = new ByteArrayInputStream(msg.getBytes());
    codec.decode(in, "text/xml", packet);
    return packet.getMessage();
}
Also used : Codec(com.sun.xml.ws.api.pipe.Codec) ByteArrayInputStream(java.io.ByteArrayInputStream)

Example 8 with Codec

use of com.sun.xml.ws.api.pipe.Codec in project metro-jax-ws by eclipse-ee4j.

the class CharactersTest method handleCharacters.

private void handleCharacters(int size) throws Exception {
    BindingID bid = BindingID.parse(SOAPBinding.SOAP11HTTP_MTOM_BINDING);
    BindingImpl binding = (BindingImpl) bid.createBinding();
    Codec codec = binding.createCodec();
    TestMessage msg = new TestMessage(size);
    Packet packet = new Packet();
    codec.decode(msg.getInputStream(), msg.getContentType(), packet);
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    XMLStreamWriter sw = XMLStreamWriterFactory.create(bout);
    packet.getMessage().writeTo(sw);
    sw.close();
    InputStream in = new ByteArrayInputStream(bout.toByteArray());
    XMLStreamReader sr = XMLStreamReaderFactory.create(null, in, true);
    while (sr.hasNext()) {
        sr.next();
        if (sr.getEventType() == XMLStreamReader.START_ELEMENT && sr.getLocalName().equals("doc1")) {
            assertEquals(msg.getEncodedText(), sr.getElementText().trim());
        }
    }
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) Packet(com.sun.xml.ws.api.message.Packet) Codec(com.sun.xml.ws.api.pipe.Codec) XMLStreamReader(javax.xml.stream.XMLStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BindingID(com.sun.xml.ws.api.BindingID)

Example 9 with Codec

use of com.sun.xml.ws.api.pipe.Codec in project metro-jax-ws by eclipse-ee4j.

the class StreamMessageTest method createSOAP11StreamMessage.

private StreamMessage createSOAP11StreamMessage(String msg) throws IOException {
    Codec codec = Codecs.createSOAPEnvelopeXmlCodec(SOAPVersion.SOAP_11);
    Packet packet = new Packet();
    ByteArrayInputStream in = new ByteArrayInputStream(msg.getBytes());
    codec.decode(in, "text/xml", packet);
    return (StreamMessage) packet.getMessage();
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) Codec(com.sun.xml.ws.api.pipe.Codec) ByteArrayInputStream(java.io.ByteArrayInputStream) StreamMessage(com.sun.xml.ws.message.stream.StreamMessage)

Example 10 with Codec

use of com.sun.xml.ws.api.pipe.Codec in project metro-jax-ws by eclipse-ee4j.

the class BodyPrologueAndEpilogueTest method useStreamCodec.

private StreamMessage useStreamCodec(String msg) throws IOException {
    Codec codec = Codecs.createSOAPEnvelopeXmlCodec(SOAPVersion.SOAP_11);
    Packet packet = new Packet();
    ByteArrayInputStream in = new ByteArrayInputStream(msg.getBytes());
    codec.decode(in, "text/xml", packet);
    return (com.sun.xml.ws.message.stream.StreamMessage) packet.getInternalMessage();
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) Codec(com.sun.xml.ws.api.pipe.Codec) ByteArrayInputStream(java.io.ByteArrayInputStream)

Aggregations

Codec (com.sun.xml.ws.api.pipe.Codec)19 ByteArrayInputStream (java.io.ByteArrayInputStream)13 Packet (com.sun.xml.ws.api.message.Packet)12 ContentType (com.sun.xml.ws.api.pipe.ContentType)3 IOException (java.io.IOException)3 Attachment (com.sun.xml.ws.api.message.Attachment)2 Message (com.sun.xml.ws.api.message.Message)2 MimeAttachmentSet (com.sun.xml.ws.message.MimeAttachmentSet)2 StreamMessage (com.sun.xml.ws.message.stream.StreamMessage)2 ByteArrayBuffer (com.sun.xml.ws.util.ByteArrayBuffer)2 WebServiceException (jakarta.xml.ws.WebServiceException)2 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)2 BindingID (com.sun.xml.ws.api.BindingID)1 WSBinding (com.sun.xml.ws.api.WSBinding)1 BindingImpl (com.sun.xml.ws.binding.BindingImpl)1 MtomCodec (com.sun.xml.ws.encoding.MtomCodec)1 SOAPBindingCodec (com.sun.xml.ws.encoding.SOAPBindingCodec)1 XMLHTTPBindingCodec (com.sun.xml.ws.encoding.XMLHTTPBindingCodec)1 XMLCodec (com.sun.xml.ws.encoding.xml.XMLCodec)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1