Web services 如何绑定多个wsdl文件?

Web services 如何绑定多个wsdl文件?,web-services,jaxb,jax-ws-customization,jaxws-maven-plugin,Web Services,Jaxb,Jax Ws Customization,Jaxws Maven Plugin,我正在通过WSDL文件升级某个客户提供的服务。在以前的版本中,这些服务是在一个WSDL文件中提供的,对于这个文件,我有一个bindings.xml文件来处理定制部分。现在,这些服务在多个WSDL文件(总共9个)中提供,这些文件之间有内部引用。我想我需要多个绑定文件来处理定制。然而,wsimport似乎无法使用这种方法 我试过: 更改wsdlLocation属性的现有位置,以指向需要自定义的最新WSDL文件之一;其他文件也必须进行自定义处理,如何使用bindings.xml文件中的单个wsdlLo

我正在通过WSDL文件升级某个客户提供的服务。在以前的版本中,这些服务是在一个WSDL文件中提供的,对于这个文件,我有一个bindings.xml文件来处理定制部分。现在,这些服务在多个WSDL文件(总共9个)中提供,这些文件之间有内部引用。我想我需要多个绑定文件来处理定制。然而,wsimport似乎无法使用这种方法

我试过:

  • 更改wsdlLocation属性的现有位置,以指向需要自定义的最新WSDL文件之一;其他文件也必须进行自定义处理,如何使用bindings.xml文件中的单个wsdlLocation属性来实现这一点

  • 在每个集合中添加多个具有wsdlLocation属性的绑定文件,以指向其对应的wsdl文件,在这种情况下,由于xml文件和wsdl文件之间存在不匹配,我将看到下面的编译错误

    3.尝试将wsdl文件分离到不同的文件夹中并单独编译,但由于internel引用,这些文件当然不起作用。我想所有这些都将在一个目标中实现

  • pom.xml:

    
    <plugin>
                <groupId>org.jvnet.jax-ws-commons</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>${jaxws-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>etc</id>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
                            <keep>true</keep>
                            <verbose>true</verbose>
                            <wsdlDirectory>src/main/resources/META-INF/wsdl</wsdlDirectory>
                            <wsdlFiles>
    
                                <wsdlFile>Service1.wsdl</wsdlFile>
    
                                <wsdlFile>Service2.wsdl</wsdlFile>
    
                            </wsdlFiles>
                            <bindingDirectory>src/main/resources/META-INF/wsdl</bindingDirectory>
                            <bindingFiles>
                                <bindingFileService1bindings.xml</bindingFile>
                                <bindingFile>Service2bindings.xml</bindingFile>
    
                            </bindingFiles>
                            <quiet>true</quiet>
                            <packageName>com.etc.sim.impl</packageName>
                            <staleFile>${project.build.directory}/etc.done</staleFile>
                            <xjcArgs>
                                <xjcArg>-npa</xjcArg>
                            </xjcArgs>
                        </configuration>
    
    
                    </execution>
                </executions>
            </plugin>
            <plugin>
    
    
    org.jvnet.jax-ws-commons
    jaxws-maven插件
    ${jaxws-maven plugin.version}
    等
    wsimport
    ${project.build.directory}/generated sources/jaxws-wsimport
    真的
    真的
    src/main/resources/META-INF/wsdl
    Service1.wsdl
    Service2.wsdl
    src/main/resources/META-INF/wsdl
    
    <jaxws:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" wsdlLocation="Service1.wsdl">
    
        <jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='ServiceMgmt']/wsdl:operation[@name='addEventsToPackage']">
            <jaxws:parameter part="wsdl:definitions/wsdl:message[@name='addEventsToPackageRequest']/wsdl:part[@name='package']"
                childElementName="package" name="paramPackage" />
        </jaxws:bindings>
    
        <jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='ServiceMgmt']/wsdl:operation[@name='removeEventsFromPackage']">
            <jaxws:parameter
                part="wsdl:definitions/wsdl:message[@name='removeEventsFromPackageRequest']/wsdl:part[@name='package']"
                childElementName="package" name="paramPackage" />
        </jaxws:bindings>
    </jaxws:bindings>
    
    <jaxws:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" wsdlLocation="service2.wsdl">
    
        <jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='Service2Mgmt']/wsdl:operation[@name='addEventsToPackage']">
            <jaxws:parameter part="wsdl:definitions/wsdl:message[@name='addEventsToPackageRequest']/wsdl:part[@name='package']"
                childElementName="package" name="paramPackage" />
        </jaxws:bindings>
    
        <jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='Service2Mgmt']/wsdl:operation[@name='removeEventsFromPackage']">
            <jaxws:parameter
                part="wsdl:definitions/wsdl:message[@name='removeEventsFromPackageRequest']/wsdl:part[@name='package']"
                childElementName="package" name="paramPackage" />
        </jaxws:bindings>
    </jaxws:bindings>
    
    The build with mvn clean install gives below error all the time: 
    
    *****************************************************************************
    Processing: file:sim/src/main/resources/META-INF/wsdl/Service2.wsdl
    [INFO] jaxws:wsimport args: [-keep, -s, target/generated-sources/jaxws-wsimport, -verbose, -encoding, UTF-8, -Xnocompile, -p, com.etc.sim.impl, -quiet, -B-npa, -b, sim/src/main/resources/META-INF/wsdl/Service1bindings.xml, -b, sim/src/main/resources/META-INF/wsdl/service2binding.xml, file:/opt/code/iap-test/tools/iap-simulators/vcas-sim/src/main/resources/META-INF/wsdl/service1.wsdl]
    [ERROR]     "file:-sim/src/main/resources/META-INF/wsdl/Service2.wsdl" is not a part of this compilation. Is this a mistake for "file:/opt/code/iap-test/tools/iap-simulators/vcas-sim/src/main/resources/META-INF/wsdl/Service1.wsdl"?
      line 4 of file:sim/src/main/resources/META-INF/wsdl/Service2binding.xml
    
        Failed to parse the WSDL.
    ******************************************************************************