研究了很久,利用WFSClient来调用WFS服务进行增删改查,先上段代码,其他后续补全吧。
//自定义xml的格式来实现
Map connectionParameters = Maps.newHashMap();
//connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL",)
HTTPClient httpClient =new SimpleHttpClient();
httpClient.setConnectTimeout(10);
httpClient.setTryGzip(true);
WFSConfig wfsConfig =new WFSConfig();
String url =
geoServerConfig.getUrl() +"/ows?service=wfs&version=1.0.0&request=GetCapabilities";
WFSClient wfsClient =new WFSClient(new URL(url), httpClient, wfsConfig);
TransactionRequest transactionRequest = wfsClient.createTransaction();
//transactionRequest.setOutputFormat("json");
QName typeName =new QName("http://www.xxxx.xxx", "postgis_rd");
transactionRequest.setTypeName(typeName);