Skip to main content

I want to use a httpCaller with a filter expression, i.e. use the request URL "http://geodata.nationaalgeoregister.nl/bag/wfs?service=wfs&request;=GetFeature&typeName;=bag:verblijfsobject&count;=5&filter;=<Filter><PropertyIsEqualTo><PropertyName>bag:woonplaats</PropertyName><Literal>Diemen</Literal></PropertyIsEqualTo></Filter>". This returns a status code 400 (The HTTP 400 Bad Request response status code indicates that the server could not understand the request due to invalid syntax.). If I paste the same request URL straight into a browser though, a nice result is being returned. What do I do wrong?

The url string is "http://geodata.nationaalgeoregister.nl/bag/wfs?service=wfs&request;=GetFeature&typeName;=bag:verblijfsobject&count;=5&filter;=

 

<Filter><PropertyIsEqualTo><PropertyName>bag:woonplaats</PropertyName><Literal>Diemen</Literal></PropertyIsEqualTo></Filter>"

 

 

Using FME2016.1.3.1

 


Text that you append to a URL needs to be encoded, try sending the filter text through the TextEncoder with encoding type set to "URL (percent encoding)".

In your example, the filter part would look like this:

%3CFilter%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Ebag%3Awoonplaats%3C%2FPropertyName%3E%3CLiteral%3EDiemen%3C%2FLiteral%3E%3C%2FPropertyIsEqualTo%3E%3C%2FFilter%3E

Test: Encoded URL

Regarding your browser they sometimes automatically convert back and forth between URL encoding to be user friendly, however in this instance it's more confusing than anything else.


Have you tried the regular WFS reader with an XML filter expression? I haven't been able to get that to work myself yet though...


Have you tried the regular WFS reader with an XML filter expression? I haven't been able to get that to work myself yet though...

Tried that, which works fine with this filter. But I would like to get the WFS-information/data without using a reader, so that I'm able to make a custom transformer (which for obvious reasons doesn't accept readers). Thanks anyway for the support.

 

 


@David_r: Spot on!!! Tried before to use the %3C-%3E-hocus-pocus-code but then for the whole URL; didn't knew you only have to use it for the specific filter-part. Thanks a lot!! In return you have a new follower ;-)


Tried that, which works fine with this filter. But I would like to get the WFS-information/data without using a reader, so that I'm able to make a custom transformer (which for obvious reasons doesn't accept readers). Thanks anyway for the support.

 

 

You could use a FeatureReader inside a custom transformer (hint hint)

 

 


Reply