[gdal-dev] HTTP 401 error with WMS

Daniele Romagnoli daniele.romagnoli at geo-solutions.it
Thu Apr 8 03:23:49 PDT 2021


Hello Elena,
the error messages report "Unauthorized".
I would try by modifying the ServerlUrl, removing the user and password
empty parameters, so that it just contains the base WMS url:

<ServerUrl>https://wms.mapa.gob.es/sigpac/ows?SERVICE=WMS</ServerUrl>

and also removing the <UserPwd>:</UserPwd> tag at the bottom of your xml.

Let us know if that works.

Regards,
Daniele








On Thu, Apr 8, 2021 at 10:51 AM Elena Ruiz <eruiz at aplitop.com> wrote:

> Hello, I trying a WMS web service with gdal, but I have different results
> depend on I use a url in a web browser or I use the gdal commands.
>
> If I put this url in Crome:
>
>
> https://wms.mapa.gob.es/sigpac/ows?FORMAT=image/jpeg&HEIGHT=99&LAYERS=EEPP&WIDTH=183&SERVICE=WMS&BBOX=413276.0389803443,4066482.0439935336,675346.7028941214,4208125.2305295570&REQUEST=GetMap&TRANSPARENT=FALSE&STYLES=&VERSION=1.3.0&CRS=EPSG:25830
>
>
>
> I get an image:
>
>
>
>
>
> But If I use the same parameters in a XML file, like as this:
>
>
>
> <GDAL_WMS>
>
>   <Service name="WMS">
>
>     <Version>1.3.0</Version>
>
>     <ServerUrl>
> https://wms.mapa.gob.es/sigpac/ows?SERVICE=WMS&username=&password=
> </ServerUrl>
>
>     <Layers>EEPP</Layers>
>
>     <CRS>EPSG:25830</CRS>
>
>     <ImageFormat>image/jpeg</ImageFormat>
>
>     <Transparent>FALSE</Transparent>
>
>     <BBoxOrder>xyXY</BBoxOrder>
>
>   </Service>
>
>   <DataWindow>
>
>     <UpperLeftX>413276.0389803443</UpperLeftX>
>
>     <UpperLeftY>4208125.2305295570</UpperLeftY>
>
>     <LowerRightX>675346.7028941214</LowerRightX>
>
>     <LowerRightY>4066482.0439935336</LowerRightY>
>
>     <SizeX>183</SizeX>
>
>     <SizeY>99</SizeY>
>
>   </DataWindow>
>
>   <Timeout>1600</Timeout>
>
>   <BandsCount>3</BandsCount>
>
>   <BlockSizeX>1024</BlockSizeX>
>
>   <BlockSizeY>1024</BlockSizeY>
>
>   <OverviewCount>20</OverviewCount>
>
>   <UserPwd>:</UserPwd>
>
>   <UnsafeSSL>true</UnsafeSSL>
>
>   <ZeroBlockHttpCodes></ZeroBlockHttpCodes>
>
> </GDAL_WMS>
>
>
>
>
>
> And then I run the next gdal command: gdal_translate -of JPEG -outsize 183
> 99 C:\Users\elena\AppData\Local\Temp\tmpnuevo.xml
> C:\Users\elena\AppData\Local\Temp\miimagen.jpeg
>
> The result is :
>
>
>
> Input file size is 183, 99
>
> 0ERROR 1: GDALWMS: Unable to download block 0, 0.
>
> URL: <!doctype html><html lang="es"><head><title>Estado HTTP 401 ÔÇô No
> autorizado</title><style type="text/css">body
> {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b
> {color:white;background-color:#525D76;} h1 {font-size:22px;} h2
> {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;}
> .line
> {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>Estado
> HTTP 401 ÔÇô No autorizado</h1><hr class="line" /><p><b>Tipo</b> Informe de
> estado</p><p><b>mensaje</b> Unauthorized</p><p><b>Descripci├│n</b> Este
> requerimiento requiere autenticaci├│n HTTP.</p><hr class="line"
> /><h3>Apache Tomcat/9.0.37</h3></body></html>
>
>   HTTP status code: 401, error: <!doctype html><html
> lang="es"><head><title>Estado HTTP 401 ÔÇô No autorizado</title><style
> type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b
> {color:white;background-color:#525D76;} h1 {font-size:22px;} h2
> {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;}
> .line
> {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>Estado
> HTTP 401 ÔÇô No autorizado</h1><hr class="line" /><p><b>Tipo</b> Informe de
> estado</p><p><b>mensaje</b> Unauthorized</p><p><b>Descripci├│n</b> Este
> requerimiento requiere autenticaci├│n HTTP.</p><hr class="line"
> /><h3>Apache Tomcat/9.0.37</h3></body></html>.
>
> Add the HTTP status code to <ZeroBlockHttpCodes> to ignore this error (see
> http://www.gdal.org/frmt_wms.html).
>
> ERROR 1: C:\Users\elena\AppData\Local\Temp\tmpnuevo.xml, band 1:
> IReadBlock failed at X offset 0, Y offset 0: GDALWMS: Unable to download
> block 0, 0.
>
> URL: <!doctype html><html lang="es"><head><title>Estado HTTP 401 ÔÇô No
> autorizado</title><style type="text/css">body
> {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b
> {color:white;background-color:#525D76;} h1 {font-size:22px;} h2
> {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;}
> .line
> {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>Estado
> HTTP 401 ÔÇô No autorizado</h1><hr class="line" /><p><b>Tipo</b> Informe de
> estado</p><p><b>mensaje</b> Unauthorized</p><p><b>Descripci├│n</b> Este
> requerimiento requiere autenticaci├│n HTTP.</p><hr class="line"
> /><h3>Apache Tomcat/9.0.37</h3></body></html>
>
>   HTTP status code: 401, error: <!doctype html><html
> lang="es"><head><title>Estado HTTP 401 ÔÇô No autorizado</title><style
> type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b
> {color:white;background-color:#525D76;} h1 {font-size:22px;} h2
> {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;}
> .line
> {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>Estado
> HTTP 401 ÔÇô No autorizado</h1><hr class="line" /><p><b>Tipo</b> Informe de
> estado</p><p><b>mensaje</b> Unauthorized</p><p><b>Descripci├│n</b> Este
> requerimiento requiere autenticaci├│n HTTP.</p><hr class="line"
> /><h3>Apache Tomcat/9.0.37</h3></body></html>.
>
> Add the HTTP status code to <ZeroBlockHttpCodes> to ignore this error (see
> http://www.gdal.org/frmt_wms.html).
>
>
>
> And there are not any image.
>
> I´m using gdal 3.0, and I don´t understand why works at web browser and
> don´t works with gdal, I am doing something wrong? Thank you very much and
> regards
> ------------------------------
>
> *Elena Ruiz *
> Sofware Development & Technical Support
> Tel. +34 952 43 97 71
> eruiz at aplitop.com
> Sumatra, 9 - 29190 Málaga (Spain)
>
>
> *www.aplitop.com <http://www.aplitop.com>
> <https://www.facebook.com/AplitopSL/>   <https://twitter.com/aplitop>
> <https://www.linkedin.com/company/aplitop>
> <https://www.youtube.com/user/aplitop>*
>
> In accordance with the provisions of the European Regulation of Data
> Protection 2016/679 (Reglamento Europeo de Protección de Datos 2016/679),
> we inform you that the data and the information you provide us through this
> medium will be used by APLITOP, S.L., with C.I.F. B-92543396 and with
> address at C / Sumatra, 9, Malaga, 29190, in order to answer your questions
> and inform you about our products. The data provided will be kept as long
> as it does not request its cessation and will not be transferred to third
> parties except in cases where there is a legal obligation. You have the
> right to access your personal data, correct inaccurate data or request its
> deletion when the data is no longer necessary for the purposes that were
> collected, as well as any rights recognized in the RGPD 2016/679
>
> <https://www.aplitop.com/Event/en/358/intergeo-2019>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>


-- 
Regards,
Daniele Romagnoli
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/76f1766e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 21862 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/76f1766e/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SocialLink_Facebook_32x32_a745adb8-c250-4372-8480-e77f503dad3d.png
Type: image/png
Size: 365 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/76f1766e/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SocialLink_Twitter_32x32_858247f6-9d4a-4740-a6b3-9b5ebfd98a97.png
Type: image/png
Size: 619 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/76f1766e/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SocialLink_Linkedin_32x32_154d63de-bf68-468f-9eb0-ffed102fac77.png
Type: image/png
Size: 468 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/76f1766e/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SocialLink_Youtube_32x32_0dea15dd-3774-4086-be9d-f62560b70c86.png
Type: image/png
Size: 817 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/76f1766e/attachment-0007.png>


More information about the gdal-dev mailing list