微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。