1

I working on upgrading the services offered by a certain customer via WSDL files. These services were offered in a single WSDL file in prior version, for which I had single bindings.xml file to handle customization part. Now, these services are offered in multiple WSDL files(9 in total) that have internal references among themselves. I'm thinking I would need multiple bindings files to handle customizations. However, the wsimport doesn't seem to be working with this approach.

I have tried:

  1. changing existing location of wsdlLocation attribute to point to one of the latest WSDL file that requires customization; other files have to be handled for customization as well, how do I do that with single wsdlLocation attribute in bindings.xml file?

  2. Adding multiple binding files with wsdlLocation attribute inside each one set to point to its corresponding wsdl file, in which case I'm getting below compilation error as there is a mismatch between xml files and wsdl files.

    3.Have tried separating wsdl files into their distinct folders and compiling individually which of course did not work because of internel references. All the to be executed in a single goal I guess.

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>

Service1bindings.xml

<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>

Service2bindings.xml

<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.
******************************************************************************
Imran pasha
  • 31
  • 1
  • 8

0 Answers0