2015-02-10 63 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