Interrogation d'un service IGN WPS via TFPHTTPClient
Bjr à vous,
Je cherche à récupérer des altitudes via le service https://wxs.ign.fr/essentiels/alti/w...&version=1.0.0 en utilisant TFPHTTPClient
(tutoriaux: https://geoservices.ign.fr/documenta...imetrique-rest)
En GET vers https://wxs.ign.fr/essentiels/alti/r...00&zonly=false, çà marche
En POST vers https://wxs.ign.fr/essentiels/alti/w...&version=1.0.0, je mets ceci dans mon TFPHTTPClient
Dans mon instance de TFPHTTPClient, je vide son RequestHeaders et j'y mets les lignes suivantes:
Code:
1 2 3 4
| FHttpClient.RequestHeaders.Clear;
FHttpClient.RequestHeaders.Add('User-Agent: Mozilla/5.0 (compatible; fpweb)');
FHttpClient.RequestHeaders.Add('Content-Type:text/xml; charset=UTF-8');
FHttpClient.RequestHeaders.add('Accept:text/xml'); |
et dans la requête POST, envoyée par Procedure TFPHTTPClient.FormPost(const URL : string; FormData: TStrings; const Response: TStrings), j'y mets les paramètres suivants:
URL = https://wxs.ign.fr/essentiels/alti/w...&version=1.0.0
FormData, un TStringList composé par mon appli
Response, un TStringList initialisé et vidé
Les lignes de mon FormData:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| <?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:"http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs"
xmlns:wps="http://www.opengis.net/wps/1.0.0"
xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>gs:WPSLineElevation</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>lon</ows:Identifier>
<wps:Data>
<wps:LiteralData>
-0.02500000|-0.02200000|-0.01900000|-0.01600000|-0.01300000|-0.01000000|-0.00700000|-0.00400000
</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>lat</ows:Identifier>
<wps:Data>
<wps:LiteralData>
43.08600000|43.08800000|43.09000000|43.09200000|43.09400000|43.09600000|43.09800000|43.10000000
</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>sampling</ows:Identifier>
<wps:Data>
<wps:LiteralData>8</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>format</ows:Identifier>
<wps:Data>
<wps:LiteralData>json</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:RawDataOutput>
<ows.Identifier>result</ows.Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute> |
Le serveur IGN me retourne un code 200 OK, et la réponse XML suivante dans Response
Code:
1 2 3 4 5 6 7 8
| <?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.1.0"
xsi:schemaLocation="http://www.opengis.net/ows/1.1 https://wxs.ign.fr/alti/schemas/ows/1.1.0/owsAll.xsd"
xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ows:Exception exceptionCode="MissingParameterValue" locator="request">
<ows:ExceptionText>Could not determine geoserver request from http request org.geoserver.platform.AdvancedDispatchFilter$AdvancedDispatchHttpRequest@c679618</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport> |
Des pistes ?
J'utilise pourtant l'URL mentionnée dans le tuto IGN
Citation:
Envoyé par
BeanzMaster
Hello d'après le message d'erreur il te manque un paramètre dans l'url de la requete soit dans le formData
J'utilise pourtant l'URL https://wxs.ign.fr/CLEF/alti/wps?ser...&version=1.0.0 mentionnée dans le tutorial officiel https://geoservices.ign.fr/documenta...ique-rest#1894
Ceci dit, le tuto est peut-être caduc. Le nombre de tutos périmés ou qui ne fonctionnent pas (exemples boiteux notamment) est hallucinant, y compris sur les sites officiels.
Ca marche mais 'Violation d'accès' sous Linux Mint au droit du Post()
Ca marche mais 'Violation d'accès' sous Linux Mint au droit du Post()
Code:
1 2 3 4 5 6 7
| try
MyHTTPRequest.Post(MyURL, Response); // OK sous Windows, VA sur Linux
ShowMessage(Response.Text);
finally
FreeAndNil(MyHTTPRequest);
FreeAndNil(Response);
end; |
TFPHTTPClient avec interrogation d'un service WXS: Ne fonctionne pas sous Linux
Bjr à tous,
Après reprise de mon extracteur d'altitude via un service IGN wxs, je constate que TFPHTTPClient fonctionne très bien avec une URL ordinaire. Par contre, dès que j'interroge le service wxs via les méthodes TFPHTTPClient.Get() ou TFPHTTPClient.Post(), le résultat de get() est une chaîne vide, alors que la même URL dans un navigateur me retourne du XML.
Sous Windows: OK , sous Linux: KO