web-services - 使用 ="encoded"异常解析 WSDL 时出错

标签 web-services soap wsdl wsimport

每次跑 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/

相关文章:

java - WSContext.getUserPrincipal() 为密码摘要认证返回 null

web-services - REST Web 服务——使用 xml 负载

web-services - http 获取 SOAP(网络服务)

java - 如何在客户端和服务器上完全拦截 gRPC java 一元调用?

java - 从本地测试环境到现场站点

node.js - 不使用 WSDL 的 NodeJS 的 SOAP

delphi - WSDL 导入器生成有故障的服务器

java - 是否可以从 JAX-RS 注释类中获取 WSDL 2.0?

java - 什么是 WSDL 中的可扩展元素

web-services - 测试 Web 服务 API 是否为 RESTful