use of org.n52.shetland.ogc.ows.service.OwsServiceResponse in project arctic-sea by 52North.
the class Soap12XmlStreamWriter method writeBodyContent.
/**
* Encode and write the {@link OwsServiceResponse} to stream
*
* @param bodyResponse The service internal response to encode and write
*
* @throws XMLStreamException If an error occurs when writing to {@link OutputStream}
* @throws EncodingException If an encoding error occurs
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void writeBodyContent(OwsServiceResponse bodyResponse) throws XMLStreamException, EncodingException {
Encoder<Object, OwsServiceResponse> encoder = getEncoder(new OperationResponseEncoderKey(new OwsOperationKey(bodyResponse), MediaTypes.APPLICATION_XML));
if (encoder instanceof StreamingEncoder<?, ?>) {
EncodingContext ctx = getContext().with(XmlBeansEncodingFlags.DOCUMENT).without(XmlBeansEncodingFlags.PROPERTY_TYPE).without(XmlBeansEncodingFlags.TYPE).with(StreamingEncoderFlags.EMBEDDED, true);
((StreamingEncoder) encoder).encode(bodyResponse, getOutputStream(), ctx);
} else {
String soapBodyContent = ((XmlObject) encoder.encode(bodyResponse)).xmlText(getXmlOptions());
rawText(stripXmlDeclaration(soapBodyContent));
}
}
use of org.n52.shetland.ogc.ows.service.OwsServiceResponse in project arctic-sea by 52North.
the class Soap12XmlStreamWriter method getSchemaLocation.
protected Set<SchemaLocation> getSchemaLocation() throws EncodingException, XMLStreamException {
SoapResponse response = getElement();
Set<SchemaLocation> schemaLocations = Sets.newHashSet();
schemaLocations.add(SoapConstants.SOAP_12_SCHEMA_LOCATION);
if (response.isSetBodyContent()) {
Encoder<Object, OwsServiceResponse> encoder = getEncoder(response.getBodyContent());
if (encoder != null && encoder instanceof SchemaAwareEncoder) {
schemaLocations.addAll(((SchemaAwareEncoder<?, ?>) encoder).getSchemaLocations());
}
}
return schemaLocations;
}
Aggregations