我正在尝试在 APIKit 路由器上进行 XML 模式验证以验证请求
架构结构如下
root.xsd -- (imports) --> notifications.xsd -- (imports) --> objects.xsd
所有这些 xsd 文件都放在同一个模式文件夹中。
我面临的问题是,当我触发对 API 的任何请求时,它无法导入第三个模式(Objects.xsd),它给出了以下错误
********************************************************************************
Message : File Not Found: /home/ion-mule/objects.xsd (No such file or directory)
Element : demo/processors/0 @ raml-demo:demo.xml:17
Element DSL : <apikit:router config-ref="demo-config"></apikit:router>
Error type : MULE:UNKNOWN
FlowStack : at demo-main(demo-main/processors/0 @ demo:demo.xml:17)
Payload Type : org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider
--------------------------------------------------------------------------------
我已将所有文件正确放置在同一个文件夹中,但不知道为什么它总是无法获取第三个 xsd 文件。
下面是架构和示例有效负载
根.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:sobject.enterprise.soap.sforce.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.xmlsoap.org/soap/envelope/">
<xsd:import schemaLocation="notifications.xsd" namespace="http://soap.sforce.com/2005/09/outbound" />
<xsd:element name="Envelope">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Body">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q1="http://soap.sforce.com/2005/09/outbound" ref="q1:notifications" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xs:schema>
通知.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://soap.sforce.com/2005/09/outbound" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://soap.sforce.com/2005/09/outbound" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="objects.xsd" namespace="urn:sobject.enterprise.soap.sforce.com" />
<xs:element name="notifications">
<xs:complexType>
<xs:sequence>
<xs:element name="SessionId" nillable="true" />
<xs:element name="Url" type="xs:string" />
<xs:element name="Notification">
<xs:complexType>
<xs:sequence>
<xs:element name="Id" type="xs:string" />
<xs:element name="sObject">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q1="urn:sobject.enterprise.soap.sforce.com" ref="q1:Id" />
<xs:element xmlns:q3="urn:sobject.enterprise.soap.sforce.com" ref="q2:Name" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
对象.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="urn:sobject.enterprise.soap.sforce.com" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:sobject.enterprise.soap.sforce.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Id" type="xs:string" />
<xs:element name="Name" type="xs:unsignedShort" />
</xs:schema>
XML 示例
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<notifications xmlns="http://soap.sforce.com/2005/09/outbound">
<SessionId xsi:nil="true"/>
<Url>https://somerandomurl.com</Url>
<Notification>
<Id>04l0uioAAM</Id>
<sObject xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>xyx033fcml98i</sf:Id>
<sf:Name>7654</sf:Name>
</sObject>
</Notification>
</notifications>
</soapenv:Body>
</soapenv:Envelope>
请分享您的建议