Search in sources :

Example 6 with NoEncoderForKeyException

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

Aggregations

NoEncoderForKeyException (org.n52.svalbard.encode.exception.NoEncoderForKeyException)6 OwsOperationKey (org.n52.shetland.ogc.ows.service.OwsOperationKey)3 OwsServiceResponse (org.n52.shetland.ogc.ows.service.OwsServiceResponse)3 XmlObject (org.apache.xmlbeans.XmlObject)2 OwsEncodingException (org.n52.iceland.coding.encode.OwsEncodingException)2 NoApplicableCodeException (org.n52.shetland.ogc.ows.exception.NoApplicableCodeException)2 SoapResponse (org.n52.shetland.w3c.soap.SoapResponse)2 EncoderKey (org.n52.svalbard.encode.EncoderKey)2 EncodingException (org.n52.svalbard.encode.exception.EncodingException)2 ExceptionEvent (org.n52.iceland.event.events.ExceptionEvent)1 HTTPException (org.n52.iceland.exception.HTTPException)1 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)1 OperationResponseEncoderKey (org.n52.svalbard.encode.OperationResponseEncoderKey)1 XmlEncoderKey (org.n52.svalbard.encode.XmlEncoderKey)1