use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.
the class JSONBinding method doPostOperation.
@Override
public void doPostOperation(HttpServletRequest req, HttpServletResponse res) throws HTTPException, IOException {
OwsServiceRequest request = null;
try {
request = parseRequest(req);
checkServiceOperatorKeyTypes(request);
OwsServiceResponse response = getServiceOperator(request).receiveRequest(request);
writeResponse(req, res, response);
} catch (OwsExceptionReport oer) {
oer.setVersion(request != null ? request.getVersion() : null);
LOG.warn("Unexpected error", oer);
writeOwsExceptionReport(req, res, oer);
}
}
use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.
the class KvpBinding method doGetOperation.
@Override
public void doGetOperation(HttpServletRequest req, HttpServletResponse res) throws HTTPException, IOException {
LOGGER.debug("KVP-REQUEST: {}", req.getQueryString());
OwsServiceRequest serviceRequest = null;
try {
serviceRequest = parseRequest(req);
// add request context information
serviceRequest.setRequestContext(getRequestContext(req));
OwsServiceResponse response = getServiceOperator(serviceRequest).receiveRequest(serviceRequest);
writeResponse(req, res, response);
} catch (OwsExceptionReport oer) {
oer.setVersion(serviceRequest != null ? serviceRequest.getVersion() : null);
writeOwsExceptionReport(req, res, oer);
}
}
use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.
the class SoapBinding method parseSoapRequest.
private void parseSoapRequest(SoapChain soapChain) throws OwsExceptionReport {
String soapAction = SoapHelper.checkSoapHeader(soapChain.getHttpRequest());
SoapRequest soapRequest = decode(soapChain.getHttpRequest());
if (soapRequest.getSoapAction() == null && soapAction != null) {
soapRequest.setAction(soapAction);
}
soapChain.setSoapRequest(soapRequest);
}
use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.
the class SoapBinding method createSoapResponse.
// private void parseBodyRequest(SoapChain chain) throws OwsExceptionReport,
// OwsExceptionReport {
//
// final XmlObject xmlObject = chain.getSoapRequest().getSoapBodyContent();
// DecoderKey key = CodingHelper.getDecoderKey(xmlObject);
// final Decoder<?, XmlObject> bodyDecoder = getDecoder(key);
// if (bodyDecoder == null) {
// throw new NoDecoderForKeyException(key).setStatus(BAD_REQUEST);
// }
// final Object aBodyRequest = bodyDecoder.decode(xmlObject);
// if (!(aBodyRequest instanceof AbstractServiceRequest)) {
// throw new NoApplicableCodeException().withMessage(
// "The returned object is not an AbstractServiceRequest implementation").setStatus(BAD_REQUEST);
// }
// AbstractServiceRequest bodyRequest = (AbstractServiceRequest)
// aBodyRequest;
// bodyRequest.setRequestContext(getRequestContext(chain.getHttpRequest()));
// if (bodyRequest instanceof CommunicationObjectWithSoapHeader) {
// ((CommunicationObjectWithSoapHeader)
// bodyRequest).setSoapHeader(chain.getSoapRequest().getSoapHeader());
// }
// chain.setBodyRequest(bodyRequest);
// }
private void createSoapResponse(SoapChain chain) {
SoapResponse soapResponse = new SoapResponse();
soapResponse.setSoapVersion(chain.getSoapRequest().getSoapVersion());
soapResponse.setSoapNamespace(chain.getSoapRequest().getSoapNamespace());
soapResponse.setHeader(checkSoapHeaders(chain.getSoapRequest().getSoapHeader()));
chain.setSoapResponse(soapResponse);
}
use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.
the class EReportingHeaderJSONEncoderTest method test.
@Test
public void test() throws OwsExceptionReport, URISyntaxException, EncodingException {
EReportingHeader header = getHeader();
JsonNode o = getEncoder().encode(header);
System.out.println(Json.print(o));
}
Aggregations