I use WFS 1.1.0 and the output format is gml 3.1.1. Server support only WFS 
1.1.0
Same problem with and without "WFSDataStoreFactory:OUTPUTFORMAT" line
In my code "prefilter" and "prefilter2" works well to get one object. Then I 
suppose query part is ok.


   String getCapabilities = 
"http://localhost:8100/ElyxRouter/rest/wfs/WFS?request=GetCapabilities&version=1.1.0&service=wfs";;
 // Step 1 - connection parameters
    Map connectionParameters = new HashMap();
    connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", 
getCapabilities );
    connectionParameters.put("WFSDataStoreFactory:OUTPUTFORMAT","text/xml; 
subtype=gml/3.1.1");
    // Step 2 - connection
    DataStore data = DataStoreFinder.getDataStore( connectionParameters );
    // Step 3 - discovery
    String typeName = "starapic:PTADR_ELECTIONS";
    SimpleFeatureType schema = data.getSchema( typeName );
    System.out.println( "Schema Attributes:"+schema.getAttributeCount() );

    // Step 4 - target
    SimpleFeatureSource source = data.getFeatureSource( typeName );
    System.out.println( "Metadata Bounds:"+ source.getBounds() );

    // Step 5 - query
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2( 
GeoTools.getDefaultHints() );
    Filter prefilter = ff.equals( ff.property( "coderue"), ff.literal( "8219" ) 
);
    Filter prefilter2 = ff.equals(ff.property("numpolice"),ff.literal(10));

    //update part
    Transaction transaction = new DefaultTransaction("update");
    try {
        SimpleFeatureStore featureStore = (SimpleFeatureStore) 
data.getFeatureSource( typeName );
        featureStore.setTransaction( transaction );
        featureStore.modifyFeatures("nbrehabvotant",100,ff.and(prefilter, 
prefilter2));
        transaction.commit();
    }catch (Exception e){
        e.printStackTrace();
        transaction.rollback();
    }

    finally {
        transaction.close();
    }
}

Michaël



De : Ian Turton <ijtur...@gmail.com>
Envoyé : vendredi 1 septembre 2017 17:35
À : Fraipont Michael
Cc : geotools-gt2-users@lists.sourceforge.net
Objet : Re: [Geotools-gt2-users] WFS between geotools and 1spatial Elyx


can you share the code you use to create the transaction? are you specifying an 
output format? and are you using wfs version 1.x or 2.x ?


From a quick look at the code it looks like the outputformats should be pulled 
out of the capabilities response.


Ian


On 1 September 2017 at 09:12, Fraipont Michael  <michael.fraip...@liege.be> 
wrote:
 Hi list,

I'm new with Geotools and I try to connect my java application  with geotools 
17.2 (gt-wfs-ng part) and a 1spatial Elyx 2.9.4 WFS 1.1.0 server. In read only, 
WFS works well. However if I try to send a WFS-T transaction, I have this 
stackstrace :

java.lang.IllegalArgumentException: Client does not support any of the server 
supported output formats for TRANSACTION
    at 
org.geotools.data.wfs.internal.AbstractWFSStrategy.getDefaultOutputFormat(AbstractWFSStrategy.java:386)
    at org.geotools.data.wfs.internal.WFSRequest.<init>(WFSRequest.java:75)
    at 
org.geotools.data.wfs.internal.TransactionRequest.<init>(TransactionRequest.java:49)
    at 
org.geotools.data.wfs.internal.WFSClient.createTransaction(WFSClient.java:323)
    at 
org.geotools.data.wfs.WFSRemoteTransactionState.commitInternal(WFSRemoteTransactionState.java:118)
    at 
org.geotools.data.wfs.WFSRemoteTransactionState.commit(WFSRemoteTransactionState.java:95)
    at org.geotools.data.DefaultTransaction.commit(DefaultTransaction.java:186)

I think the problem is a bad WFS xml schema in this specific part :
<Operation name="Transaction">
<DCP>
<HTTP>
<Get p9:type="simple" 
p9:href="http://PORTAILCARTO-29:8100/ElyxRouter/rest/wfs/wfs"/>
<Post p9:type="simple" 
p9:href="http://PORTAILCARTO-29:8100/ElyxRouter/rest/wfs/wfs"/>
</HTTP>
</DCP>
<Parameter name="idgen"><Value>GenerateNew</Value></Parameter>
<Parameter name="outputFormat"><Value>text/xml; 
subtype=gml/3.1.1</Value></Parameter>
</Operation>

The schema show a parameter name "outputFormat" and the library search 
"inputFormat" in the 
org.geotools.data.wfs.internal.v1_x.StrictWFS_1_x_Strategy.getServerSupportedOutputFormats(WFSOperationType
 operation)

With a debugger I just force the "outputFormat" in parameterName in line 597 
and it's works well. Then I think a good workaround is a new WFS 
vendor-specific strategy who just change this specific line. But I don't 
understand if I can declare a new strategy  because in 
org.geotools.data.wfs.internal.WFSClient.determineCorrectStrategy() the list 
seems hardcoded.

What can I do to use a custom strategy ?

Michael
La Ville de Liège décline toute responsabilité pour les dommages directs ou 
indirects résultant de la consultation ou de l'utilisation du contenu du 
présent courriel selon les termes du disclaimer repris sur le site de la Ville 
:  http://www.liege.be/documents/disclaimer ​​Le destinataire est averti que le 
contenu de celui-ci peut ne représenter que l'avis de son expéditeur et non 
celui de la Ville de Liège.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org!  http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users




 --

Ian Turton

La Ville de Liège décline toute responsabilité pour les dommages directs ou 
indirects résultant de la consultation ou de l'utilisation du contenu du 
présent courriel selon les termes du disclaimer repris sur le site de la Ville 
: http://www.liege.be/documents/disclaimer ​​Le destinataire est averti que le 
contenu de celui-ci peut ne représenter que l'avis de son expéditeur et non 
celui de la Ville de Liège.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to