use of org.n52.shetland.ogc.ows.service.OwsOperationKey in project arctic-sea by 52North.
the class AbstractSoapEncoder method getBodyContent.
/**
* Get the content for the SOAPBody as {@link XmlObject}
*
* @param response SOAP response
*
* @return SOAPBody content as {@link XmlObject}
*
* @throws EncodingException If no encoder is available, the object to encode is not supported or an error occurs
* during the encoding
*/
protected XmlObject getBodyContent(SoapResponse response) throws EncodingException {
OperationResponseEncoderKey key = new OperationResponseEncoderKey(new OwsOperationKey(response.getBodyContent()), MediaTypes.APPLICATION_XML);
Encoder<Object, OwsServiceResponse> encoder = getEncoder(key);
if (encoder == null) {
throw new NoEncoderForKeyException(key);
}
return (XmlObject) encoder.encode(response.getBodyContent());
}
use of org.n52.shetland.ogc.ows.service.OwsOperationKey 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));
}
}
Aggregations