【问题标题】:Errors while parsing Salesforce Partner WSDL using wsimport使用 wsimport 解析 Salesforce 合作伙伴 WSDL 时出错
【发布时间】:2015-02-10 07:54:25
【问题描述】:

我想使用 Java 连接到 Salesforce。但是,当我尝试使用 wsimport 解析 partner.wsdl 时,出现以下错误:

parsing WSDL...
[WARNING] src-resolve: Cannot resolve the name 'tns:ID' to a(n) 'type definition' component.
  line 29 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl#types?schema1
[ERROR] A class/interface with the same name "com.sforce.soap.partner.DescribeGlobalTheme" is already in use. Use a class customization to resolve this conflict.
  line 1830 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] (Relevant to above error) another "DescribeGlobalTheme" is generated from here.
  line 759 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] A class/interface with the same name "com.sforce.soap.partner.DescribeApprovalLayout" is already in use. Use a class customization to resolve this conflict.
  line 2005 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] (Relevant to above error) another "DescribeApprovalLayout" is generated from here.
  line 1094 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] A class/interface with the same name "com.sforce.soap.partner.DescribeLayout" is already in use. Use a class customization to resolve this conflict.
  line 1954 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] (Relevant to above error) another "DescribeLayout" is generated from here.
  line 1112 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 1830 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] (Related to above error) This is the other declaration.
  line 759 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 2005 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] (Related to above error) This is the other declaration.
  line 1094 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 1954 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl
[ERROR] (Related to above error) This is the other declaration.
  line 1112 of file:/C:/Users/Rajasekhar/Desktop/partner.wsdl

此 WSDL 是从 Salesforce 本身生成的。我应该如何生成使用它所需的类?

【问题讨论】:

    标签: java web-services jaxb salesforce wsimport


    【解决方案1】:

    问题是由于 WSDL 使用了仅大小写不同的重复名称引起的:

    <complexType name="DescribeGlobalTheme">
    
    <element name="describeGlobalTheme">
    

    这很容易通过运行适当的 JAXB 扩展来解决:

    wsimport -extension -B-XautoNameResolution ...
    

    这将正确生成两个单独的类:

    @XmlType(name = "DescribeGlobalTheme", propOrder = { "global", "theme" })
    public class DescribeGlobalTheme {
    
    @XmlRootElement(name = "describeGlobalTheme")
    public class DescribeGlobalTheme2 {
    

    或者,改用Force.com Web Services Connector

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-10
      • 2012-11-15
      • 1970-01-01
      相关资源
      最近更新 更多