public GetRecordsResponse getRecords( GetRecords getRecords ) throws IOException, XMLProcessingException, OWSExceptionReport, XMLStreamException { URL endPoint = getXMLPostUrl(); StreamBufferStore request = new StreamBufferStore(); try { XMLStreamWriter xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( request ); GetRecordsXMLEncoder.export( getRecords, xmlWriter ); xmlWriter.close(); request.close(); } catch ( Throwable t ) { throw new RuntimeException( "Error creating XML request: " + getRecords, t ); } OwsHttpResponse response = httpClient.doPost( endPoint, "text/xml", request, null ); return new GetRecordsResponse( response ); }
public TransactionResponse insert( List<OMElement> records ) throws IOException, XMLProcessingException, OWSExceptionReport, XMLStreamException { ckeckOperationSupported( Transaction.name() ); URL endPoint = getPostUrl( Transaction.name() ); StreamBufferStore request = new StreamBufferStore(); try { XMLStreamWriter xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( request ); TransactionXMLEncoder.exportInsert( records, xmlWriter ); xmlWriter.close(); request.close(); } catch ( Throwable t ) { throw new RuntimeException( "Error insering " + records.size() + " records", t ); } OwsHttpResponse response = httpClient.doPost( endPoint, "text/xml", request, null ); return new TransactionResponse( response ); }
/** * Performs the given {@link GetFeature} request. * * @return WFS response, never <code>null</code> * @throws OWSExceptionReport * if the server responded with a service exception report * @throws XMLStreamException * @throws IOException */ public GetFeatureResponse<Feature> doGetFeature( GetFeature request ) throws OWSExceptionReport, XMLStreamException, IOException { URL endPoint = getPostUrl( GetFeature.name() ); StreamBufferStore requestSink = new StreamBufferStore(); try { XMLStreamWriter xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( requestSink ); // TODO handle other WFS versions GetFeature110XMLEncoder.export( request, null, xmlWriter ); xmlWriter.close(); requestSink.close(); } catch ( Throwable t ) { throw new RuntimeException( "Error creating XML request: " + request ); } OwsHttpResponse response = httpClient.doPost( endPoint, "text/xml", requestSink, null ); GMLVersion gmlVersion = getAppSchema().getGMLSchema().getVersion(); return new GetFeatureResponse<Feature>( response, getAppSchema(), gmlVersion ); }