Mule SOAP代理WSDL在XSD的相对路径解析时失败

Mule SOAP代理WSDL在XSD的相对路径解析时失败,soap,xsd,wsdl,mule,mule-studio,Soap,Xsd,Wsdl,Mule,Mule Studio,我已经使用MuleSoft创建了一个WSDL和一个MuleSOAP代理web服务。我的应用程序运行良好,除了一个问题:当XSD存储在项目根以外的任何位置时,它将无法解决。我在/src/main/resources内创建了service和xsd文件夹,如示例项目所示,但是当调用该服务时,我收到以下错误: [[bpi.sfdcservices].connector.http.mule.default.receiver.02]org.apache.cxf.wstx\u msv\u validation

我已经使用MuleSoft创建了一个WSDL和一个MuleSOAP代理web服务。我的应用程序运行良好,除了一个问题:当XSD存储在项目根以外的任何位置时,它将无法解决。我在/src/main/resources内创建了service和xsd文件夹,如示例项目所示,但是当调用该服务时,我收到以下错误:

[[bpi.sfdcservices].connector.http.mule.default.receiver.02]org.apache.cxf.wstx\u msv\u validation.ResolvingGrammarReaderController:C:\Users\mmrg\MuleStudio\workspace\bpi.sfdcservices\xsd\sfdcServicesApiTypes.xsd(系统找不到指定的路径) java.io.FileNotFoundException:C:\Users\mmrg\MuleStudio\workspace\bpisfdcservices\xsd\sfdcServicesApiTypes.xsd(系统找不到指定的路径)

xsd导入为:

<xs:import namespace="BPI/Types" schemaLocation="xsd/sfdcServicesApiTypes.xsd"/>

如果我将此位置更改为

<xs:import namespace="BPI/Types" schemaLocation="sfdcServicesApiTypes.xsd"/>

并将xsd放在项目的根目录中,服务将正常执行

WSDL可以在类路径/相对路径中引用

<cxf:proxy-service namespace="BPI/sfdcServices/1.0" service="sfdcServices"  payload="body" doc:name="SOAP" port="sfdcServicesHttpSoapEndpoint" wsdlLocation="service/sfdcServices.wsdl" validationEnabled="true"/>

从我所看到的情况来看,我的项目设置与Mule示例相同。我在它们的配置中没有看到任何特定的映射等。我怀疑我的WSDL/XSD的编写方式有问题,因为当我将所有项目文件导入示例项目时,它的行为都是一样的,但无法找出问题所在

sfdcServices.wsdl:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions name="SFDCServices" targetNamespace="BPI/sfdcServices/1.0" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="BPI/sfdcServices/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:btns="BPI/Types" xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" >
    <wsdl:documentation>Services for CRU operations in SFDC</wsdl:documentation>
    <wsdl:types>
        <xs:schema targetNamespace="BPI/sfdcServices/1.0" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema">
            <xs:import namespace="BPI/Types" schemaLocation="xsd/sfdcServicesApiTypes.xsd"/>
            <xs:element name="querySFDCSingleRequest" type="btns:querySFDCSingleRequest"/>
            <xs:element name="querySFDCSingleResponse" type="btns:querySFDCSingleResponse"/>
            <xs:element name="updateSFDCSingleRequest" type="btns:updateSFDCSingleRequest"/>
            <xs:element name="updateSFDCSingleResponse" type="btns:updateSFDCSingleResponse"/>
            <xs:element name="createSFDCSingleRequest" type="btns:createSFDCSingleRequest"/>
            <xs:element name="createSFDCSingleResponse" type="btns:createSFDCSingleResponse"/>
        </xs:schema>
    </wsdl:types>
    <wsdl:documentation>Query for a single sObject</wsdl:documentation>
    <wsdl:message name="querySFDCSingleRequestMsg">
        <wsdl:part name="querySFDCSingleRequestPart" element="tns:querySFDCSingleRequest"/>
    </wsdl:message>
    <wsdl:message name="querySFDCSingleResponseMsg">
        <wsdl:part name="querySFDCSingleResponsePart" element="tns:querySFDCSingleResponse"/>
    </wsdl:message>
    <wsdl:documentation>Update a single sObject</wsdl:documentation>
    <wsdl:message name="updateSFDCSingleRequestMsg">
        <wsdl:part name="updateSFDCSingleRequestPart" element="tns:updateSFDCSingleRequest"/>
    </wsdl:message>
    <wsdl:message name="updateSFDCSingleResponseMsg">
        <wsdl:part name="updateSFDCSingleResponsePart" element="tns:updateSFDCSingleResponse"/>
    </wsdl:message>
    <wsdl:documentation>Create a single sObject</wsdl:documentation>
    <wsdl:message name="createSFDCSingleRequestMsg">
        <wsdl:part name="createSFDCSingleRequestPart" element="tns:createSFDCSingleRequest"/>
    </wsdl:message>
    <wsdl:message name="createSFDCSingleResponseMsg">
        <wsdl:part name="createSFDCSingleResponsePart" element="tns:createSFDCSingleResponse"/>
    </wsdl:message>
    <wsdl:portType name="sfdcServicesSOAP">
        <wsdl:operation name="querySFDCSingle">
            <wsdl:input name="querySFDCSingleRequestInput" message="tns:querySFDCSingleRequestMsg"/>
            <wsdl:output name="querySFDCSingleResponseOutput" message="tns:querySFDCSingleResponseMsg"/>
        </wsdl:operation>
        <wsdl:operation name="updateSFDCSingle">
            <wsdl:input name="updateSFDCSingleRequestInput" message="tns:updateSFDCSingleRequestMsg"/>
            <wsdl:output name="updateSFDCSingleResponseOutput" message="tns:updateSFDCSingleResponseMsg"/>
        </wsdl:operation>
        <wsdl:operation name="createSFDCSingle">
            <wsdl:input name="createSFDCSingleRequestInput" message="tns:createSFDCSingleRequestMsg"/>
            <wsdl:output name="createSFDCSingleResponseOutput" message="tns:createSFDCSingleResponseMsg"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="sfdcServicesSoapBinding" type="tns:sfdcServicesSOAP">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="querySFDCSingle">
            <soap:operation soapAction="querySFDCSingle" style="document"/>
            <wsdl:input name="querySFDCSingleRequestInput">
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="querySFDCSingleResponseOutput">
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="updateSFDCSingle">
            <soap:operation soapAction="updateSFDCSingle" style="document"/>
            <wsdl:input name="updateSFDCSingleRequestInput">
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="updateSFDCSingleResponseOutput">
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="createSFDCSingle">
            <soap:operation soapAction="createSFDCSingle" style="document"/>
            <wsdl:input name="createSFDCSingleRequestInput">
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="createSFDCSingleResponseOutput">
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="sfdcServices">
        <wsdl:port name="sfdcServicesHttpSoapEndpoint" binding="tns:sfdcServicesSoapBinding">
            <soap:address location="http://localhost:8084/BPI/services/sfdcServices"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

SFDC中CRU操作的服务
查询单个sObject
更新单个sObject
创建单个sObject
sfdcServicesApiTypes.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="BPI/Types" targetNamespace="BPI/Types" elementFormDefault="unqualified" attributeFormDefault="unqualified">
    <xs:complexType name="querySFDCSingleRequest">
        <xs:sequence>
            <xs:element name="sObjectType" type="xs:string" nillable="false"/>
            <xs:element name="queryFilterField" type="xs:string" nillable="false" minOccurs="1" maxOccurs="unbounded"/>
            <xs:element name="queryCondition" type="ns1:queryCondition" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="querySFDCSingleResponse">
        <xs:sequence/>
    </xs:complexType>
    <xs:complexType name="updateSFDCSingleRequest">
        <xs:sequence>
            <xs:element name="sObjectType" type="xs:string" nillable="false"/>
            <xs:element name="Id" type="xs:string" nillable="false"/>
            <xs:element name="fieldUpdates" type="ns1:dataPair" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="updateSFDCSingleResponse">
        <xs:sequence/>
    </xs:complexType>
    <xs:complexType name="createSFDCSingleRequest">
        <xs:sequence>
            <xs:element name="sObjectType" type="xs:string" nillable="false"/>
            <xs:element name="fieldUpdates" type="ns1:dataPair" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="createSFDCSingleResponse">
        <xs:sequence/>
    </xs:complexType>
    <xs:complexType name="dataPair">
        <xs:sequence>
            <xs:element name="fieldName" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
            <xs:element name="value" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="queryCondition">
        <xs:sequence>
            <xs:element name="queryField" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
            <xs:element name="operator" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
            <xs:element name="value" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>


将src/main/resources添加到类路径或将它们添加到import语句中,然后重试。谢谢您的建议。默认情况下,在Mule项目中,src/main/java、src/main/resources、src/test/java和src/test/resources都位于构建路径上。我在resources目录中有其他成功从类路径引用的文件(属性文件和sfdcServices.wsdl文件本身可以被引用为“service/sfdcServices.wsdl”)。我检查了示例项目,但构建路径中没有任何其他内容。因此问题似乎实际上是CXF验证器。关闭消息验证后,服务将正常运行,XSD将从类路径解析。验证器似乎正在尝试使用给定的相对于工作目录的路径来验证XSD。在Studio和muleESB standalone之间移动时,此工作目录会发生更改。这使我们能够启动并运行,但我仍然希望能够操纵发送到CXF的值,以便我们可以继续使用消息验证。@MikeM,我如何才能关闭验证?