2011-03-01 141 views
0

我想从wsdlurl生成java文件。其中一些工作正常,但其中一些有问题。 这里是代码。从WSDL URL生成Java源代码时的异常

<plugins> 

       <plugin> 
        <groupId>org.codehaus.mojo</groupId> 
        <artifactId>jaxws-maven-plugin</artifactId> 
        <version>1.12</version> 
        <executions> 
         <execution> 
          <id>ad1</id> 
          <goals> 
           <goal>wsimport</goal> 
          </goals> 
          <configuration> 
           <wsdlUrls> 
            <wsdlUrl>https://adcenterapi.microsoft.com/Api/Advertiser/v7/Reporting/ReportingService.svc?wsdl</wsdlUrl> 
            <wsdlUrl>https://adcenterapi.microsoft.com/Api/Advertiser/v7/Administration/AdministrationService.svc?wsdl</wsdlUrl> 
            <wsdlUrl>https://adcenterapi.microsoft.com/Api/Advertiser/v6/NotificationManagement/NotificationManagement.asmx?wsdl</wsdlUrl> 
            <wsdlUrl>https://adcenterapi.microsoft.com/Api/Advertiser/v7/CampaignManagement/CampaignManagementService.svc?wsdl</wsdlUrl> 
            <wsdlUrl>https://sharedservices.adcenterapi.microsoft.com/Api/Billing/v7/CustomerBillingService.svc?wsdl</wsdlUrl> 
            <wsdlUrl>https://sharedservices.adcenterapi.microsoft.com/Api/CustomerManagement/v7/CustomerManagementService.svc?wsdl</wsdlUrl> 
           </wsdlUrls> 
           <target>2.1</target> 
           <xjcArgs> 
            <xjcArg>-XautoNameResolution</xjcArg> 
           </xjcArgs> 
           <bindingDirectory>src/jaxws/wsdl/adCenter</bindingDirectory> 
           <keep>true</keep> 
           <packageName>com.microsoft.AdCenter.soap</packageName> 
          </configuration> 
         </execution> 
        </executions> 
       </plugin> 
</plugins> 

我以前也做过这些,但我没有任何问题。这次我非常困惑。

你们可以尝试在pom文件中使用wsdl生成Java源代码。由于我已经在我的系统尝试得到例外,因为

[ERROR] Two declarations cause a collision in the ObjectFactory class. 
    line 1 of https://adcenterapi.microsoft.com/Api/Advertiser/v7/CampaignManagement/CampaignManagementService.svc?xsd=xsd1 

[ERROR] (Related to above error) This is the other declaration. 
    line 1 of https://adcenterapi.microsoft.com/Api/Advertiser/v7/CampaignManagement/CampaignManagementService.svc?xsd=xsd1 

[ERROR] Two declarations cause a collision in the ObjectFactory class. 
    line 1 of https://adcenterapi.microsoft.com/Api/Advertiser/v7/CampaignManagement/CampaignManagementService.svc?xsd=xsd1 

[ERROR] (Related to above error) This is the other declaration. 
    line 1 of https://adcenterapi.microsoft.com/Api/Advertiser/v7/CampaignManagement/CampaignManagementService.svc?xsd=xsd1 

[ERROR] Two declarations cause a collision in the ObjectFactory class. 
    line 1 of https://adcenterapi.microsoft.com/Api/Advertiser/v7/CampaignManagement/CampaignManagementService.svc?xsd=xsd1 

[ERROR] (Related to above error) This is the other declaration. 
    line 1 of https://adcenterapi.microsoft.com/Api/Advertiser/v7/CampaignManagement/CampaignManagementService.svc?xsd=xsd1 

[ERROR] Two declarations cause a collision in the ObjectFactory class. 
    line 1 of https://adcenterapi.microsoft.com/Api/Advertiser/v7/CampaignManagement/CampaignManagementService.svc?xsd=xsd1 

[ERROR] (Related to above error) This is the other declaration. 
    line 1 of https://adcenterapi.microsoft.com/Api/Advertiser/v7/CampaignManagement/CampaignManagementService.svc?xsd=xsd1 

任何想法?

谢谢

+0

我只使用一个WSDL文件得到同样的错误。这个wsdl文件非常复杂。你有没有找到解决你的问题? – 2011-12-04 15:25:23

回答

1

我只是猜测,但它似乎有命名冲突。您可以尝试将您的wsimport分成多个步骤,并分别使用不同的<packageName>部分。

+0

导致您的问题的两个WSDL是CustomerManagementService和CampaignManagementService,它是导致冲突的xsd导入的名称空间。 – DaShaun 2011-03-02 15:22:54