每次跑 wsimport ,我收到此错误:
[ERROR] "Use of SOAP Encoding is not supported. SOAP extension element on line 65 in file:dummy.wsdl has use="encoded" " Failed to parse the WSDL.
WSDL(错误块):
<wsdl:input name="dummyRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:cmg.stdapp.webservices.generalplugin" use="encoded" />
</wsdl:input>
最佳答案
这是因为给定的 WSDL 正在使用“编码”,这是一种 RPC 编码和一种非常古老的做事方式。
wsimport 不支持 RPC 编码
Some more info on your error message
作为替代尝试使用 Apache Axis这是令人讨厌和陈旧的,但我想它会让你继续前进。
对于 Maven 项目,将 WSDL 放在 src/main/resources/wsdl
并将以下内容添加到您的 pom.xml
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<configuration>
<packageSpace>com.mycompany.service.client</packageSpace>
<sourceDirectory>src/main/resources/wsdl</sourceDirectory>
<outputDirectory>target/generated-sources/wsdl2java</outputDirectory>
</configuration>
</plugin>
关于web-services - 使用 ="encoded"异常解析 WSDL 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22784062/