Search in sources :

Example 1 with Soap12XmlStreamWriter

use of org.n52.svalbard.write.Soap12XmlStreamWriter in project arctic-sea by 52North.

the class Soap12Encoder method encode.

@Override
public void encode(Object element, OutputStream outputStream, EncodingContext ctx) throws EncodingException {
    if (element instanceof SoapResponse) {
        try {
            EncodingContext context = ctx.with(EncoderFlags.ENCODER_REPOSITORY, getEncoderRepository()).with(XmlEncoderFlags.XML_OPTIONS, (Supplier<XmlOptions>) this::getXmlOptions);
            new Soap12XmlStreamWriter(context, outputStream, (SoapResponse) element).write();
        } catch (XMLStreamException ex) {
            throw new EncodingException(ex);
        }
    } else {
        try {
            encode(element, ctx).save(outputStream, getXmlOptions());
        } catch (IOException ioe) {
            throw new EncodingException("Error while writing element to stream!", ioe);
        }
    }
}
Also used : Soap12XmlStreamWriter(org.n52.svalbard.write.Soap12XmlStreamWriter) SoapResponse(org.n52.shetland.w3c.soap.SoapResponse) XMLStreamException(javax.xml.stream.XMLStreamException) EncodingException(org.n52.svalbard.encode.exception.EncodingException) Supplier(java.util.function.Supplier) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 Supplier (java.util.function.Supplier)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 SoapResponse (org.n52.shetland.w3c.soap.SoapResponse)1 EncodingException (org.n52.svalbard.encode.exception.EncodingException)1 Soap12XmlStreamWriter (org.n52.svalbard.write.Soap12XmlStreamWriter)1