从WSDL url生成Java源代码期间的异常

时间:2011-03-01 11:03:20

标签: maven-2 wsdl pom.xml

我正在尝试从wsdlurl生成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

任何想法?

感谢

1 个答案:

答案 0 :(得分:1)

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