Search in sources :

Example 16 with OwsServiceResponse

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));
    }
}
Also used : EncodingContext(org.n52.svalbard.encode.EncodingContext) OperationResponseEncoderKey(org.n52.svalbard.encode.OperationResponseEncoderKey) XmlObject(org.apache.xmlbeans.XmlObject) XmlObject(org.apache.xmlbeans.XmlObject) StreamingEncoder(org.n52.svalbard.encode.StreamingEncoder) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse) OwsOperationKey(org.n52.shetland.ogc.ows.service.OwsOperationKey)

Example 17 with OwsServiceResponse

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;
}
Also used : SchemaLocation(org.n52.shetland.w3c.SchemaLocation) SchemaAwareEncoder(org.n52.svalbard.encode.SchemaAwareEncoder) SoapResponse(org.n52.shetland.w3c.soap.SoapResponse) XmlObject(org.apache.xmlbeans.XmlObject) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse)

Aggregations

OwsServiceResponse (org.n52.shetland.ogc.ows.service.OwsServiceResponse)11 XmlObject (org.apache.xmlbeans.XmlObject)5 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)4 OwsOperationKey (org.n52.shetland.ogc.ows.service.OwsOperationKey)4 OwsServiceRequest (org.n52.shetland.ogc.ows.service.OwsServiceRequest)4 NoEncoderForKeyException (org.n52.svalbard.encode.exception.NoEncoderForKeyException)3 OperationNotSupportedException (org.n52.shetland.ogc.ows.exception.OperationNotSupportedException)2 OperationResponseEncoderKey (org.n52.svalbard.encode.OperationResponseEncoderKey)2 EncodingException (org.n52.svalbard.encode.exception.EncodingException)2 IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 GetResultResponseType (net.opengis.sos.x20.GetResultResponseType)1 GetResultTemplateResponseType (net.opengis.sos.x20.GetResultTemplateResponseType)1 XmlOptions (org.apache.xmlbeans.XmlOptions)1 XmlString (org.apache.xmlbeans.XmlString)1 OwsEncodingException (org.n52.iceland.coding.encode.OwsEncodingException)1 RequestResponseModifier (org.n52.iceland.convert.RequestResponseModifier)1 RequestEvent (org.n52.iceland.event.events.RequestEvent)1 ResponseEvent (org.n52.iceland.event.events.ResponseEvent)1 RequestOperator (org.n52.iceland.request.operator.RequestOperator)1