#20072 closed defect (fixed)
Could not parse WMS layer list - Premature end of file
| Reported by: | Owned by: | team | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Core imagery | Version: | |
| Keywords: | imagery wms | Cc: |
Description
What steps will reproduce the problem?
- Imagery > Imagery preferences > WMS+
- Paste https://mapy.geoportal.gov.pl/wss/service/img/guest/HYDRO/MapServer/WMSServer?&REQUEST=GetCapabilities into GetCapabilities field
- Got error message "Could not parse WMS layer list. javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Premature end of file"
What is the expected result?
Correctly add and use Geoportal.gov.pl WMS service (hydrographic map of Poland) and choose layers.
What happens instead?
I always got an error.
Please provide any additional information below. Attach a screenshot if possible.
Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2020-10-03 13:42:38 +0200 (Sat, 03 Oct 2020)
Revision:17084
Build-Date:2020-10-04 01:30:47
URL:https://josm.openstreetmap.de/svn/trunk
Identification: JOSM/1.5 (17084 en) Linux Ubuntu 20.04.1 LTS
Memory Usage: 334 MB / 1968 MB (226 MB allocated, but free)
Java version: 11.0.8+10-post-Ubuntu-0ubuntu118.04.1, Ubuntu, OpenJDK 64-Bit Server VM
Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel
Screen: :0.0 1920x1080 (scaling 1.0x1.0)
Maximum Screen Size: 1920x1080
Best cursor sizes: 16x16 -> 16x16, 32x32 -> 32x32
Desktop environment: KDE
VM arguments: [-Duser.home=${HOME}]
Plugins:
+ FastDraw (35640)
+ apache-commons (35524)
+ editgpx (35562)
+ ejml (35458)
+ geotools (35458)
+ jaxb (35543)
+ jts (35458)
+ merge-overlap (35640)
+ routes (35543)
+ utilsplugin2 (35640)
Last errors/warnings:
- 00098.569 E: java.net.MalformedURLException: no protocol:
- 00291.696 E: Could not parse WMS layer list. Incoming data:
Attachments (1)
Change History (9)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Thank you for reply. You're right. But https://mapy.geoportal.gov.pl/wss/service/img/guest/HYDRO/MapServer/WMSServer?SERVICE=WMS&REQUEST=GetCapabilities shows full and expected output when pasted into web browser. JSOM shows error message instead.
comment:3 by , 5 years ago
JOSM receives an empty file, no idea why. This is what I see in the log:
2020-11-13 11:27:18.715 FINE: Trying WMS GetCapabilities with url https://mapy.geoportal.gov.pl/wss/service/img/guest/HYDRO/MapServer/WMSServer?SERVICE=WMS&REQUEST=GetCapabilities
2020-11-13 11:27:18.716 FINE: Contacting Server...
2020-11-13 11:27:18.716 FINE: REQUEST HEADERS: {Accept=null, Accept-Encoding=gzip, deflate}
2020-11-13 11:27:18.963 INFO: GET https://mapy.geoportal.gov.pl/wss/service/img/guest/HYDRO/MapServer/WMSServer?SERVICE=WMS&REQUEST=GetCapabilities -> HTTP/1.0 200 (247 ms)
2020-11-13 11:27:18.963 FINE: RESPONSE HEADERS: {null=[HTTP/1.0 200 OK], Connection=[Keep-Alive], Content-Length=[0]}
2020-11-13 11:27:18.964 FINE: Downloading data...
2020-11-13 11:28:25.255 SEVERE: Could not parse WMS layer list. Incoming data:
: org.openstreetmap.josm.io.imagery.WMSImagery$WMSGetCapabilitiesException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Premature end of file.. Cause: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Premature end of file.
comment:4 by , 5 years ago
So this is a bug in JOSM? Maybe anybody with other (older?) version of JOSM could check it and confirm the error?
comment:5 by , 5 years ago
Java filter again? For the polish services we always need to change the user agent.
comment:6 by , 5 years ago
OK, I did it. User agent hint was correct. I pasted https://mapy.geoportal.gov.pl/wss/service/img/guest/HYDRO/MapServer/WMSServer?SERVICE=WMS&REQUEST=GetCapabilities into GetCapabilities field and *before* I pressed "Get layers" button, I filled also "Header name" and "Header value" fields:
Header name = User-Agent
Header value = Mozilla/5.0 (JOSM)
*After* entering header name/value I press "Get layers" button and it works.
comment:7 by , 5 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:8 by , 5 years ago
There are possible enhancements:
- document the dialogs (WMS/TMS/WMTS) including this case with User agent.
- Maybe a note about User agent in the dialog and/or moving the
Headeroption on top.



The link returns
for me.