Geoportal Helpdesk - Support #2722 EEA: HTTP Status codes returned by the INSPIRE Validator 18 Mar 2016 09:21 am - Quaglia Status: Assigned Start date: 18 Mar 2016 Priority: Normal Due date: Assignee: Quaglia % Done: 0% Category: Geoportal Services Estimated time: 0.00 hour Target version: Submitting Organisation: EEA Proactive: Description Country: Originating UI: From: Prunayre [mailto:fx.prunayre@gmail.com] Sent: 18 March 2016 07:25 To: Quaglia <angelo.quaglia@ext.jrc.ec.europa.eu> Cc: Paul Hasenohr <paul.hasenohr@eea.europa.eu> Subject: INSPIRE validator question Dear, In some cases (not sure when) the validator return HTTP status 301 this case is not cover in the example. http://inspire-geoportal.ec.europa.eu/validator2/html/usingaswebservice.html java client. Do you think it would be better to follow redirects by default and in that case handle response when status is 200? When doing this, I then sometimes get 403. Any suggestions? Thanks for your help. Regards. History #1-18 Mar 2016 09:22 am - Quaglia Sent: 18 March 2016 09:08 Cc: 'Paul Hasenohr' 30 Jan 2019 1/8
Dear, It depends on whether you send a multipart form data or plain text. The first is designed to be invoked by browsers the second by services. Which binding are you using? If you use this binding you are not supposed to ever receive back a 301 (moved permanently): @POST @Consumes(MediaType.TEXT_PLAIN) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) /system/rich/rich_files/rich_files/000/000/513/original/mail158.png if (created) { ObjectFactory objfactory = new ObjectFactory(); return Response.created(redirectURI).entity(objFactory.createResource(retVal)).build(); } else { log.error("could not create an INSPIRE Resource"); return Response.status(Status.BAD_REQUEST).build(); } } catch (InvalidResourceException ioe) { log.error(ioe.getmessage()); return Response.status(Status.BAD_REQUEST).build(); } catch (Exception ex) { 30 Jan 2019 2/8
log.error(ex.getmessage()); return Response.serverError().build(); If you use the following binding instead yes, since it is the way to ask the user s browser to redirect to the final and permanent location of the validation report: @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) /system/rich/rich_files/rich_files/000/000/514/original/mail159.png If your findings prove otherwise and you can send me a test case that would help me a lot. Many thanks and best regards, #2-21 Mar 2016 11:53 am - Quaglia Sent: 21 March 2016 11:09 Cc: 'Paul Hasenohr' 30 Jan 2019 3/8
Dear, Did you receive my reply? Best regards, #3-21 Mar 2016 11:53 am - Quaglia From: Prunayre [mailto:fx.prunayre@gmail.com] Sent: 21 March 2016 11:14 To: Quaglia <angelo.quaglia@ext.jrc.ec.europa.eu> Subject: Re: INSPIRE validator question Dear, Sure I did and tried quite some options last week. Using the client demo code provided I still sometimes get code 301 but unfortunately can't manage to make a working test to reproduce the issue 100% of the time. So I ended up with another option, where: * the dashboard harvest the CSW, run validation for all records * and if validation fails with 301, a background task take care of updating the validation status. So far, since friday, it looks to be working fine. I'll have to investigate further to exactly know why the request is not handled as synchronous. Thanks for your response. #4-21 Mar 2016 11:54 am - Quaglia Sent: 21 March 2016 11:37 30 Jan 2019 4/8
Dear, I am sorry for that but which binding are you using of the two? #5-21 Mar 2016 11:54 am - Quaglia From: Prunayre [mailto:fx.prunayre@gmail.com] Sent: 21 March 2016 11:40 To: Quaglia <angelo.quaglia@ext.jrc.ec.europa.eu> Subject: Re: INSPIRE validator question I tried different options but maybe you'll easily point out what is wrong. See here https://github.com/inspire-mif/daobs/blob/daobs-1.0.x/tasks/validation-checker/src/main/java/org/daobs/tasks/validation/inspire/onlineservicevalid torclient.java#l120 Thanks. #6-21 Mar 2016 11:56 am - Quaglia Sent: 21 March 2016 11:52 From what I see, you are sending a MultipartEntity In this case, after a timeout of a few seconds, the request becomes asynchronous and the client receives a 301 that redirects it to final location of the summary report. 30 Jan 2019 5/8
This is the same binding the browser uses when the validator is opened from the website. The reason why the execution cannot stay synchronous for too long is that users behind corporate firewall complained they could not see the completion of the test. /system/rich/rich_files/rich_files/000/000/519/original/mail163.png If you send text_plain you are not supposed to be redirected and the process stays synchronous: /system/rich/rich_files/rich_files/000/000/518/original/mail164.png #7-21 Mar 2016 12:22 pm - Quaglia From: Prunayre [mailto:fx.prunayre@gmail.com] Sent: 21 March 2016 11:57 To: Quaglia <angelo.quaglia@ext.jrc.ec.europa.eu> Subject: Re: INSPIRE validator question ok so the Java client example needs to be updated? http://inspire-geoportal.ec.europa.eu/validator2/html/usingaswebservice.html Thanks. #8-21 Mar 2016 12:23 pm - Quaglia 30 Jan 2019 6/8
Sent: 21 March 2016 12:22 Actually, you are right, thanks! I will do that. The Groovy client uses instead the text/plain binding. #9-21 Mar 2016 12:47 pm - Quaglia Sent: 21 March 2016 12:47 In addition, the 301 is not a good response in any case. It has to be 303 See Other. #10-21 Mar 2016 01:04 pm - Quaglia Sent: 21 March 2016 13:04 Dear, I have read again your initial question. I am sorry I missed the point. The reason you sometimes get 403 after the redirection is that sometimes the redirection is requested too early and the target folder is still empty. 30 Jan 2019 7/8
It happens sometimes and I have not been able to work on the issue yet. However, the redirection URL is good and after a while the 403 goes away. The browser shows a temporary page until in the xml the following element makes its appearance which means the summary validation report has been updated for closure: /GeoportalResource/PullBatchReportResource/AuditRecord/LastUpdateDate You avoid all these complications using the other binding. #11-21 Mar 2016 01:10 pm - Quaglia From: Prunayre [mailto:fx.prunayre@gmail.com] Sent: 21 March 2016 13:08 To: Quaglia Subject: Re: INSPIRE validator question Yes using the synchonous mode would be better for the dashboard. Also could you confirm that using probenetworkservices in URL parameters like this is still correct? http://inspire-geoportal.ec.europa.eu/geoportalproxywebservices/resources/inspireresourcetester?probenetworkservices=false&probedatareso rcelocators=false Thanks. #12-21 Mar 2016 01:11 pm - Quaglia That has not changed and should still work as before. #13-30 Aug 2016 07:21 pm - Quaglia - Category set to Geoportal Services 30 Jan 2019 8/8