Spring WS SimpleXsdSchema 无法访问 wsdl 中包含的 xsd 架构

问题描述

我正在使用的 wsdl 没有单独的 xsd 文件。 XSD Schema 包含在 wsdl 文件中,如下所示

<wsdl:deFinitions name="myProject"
                  targetNamespace="http://www.company.gr/myProject/deFinitions"
                  xmlns:tns="http://www.company.gr/myProject/deFinitions"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:xsd1="http://www.company.gr/myProject/schemas">

    <wsdl:types>
        <schema
                targetNamespace="http://www.company.gr/myProject/schemas"
                xmlns="http://www.w3.org/2001/XMLSchema">

        <simpleType name="aaa">
            ...
        </simpleType>

...

我想用以下代码添加一个验证拦截器:

@Override
public void addInterceptors(List<EndpointInterceptor> interceptors) {
    PayloadValidatingInterceptor validatingInterceptor = new PayloadValidatingInterceptor();
    validatingInterceptor.setValidateRequest(true);
    validatingInterceptor.setValidateResponse(true);
    validatingInterceptor.setXsdSchema(mySchema());
    interceptors.add(validatingInterceptor);
}

@Bean
public XsdSchema mySchema(){
    return new SimpleXsdSchema(new ClassPathResource("**myWSDL.wsdl#types**"));
}

但是在使用 myWSDL.wsdl#types 时找不到架构。

有没有办法在不重构 wsdl 以外部化 xsd 模式的情况下访问模式?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)