Java Spring配置web服务:从wsdl获取XsdSchema
我有SpringWeb服务配置Java Spring配置web服务:从wsdl获取XsdSchema,java,spring,web-services,xsd,wsdl,Java,Spring,Web Services,Xsd,Wsdl,我有SpringWeb服务配置 public class WSConfig extends WsConfigurerAdapter { @Bean public XsdSchema getSchema() { return new SimpleXsdSchema(new ClassPathResource("wsdl/types/ewstypes.xsd")); } ... 如何从wsdl获取xsd? 因为我需要wsdl中的元素,
public class WSConfig extends WsConfigurerAdapter {
@Bean
public XsdSchema getSchema() {
return new SimpleXsdSchema(new ClassPathResource("wsdl/types/ewstypes.xsd"));
}
...
如何从wsdl获取xsd?
因为我需要wsdl中的元素,并且我不能更改这个文件(例如,从创建新的xsd并在@bean中返回它)
。。。
...
一件简单的事情就是复制标签
<xsd:schema>
从您的WSDL及其所有内容到您的文件“ewstypes.xsd”,这将生成一个完全有效的xsd模式
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.0"
elementFormDefault="qualified"
targetNamespace="http://foo/equeue/ws/"
>
<xsd:import namespace="http://foo/equeue/ws/types/" schemaLocation="../types/etypes.xsd"/>
<xsd:import namespace="http://bar/123" schemaLocation="../types/ewstypes.xsd" />
<xsd:element name="getRequest" type="smev:GetRequestType"/>
....
</xsd:schema>
....
然后像你现在所做的那样,将它作为一个Bean公开。
希望这有帮助
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.0"
elementFormDefault="qualified"
targetNamespace="http://foo/equeue/ws/"
>
<xsd:import namespace="http://foo/equeue/ws/types/" schemaLocation="../types/etypes.xsd"/>
<xsd:import namespace="http://bar/123" schemaLocation="../types/ewstypes.xsd" />
<xsd:element name="getRequest" type="smev:GetRequestType"/>
....
</xsd:schema>