[gdal-dev] HTTP 401 error with WMS

Elena Ruiz eruiz at aplitop.com
Thu Apr 8 01:51:26 PDT 2021


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:

[cid:image002.jpg at 01D72C65.1B877460]

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
________________________________

[https://www.aplitop.com/descargas/firma1.jpg]


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

[cid:SocialLink_Facebook_32x32_a745adb8-c250-4372-8480-e77f503dad3d.png]<https://www.facebook.com/AplitopSL/>   [cid:SocialLink_Twitter_32x32_858247f6-9d4a-4740-a6b3-9b5ebfd98a97.png] <https://twitter.com/aplitop>    [cid:SocialLink_Linkedin_32x32_154d63de-bf68-468f-9eb0-ffed102fac77.png] <https://www.linkedin.com/company/aplitop>    [cid:SocialLink_Youtube_32x32_0dea15dd-3774-4086-be9d-f62560b70c86.png] <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>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/fdb4ac1b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 21862 bytes
Desc: image002.jpg
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/fdb4ac1b/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: SocialLink_Facebook_32x32_a745adb8-c250-4372-8480-e77f503dad3d.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/fdb4ac1b/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: SocialLink_Twitter_32x32_858247f6-9d4a-4740-a6b3-9b5ebfd98a97.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/fdb4ac1b/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: SocialLink_Linkedin_32x32_154d63de-bf68-468f-9eb0-ffed102fac77.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/fdb4ac1b/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: SocialLink_Youtube_32x32_0dea15dd-3774-4086-be9d-f62560b70c86.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210408/fdb4ac1b/attachment-0007.png>


More information about the gdal-dev mailing list