/** * @deprecated use instead {@link #SOSObservationStore(OperationResult)} and {@link #unmarshalFeatures()} */ @Deprecated protected OXFFeatureCollection unmarshalFeatures100(OperationResult operationResult) throws OXFException { try { this.xmlObject = XMLBeansParser.parse(operationResult.getIncomingResultAsAutoCloseStream()); return unmarshalFeatures(operationResult); } catch (XMLHandlingException e) { throw new OXFException("Could not parse OperationResult.", e); } }
protected OperationResultStore(OperationResult operationResult) throws OXFException { try { this.xmlObject = XMLBeansParser.parse(operationResult.getIncomingResultAsAutoCloseStream(), false); this.version = getVersion(operationResult); } catch (XMLHandlingException e) { throw new OXFException("Could not parse OperationResult.", e); } }
/** * @deprecated Use {@link SOSSensorStore#SOSSensorStore(OperationResult)} with {@link SOSSensorStore#unmarshalFeatures(OperationResult)} */ public OXFFeatureCollection unmarshalFeatures(OperationResult operationResult) throws OXFException { try { this.xmlObject = XMLBeansParser.parse(operationResult.getIncomingResultAsAutoCloseStream()); this.version = getVersion(operationResult); } catch (XMLHandlingException e) { throw new OXFException("Could not parse OperationResult", e); } return unmarshalFeatures(); }
private boolean requestCapabilities() { SESAdapter adapter = new SESAdapter("0.0.0"); Operation op = new Operation(SESAdapter.GET_CAPABILITIES, null, host.toExternalForm()); ParameterContainer parameter = new ParameterContainer(); try { parameter.addParameterShell(ISESRequestBuilder.GET_CAPABILITIES_SES_URL, host.toExternalForm()); OperationResult opResult = adapter.doOperation(op, parameter); if (opResult == null) return false; XmlObject response = XmlObject.Factory.parse(opResult.getIncomingResultAsAutoCloseStream()); if (response instanceof EnvelopeDocument) { if (((EnvelopeDocument) response).getEnvelope().getBody().xmlText().contains("Capabilities")) { return true; } } } catch (OXFException e) { logger.warn(e.getMessage()); } catch (XmlException e) { logger.warn(e.getMessage()); } catch (IOException e) { logger.warn(e.getMessage()); } catch (ExceptionReport e) { logger.warn(e.getMessage()); } return false; } }).start();
@Deprecated @Override public OXFFeatureCollection unmarshalFeatures(OperationResult opsRes) throws OXFException { // 1. try to parse the feature data as a FeatureCollection: try { FeatureCollectionDocument2 xb_featureCollDoc = FeatureCollectionDocument2.Factory.parse(opsRes.getIncomingResultAsAutoCloseStream()); AbstractFeatureCollectionType xb_collection = xb_featureCollDoc.getFeatureCollection(); return unmarshalAbstractCollectionType(xb_collection); } // 2. try to parse the feature data as one single SamplingPoint: catch (org.apache.xmlbeans.XmlException xmlException) { try { SamplingPointDocument xb_samplingPointDoc = SamplingPointDocument.Factory.parse(opsRes.getIncomingResultAsAutoCloseStream()); OXFFeature feature = OXFSamplingPointType.create(xb_samplingPointDoc); OXFFeatureCollection coll = new OXFFeatureCollection("any_ID", null); coll.add(feature); return coll; } catch (IOException | XmlException e) { throw new OXFException(e); } } catch (IOException ioException) { throw new OXFException(ioException); } }
public ServiceDescriptor initService(final OperationResult getCapabilitiesResult) throws ExceptionReport, OXFException { try { if (SosUtil.isVersion100(serviceVersion)) { final net.opengis.sos.x10.CapabilitiesDocument capsDoc = net.opengis.sos.x10.CapabilitiesDocument.Factory.parse(getCapabilitiesResult.getIncomingResultAsAutoCloseStream()); return initService(capsDoc); } else if (SosUtil.isVersion200(serviceVersion)) { final net.opengis.sos.x20.CapabilitiesDocument capsDoc = net.opengis.sos.x20.CapabilitiesDocument.Factory.parse(getCapabilitiesResult.getIncomingResultAsAutoCloseStream()); return initService(capsDoc); } else { throw new OXFException("Version is not supported: " + serviceVersion); } } catch (final XmlException e) { throw new OXFException(e); } catch (final IOException e) { throw new OXFException(e); } }
@Override public ServiceDescriptor initService(String serviceURL) throws ExceptionReport, OXFException { ParameterContainer parameters = new ParameterContainer(); parameters.addParameterShell(ISESRequestBuilder.GET_CAPABILITIES_SES_URL, serviceURL); OperationResult opResult = doOperation(new Operation(SESAdapter.GET_CAPABILITIES, serviceURL, serviceURL), parameters); try { // free OWS Response from SOAP-Envelope EnvelopeDocument envDoc = EnvelopeDocument.Factory.parse(opResult.getIncomingResultAsAutoCloseStream()); String owsResponse = envDoc.getEnvelope().getBody().xmlText(); CapabilitiesDocument capsDoc = CapabilitiesDocument.Factory.parse(owsResponse); return handleCapabilities(capsDoc); } catch (XmlException | IOException e) { throw new OXFException(e); } }
private ExceptionReport parseOws110ExceptionReport(final OperationResult result) throws IOException, XmlException { final ExceptionReportDocument xb_execRepDoc = ExceptionReportDocument.Factory.parse(result.getIncomingResultAsAutoCloseStream()); final net.opengis.ows.x11.ExceptionType[] xb_exceptions = xb_execRepDoc.getExceptionReport().getExceptionArray(); final String language = xb_execRepDoc.getExceptionReport().getLang(); final String version = xb_execRepDoc.getExceptionReport().getVersion(); final ExceptionReport oxf_execReport = new ExceptionReport(version, language); for (final ExceptionType xb_exec : xb_exceptions) { final String execCode = xb_exec.getExceptionCode(); final String[] execMsgs = xb_exec.getExceptionTextArray(); final String locator = xb_exec.getLocator(); final OWSException owsExec = new OWSException(execMsgs, execCode, result.getSendedRequest(), locator); oxf_execReport.addException(owsExec); } return oxf_execReport; }
final XmlObject result_xb = XmlObject.Factory.parse(result.getIncomingResultAsAutoCloseStream()); if (result_xb.schemaType() == ExceptionReportDocument.type) { throw parseOws110ExceptionReport(result);