DataPower

DataPower

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  DataPower XSD validate - Forbidden external reference

    Posted 02/23/24 04:22 AM

    Dear Community,

    I have a problem in validating XML using dp:schema-validate() operation in XSLT transformation (firmware 10.5.0.9).

    I'm validating XAdES file with XSD schema publicly available at  https://uri.etsi.org/01903/v1.3.2/

    and getting error:

    xmlmgr (defualt): xsd: Request failed to compile. http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd: Forbidden external reference encountered while parsing XML Referenced by local:///XAdES.xsd.
    mpgw (name): dp:schema-validate(): http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd: Forbidden external reference encountered while parsing XML

    When I put the xmldsig-core-schema.xsd file in local:/// and change the reference to  schemaLocation="xmldsig-core-schema.xsd"

    I'm getting error:

    xmlmgr (defualt): xsd: Request failed to compile. local:///xmldsig-core-schema.xsd: Forbidden external reference encountered while parsing XML Referenced by local:///XAdES.xsd.
    mpgw (name): dp:schema-validate(): local:///xmldsig-core-schema.xsd: Forbidden external reference encountered while parsing XML

    My XAdES file validates correctly against XAdES.xsd with online tools like https://www.freeformatter.com/xml-validator-xsd.html

    Can't find any solution regarding DataPower and "Forbidden external reference".

    Regards,

    Michal



    ------------------------------
    Michal Grzelak
    ------------------------------


  • 2.  RE: DataPower XSD validate - Forbidden external reference

    Posted 02/23/24 05:31 AM

    Hi,

    have a look in the xml parser setting in the XML Manager.

    https://www.ibm.com/docs/en/datapower-gateway/10.5.x?topic=xplc-external-references



    ------------------------------
    Jeroen Willems
    Integration Architect - Managing Partner
    Integration Designers
    ------------------------------



  • 3.  RE: DataPower XSD validate - Forbidden external reference

    Posted 02/23/24 05:39 AM

    Thank You very much Jeroen. Such a small change but that worked like a charm!

    Regards,

    Michal



    ------------------------------
    Michal Grzelak
    ------------------------------



  • 4.  RE: DataPower XSD validate - Forbidden external reference

    Posted 02/23/24 08:45 AM

    Be careful - external references are disabled by default for security reasons.
    Please think about what you are doing by enabling them.



    ------------------------------
    Hermann Stamm-Wilbrandt
    Compiler Level 3 support, IBM DataPower Gateways
    IBM
    Boeblingen Germany
    ------------------------------



  • 5.  RE: DataPower XSD validate - Forbidden external reference

    Posted 02/23/24 08:54 AM

    Thanks for that remark. We can do that in our case but (out of curiosity) what is the way to disable external references and still validate against that XSD schema? Do we have to merge all XSDs into one and store everything locally?

    Regards,

    Michal



    ------------------------------
    Michal Grzelak
    ------------------------------



  • 6.  RE: DataPower XSD validate - Forbidden external reference

    Posted 02/23/24 09:22 AM

    Hi,

    you do not need to merge.
    But to be sure what you use in prod I would store all external XSDs locally, reference those and disable external references again.



    ------------------------------
    Hermann Stamm-Wilbrandt
    Compiler Level 3 support, IBM DataPower Gateways
    IBM
    Boeblingen Germany
    ------------------------------



  • 7.  RE: DataPower XSD validate - Forbidden external reference

    Posted 02/23/24 10:24 AM
    Edited by Michal Grzelak 02/23/24 10:24 AM

    And this is what I actually did. I put the xmldsig-core-schema.xsd file in local:/// and changed the reference to  schemaLocation="xmldsig-core-schema.xsd" in main "XAdES.xsd"   (also tried schemaLocation="local:///xmldsig-core-schema.xsd")

    I was still getting error:

    xmlmgr (defualt): xsd: Request failed to compile. local:///xmldsig-core-schema.xsd: Forbidden external reference encountered while parsing XML Referenced by local:///XAdES.xsd.
    mpgw (name): dp:schema-validate(): local:///xmldsig-core-schema.xsd: Forbidden external reference encountered while parsing XML

    Can't seem to find other external references other than namespaces.

    Regards,

    Michal



    ------------------------------
    Michal Grzelak
    ------------------------------



  • 8.  RE: DataPower XSD validate - Forbidden external reference

    Posted 02/23/24 11:41 AM

    Hi,

    is this the XML schema you need?
    https://uri.etsi.org/01903/v1.3.2/XAdES.xsd



    ------------------------------
    Hermann Stamm-Wilbrandt
    Compiler Level 3 support, IBM DataPower Gateways
    IBM
    Boeblingen Germany
    ------------------------------



  • 9.  RE: DataPower XSD validate - Forbidden external reference

    Posted 02/23/24 12:21 PM

    Yes, that's the one.

    Regards,

    Michal



    ------------------------------
    Michal Grzelak
    ------------------------------