0
In Java, I am using the wsimport tool. The process works. However there are some problems.
I have to wsimport into the services of several different suppliers (all of them third parties, I have no control over them). Wsdls are almost identical, only changing the destination URL.
Each of these Wsdls define a lot of different operations/methods. It turns out that out of this lot of operations, only a couple or three I’ll really need. Almost at the end of each of these Wsdls there is this:
<wsdl:service name="Exemplo">
<wsdl:port name="ExemploSoap" binding="tns:ExemploSoap">
<soap:address location="https://www.example.com/wsIntegracao/exemplo.asmx" />
</wsdl:port>
<wsdl:port name="ExemploSoap12" binding="tns:ExemploSoap12">
<soap12:address location="https://www.example.com/wsIntegracao/exemplo.asmx" />
</wsdl:port>
</wsdl:service>
From one WSDL to another almost nothing changes. In general, the only thing that changes are these Urls that are on the stretch up there.
This is the relevant part of pom.xml
. I have it for each service/WSDL different, so each of them will generate a distinct JAR (there is one pom.xml
for each service, each in a separate folder).
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>servico-teste.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>servico-teste.wsdl</wsdlLocation>
<wsdlDirectory>${basedir}</wsdlDirectory>
<packageName>br.com.example.servico2</packageName>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-Xlint:none</arg>
</compilerArgs>
</configuration>
</plugin>
The differences between a pom.xml
and others are minimal. Virtually only the package name to be generated and the WSDL file name.
As I mentioned, the process works. But this way, if I have 20 different services, 20 almost identical JAR files will be generated. If each of them has 100 classes, this will generate 2000 different classes in 20 Jars, of which only 3 or 4 I use effectively.
So I have two questions:
Is there any way to optimize wsimport to need to run it only once when the services are equal or sufficiently similar, where only the URL in
soap:address location
range?Is there any way to instruct wsimport to generate only the classes needed for a particular part of the WSDL, and not for everything that is referenced in the WSDL?
@Renancarlos I rejected your issue because it didn’t seem to be improving my question at all, just adding formatting where it shouldn’t be. If you still think that your edition was valid, I would like to hear it. Anyway, I appreciate the attention and commitment.
– Victor Stafusa