Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring配置web服务:从wsdl获取XsdSchema_Java_Spring_Web Services_Xsd_Wsdl - Fatal编程技术网

Java Spring配置web服务:从wsdl获取XsdSchema

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中的元素,

我有SpringWeb服务配置

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>