2015-02-10 69 views
1

我想使用Java连接到Salesforce。然而,当我尝试解析partner.wsdl使用wsimport我收到以下错误:是从Salesforce本身产生使用wsimport解析Salesforce 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。我该如何生成使用它所需的类?

回答

0

的问题是由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