Search in sources :

Example 6 with OwsServiceRequest

use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.

the class PoxBinding method doPostOperation.

@Override
public void doPostOperation(HttpServletRequest req, HttpServletResponse res) throws HTTPException, IOException {
    OwsServiceRequest request = null;
    try {
        request = parseRequest(req);
        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);
    }
}
Also used : OwsServiceRequest(org.n52.shetland.ogc.ows.service.OwsServiceRequest) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport)

Example 7 with OwsServiceRequest

use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.

the class SoapBinding method createBodyResponse.

private void createBodyResponse(SoapChain chain) throws OwsExceptionReport {
    OwsServiceRequest req = chain.getSoapRequest().getSoapBodyContent();
    chain.setBodyResponse(getServiceOperator(req).receiveRequest(req));
}
Also used : OwsServiceRequest(org.n52.shetland.ogc.ows.service.OwsServiceRequest)

Example 8 with OwsServiceRequest

use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.

the class GenericRequestOperator method checkForModifierAndProcess.

private void checkForModifierAndProcess(OwsServiceRequest request, OwsServiceResponse response) throws OwsExceptionReport {
    if (!this.modifierRepository.hasRequestResponseModifier(request, response)) {
        return;
    }
    List<RequestResponseModifier> defaultModifier = new LinkedList<>();
    List<RequestResponseModifier> remover = new LinkedList<>();
    List<RequestResponseModifier> merger = new LinkedList<>();
    this.modifierRepository.getRequestResponseModifier(request, response).stream().forEach(modifier -> {
        if (modifier.getFacilitator().isMerger()) {
            merger.add(modifier);
        } else if (modifier.getFacilitator().isAdderRemover()) {
            remover.add(modifier);
        } else {
            defaultModifier.add(modifier);
        }
    });
    // execute merger
    for (RequestResponseModifier modifier : merger) {
        modifier.modifyResponse(request, response);
    }
    // execute default
    for (RequestResponseModifier modifier : defaultModifier) {
        modifier.modifyResponse(request, response);
    }
    // execute adder/remover
    for (RequestResponseModifier modifier : remover) {
        modifier.modifyResponse(request, response);
    }
}
Also used : RequestResponseModifier(org.n52.iceland.convert.RequestResponseModifier) LinkedList(java.util.LinkedList)

Example 9 with OwsServiceRequest

use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.

the class Soap12Decoder method getBodyContent.

private OwsServiceRequest getBodyContent(EnvelopeDocument doc) throws DecodingException {
    Body body = doc.getEnvelope().getBody();
    try {
        Node domNode = body.getDomNode();
        if (domNode.hasChildNodes()) {
            NodeList childNodes = domNode.getChildNodes();
            for (int i = 0; i < childNodes.getLength(); i++) {
                Node node = childNodes.item(i);
                if (node.getNodeType() == Node.ELEMENT_NODE) {
                    XmlObject content = XmlObject.Factory.parse(node);
                    // fix problem with invalid prefix in xsi:type value for
                    // om:result, e.g. OM_SWEArrayObservation or
                    // gml:ReferenceType
                    Map<?, ?> namespaces = XmlHelper.getNamespaces(doc.getEnvelope());
                    fixNamespaceForXsiType(content, namespaces);
                    XmlHelper.fixNamespaceForXsiType(content, SweConstants.QN_DATA_ARRAY_PROPERTY_TYPE_SWE_200);
                    return decodeXmlElement(content);
                }
            }
        }
        return decodeXmlElement(body);
    } catch (XmlException xmle) {
        throw new DecodingException("Error while parsing SOAP body element!", xmle);
    }
}
Also used : XmlException(org.apache.xmlbeans.XmlException) Node(org.w3c.dom.Node) NodeList(org.w3c.dom.NodeList) XmlObject(org.apache.xmlbeans.XmlObject) DecodingException(org.n52.svalbard.decode.exception.DecodingException) Body(org.w3.x2003.x05.soapEnvelope.Body)

Example 10 with OwsServiceRequest

use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.

the class SosDecoderv100 method parseGetObservation.

/**
 * parses the XmlBean representing the getObservation request and creates a
 * SoSGetObservation request
 *
 * @param getObsDoc
 *            XmlBean created from the incoming request stream
 * @return Returns SosGetObservationRequest representing the request
 *
 * @throws DecodingException
 *             * If parsing the XmlBean failed
 */
private OwsServiceRequest parseGetObservation(GetObservationDocument getObsDoc) throws DecodingException {
    GetObservationRequest getObsRequest = new GetObservationRequest();
    GetObservation getObs = getObsDoc.getGetObservation();
    getObsRequest.setService(getObs.getService());
    getObsRequest.setVersion(getObs.getVersion());
    getObsRequest.setOfferings(Arrays.asList(getObs.getOffering()));
    getObsRequest.setObservedProperties(Arrays.asList(getObs.getObservedPropertyArray()));
    getObsRequest.setProcedures(Arrays.asList(getObs.getProcedureArray()));
    getObsRequest.setTemporalFilters(parseTemporalFilters4GetObservation(getObs.getEventTimeArray()));
    getObsRequest.setSrsName(getObs.getSrsName());
    if (getObs.isSetFeatureOfInterest()) {
        FeatureOfInterest featureOfInterest = getObs.getFeatureOfInterest();
        if (featureOfInterest.isSetSpatialOps()) {
            Object filter = decodeXmlElement(featureOfInterest.getSpatialOps());
            if (filter instanceof SpatialFilter) {
                getObsRequest.setSpatialFilter((SpatialFilter) filter);
            }
        } else if (featureOfInterest.getObjectIDArray() != null) {
            Set<String> featureIdentifiers = Sets.newHashSet();
            for (String string : featureOfInterest.getObjectIDArray()) {
                featureIdentifiers.add(string);
            }
            getObsRequest.setFeatureIdentifiers(Lists.newArrayList(featureIdentifiers));
        }
    }
    // TODO implement result filtering
    if (getObs.isSetResult()) {
        throw new NotYetSupportedDecodingException("Result filtering");
    }
    // return error message
    if (getObs.isSetResponseFormat()) {
        getObsRequest.setResponseFormat(decodeResponseFormat(getObs.getResponseFormat()));
    } else {
        getObsRequest.setResponseFormat(OmConstants.CONTENT_TYPE_OM.toString());
    }
    if (getObs.isSetResultModel()) {
        getObsRequest.setResultModel(OMHelper.getObservationTypeFor(getObs.getResultModel()));
    }
    return getObsRequest;
}
Also used : GetObservation(net.opengis.sos.x10.GetObservationDocument.GetObservation) GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) Set(java.util.Set) GetFeatureOfInterest(net.opengis.sos.x10.GetFeatureOfInterestDocument.GetFeatureOfInterest) FeatureOfInterest(net.opengis.sos.x10.GetObservationDocument.GetObservation.FeatureOfInterest) SpatialFilter(org.n52.shetland.ogc.filter.SpatialFilter) XmlObject(org.apache.xmlbeans.XmlObject) OwsServiceCommunicationObject(org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject) NotYetSupportedDecodingException(org.n52.svalbard.decode.exception.NotYetSupportedDecodingException)

Aggregations

OwsServiceRequest (org.n52.shetland.ogc.ows.service.OwsServiceRequest)12 DecodingException (org.n52.svalbard.decode.exception.DecodingException)10 XmlObject (org.apache.xmlbeans.XmlObject)7 OwsServiceResponse (org.n52.shetland.ogc.ows.service.OwsServiceResponse)6 XmlException (org.apache.xmlbeans.XmlException)5 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)5 GetCapabilitiesRequest (org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest)4 OwsServiceCommunicationObject (org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject)4 IOException (java.io.IOException)3 OwsDecodingException (org.n52.iceland.coding.decode.OwsDecodingException)3 InvalidServiceParameterException (org.n52.iceland.exception.ows.concrete.InvalidServiceParameterException)3 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)3 OperationDecoderKey (org.n52.svalbard.decode.OperationDecoderKey)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 LinkedList (java.util.LinkedList)2 Set (java.util.Set)2 GetFeatureOfInterest (net.opengis.sos.x10.GetFeatureOfInterestDocument.GetFeatureOfInterest)2 GetResultTemplateType (net.opengis.sos.x20.GetResultTemplateType)2 Test (org.junit.Test)2 VersionNotSupportedException (org.n52.iceland.exception.ows.concrete.VersionNotSupportedException)2