You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

寻求含绝对路径SchemaLocation的外部XSD引用WSDL示例

带绝对路径SchemaLocation的WSDL示例及说明

这里给你提供完整的、使用绝对路径引用外部Schema的WSDL示例,同时补充本地绝对路径的写法供参考:

1. 使用网络绝对URL的WSDL示例

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:tns="http://example.bank.skjolber.github.com/v1"
                  targetNamespace="http://example.bank.skjolber.github.com/v1">

    <wsdl:types>
        <xsd:schema>
            <xsd:import 
                namespace="http://example.bank.skjolber.github.com/v1" 
                schemaLocation="http://example.bank.skjolber.github.com/v1/BankCustomerService.xsd" />
        </xsd:schema>
    </wsdl:types>

    <!-- 以下为WSDL其他必要组成部分,可根据实际业务场景补充调整 -->
    <wsdl:message name="GetCustomerRequest">
        <wsdl:part name="parameters" element="tns:GetCustomerRequest"/>
    </wsdl:message>
    <wsdl:message name="GetCustomerResponse">
        <wsdl:part name="parameters" element="tns:GetCustomerResponse"/>
    </wsdl:message>

    <wsdl:portType name="BankCustomerServicePortType">
        <wsdl:operation name="getCustomer">
            <wsdl:input message="tns:GetCustomerRequest"/>
            <wsdl:output message="tns:GetCustomerResponse"/>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="BankCustomerServiceBinding" type="tns:BankCustomerServicePortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="getCustomer">
            <soap:operation soapAction=""/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="BankCustomerService">
        <wsdl:port name="BankCustomerServicePort" binding="tns:BankCustomerServiceBinding">
            <soap:address location="http://example.bank.skjolber.github.com/v1/BankCustomerService"/>
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

2. 使用本地绝对路径的写法(适用于Schema文件存放在本地磁盘的场景)

如果你的Schema文件在本地机器上,可采用file:///开头的绝对路径格式,示例如下:

<xsd:schema>
    <xsd:import 
        namespace="http://example.bank.skjolber.github.com/v1" 
        schemaLocation="file:///C:/wsdl-resources/BankCustomerService.xsd" />
</xsd:schema>

注意:Windows系统路径需用正斜杠,或转义后的反斜杠(\\\\);Linux/macOS系统写法类似file:///opt/wsdl-resources/BankCustomerService.xsd

关键注意事项

  • 确保schemaLocation指定的绝对路径/URL可正常访问,测试应用能成功拉取到Schema文件
  • namespace属性必须与目标Schema文件中定义的targetNamespace完全一致
  • 若使用网络URL,需确认测试应用无网络权限或防火墙限制,能正常连接到该地址

内容的提问来源于stack exchange,提问作者KUMAR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 05:40:17