简体   繁体   English

jaxb2-maven-plugin:无法从WSDL生成源

[英]jaxb2-maven-plugin: Can't generate sources from WSDL

I am trying to generate java classes from a wsdl using jaxb2-maven-plugin: 我正在尝试使用jaxb2-maven-plugin从wsdl生成Java类:

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
                <execution>
                    <id>xjc</id>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <packageName>es.sescam.sofos.registrounico</packageName>
                <sourceType>wsdl</sourceType>
                <sources>
                    <source>src/main/resources/registrounico.wsdl</source>
                </sources>
                <outputDirectory>target/generated-sources</outputDirectory>
                <clearOutputDir>false</clearOutputDir>
            </configuration>
        </plugin>   

You can find the WSDL that I am using on this link 您可以在此链接上找到我正在使用的WSDL。

When I compile in Eclipse using the goals -U clean jaxb2:xjc everything seems to be OK with no errors, but the source java code is not generated in the target folder or anywhere... 当我使用目标-U clean jaxb2:xjc在Eclipse中进行编译时,一切似乎都正常,没有错误,但是源Java代码未在目标文件夹或任何位置中生成...

What am I doing wrong? 我究竟做错了什么?

The WSDL you are trying to use is RPC style and not document style; 您尝试使用的WSDL是RPC样式,而不是文档样式。 in RPC you have no XSD. 在RPC中,您没有XSD。 In your case it seems all the SOAP messages (both requests and responses) are strings. 在您的情况下,似乎所有SOAP消息(请求和响应)都是字符串。 Maybe they are XML formatted but this is something related on how the implementation side handles these messages. 也许它们是XML格式的,但这与实现方面如何处理这些消息有关。

In this case you can't use JAXB for SOAP; 在这种情况下,您不能将JAXB用于SOAP。 maybe you can use it for creating XML strings to sends 也许您可以使用它来创建要发送的XML字符串

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM