Spring WS WSDL automatic exposure : xsd import are not followed

こ雲淡風輕ζ 提交于 2019-12-05 11:13:12

Solved!

I had to use XsdSchemaCollection instead of a SimpleXsdSchema; in addition I had to set to true the "inline" parameter of the collection.

@Bean(name="updateContactService")
public DefaultWsdl11Definition defaultWsdl11Definition() throws Exception {
    DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
    wsdl11Definition.setPortTypeName("updateContactPort");
    wsdl11Definition.setLocationUri("/ws/updateContact");
    wsdl11Definition.setTargetNamespace("http://spring.io/guides/gs-producing-web-service");
    wsdl11Definition.setSchemaCollection(updateContactXsd());
    return wsdl11Definition;
}   

@Bean
public XsdSchemaCollection updateContactXsd() throws Exception {
    CommonsXsdSchemaCollection xsds = new CommonsXsdSchemaCollection(new ClassPathResource("xsds/contact/outboundMessage.xsd"));
    xsds.setInline(true);  <-------------------
    return xsds;
}

Note :

xsds.setInline(true);

I'll open an issue on Jira because I think that reference it's not clear!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!