【问题标题】:Error parsing WSDL with exception use="encoded"使用异常 use="encoded" 解析 WSDL 时出错
【发布时间】:2014-04-01 11:09:37
【问题描述】:

每次我运行 wsimport 时,我都会收到此错误:

[错误]“不支持使用 SOAP 编码。 文件中第 65 行的 SOAP 扩展元素:dummy.wsdl 有 use="encoded" " 解析 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>

【问题讨论】:

    标签: web-services soap wsdl wsimport


    【解决方案1】:

    这是因为给定的 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>
    

    【讨论】:

    • 我需要一个用于 rpc/encoded Web 服务的客户端。这些说明“刚刚奏效”。谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多