membrane / api-gateway

API gateway for REST, OpenAPI, GraphQL and SOAP written in Java.
https://membrane-api.io
Apache License 2.0
464 stars 138 forks source link

org.xml.sax.SAXParseException - Content is not allowed in prolog with valid wsdl + xsd files #1341

Closed paulhyo closed 1 week ago

paulhyo commented 1 week ago

Hello,

I'm trying to validate my soap messages using the serviceProxy or soapProxy with a wsdl file + several xsd files. The WSDL und XSD files are valid and are used in our IBM Datapower Instances to validate SOAP-Messages. The same files can also be used in SoapUI for testing.

In Membrane, an org.xml.sax.SAXParseException - Content is not allowed in prolog error with one of the XSD is produced during Start-Up.

Membrane version: 5.5.4

SOAP-Specification: vostra2-strafregister-v1-soap-specification-1.2.0.zip

Proxies.xml proxies.xml.txt

LOG: membrane-soap-error-log.txt

Thank you!

predic8 commented 1 week ago

Hi @paulhyo, thanks for reporting the issue. The file eCH-0051-common-2-10-0.xsd starts with a byte order mark. The BOM consists of the byte sequence EF BB BF that is sometimes inserted to indicate the encoding of a text file. The image shows the byte sequence of the file.

grafik

If you remove the BOM from the file it will work. Just open it in VSC and change the encoding at the bottom from "UTF-8 with BOM" to "UTF-8" and save. It is the only file in your zip archive with BOM.

Unfortunately the XML parser library can not deal with the BOM. We will strip the BOM before parsing in a future Membrane version.

rrayst commented 1 week ago

@predic8 Membrane's GraphQL parser uses org.apache.commons.io.input.BOMInputStream for that purpose.

predic8 commented 1 week ago

Thanks. I am writing a test right now. Maybe we can use the class also for XSDs and WSDLs.

predic8 commented 1 week ago

@paulhyo thanks for reporting again.

1341 fixes the issue.