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);
}
}
}
Aggregations