Reputation: 18465
I have a WSDL file provided by a service I'm using. It contains a large number of functions and I'm only interested in one.
How can I "refactor" the WSDL file and generate a new one that includes only the function I'm interested in?
I'm using the JDK's wsimport to process the WSDL file so a JAX-WS solution would be great, but if you know how to do it with XSLT (by processing the WSDL file as a simple XML file) that's fine too.
Upvotes: 2
Views: 2549
Reputation: 15251
Is there some special reason why additional methods in WSDL bother you? I mean, there is no any harm in having them, you simply call your method and ignore the others :) Having said that, there is always an option of manually editing the WSDL (unfortunately, there is no wsimport
option to import only specific method). Just erase all unnecessary methods and their associated elements from the WSDL and re-generate the WS client from new WSDL. Be careful to store and retrieve WSDL locally with your application, and Web service call should be successful regardless of changed WSDL. In case that you are afraid to erase the methods manually, there is XML and WSDL plugin for Netbeans. You can open your WSDL there, and you will see all Web methods in the designer. Just click all methods (they are called "operations" here) that you want to remove and they will disappear from the document without any fear that you messed up something. An example follows:
Actually, there is a similar, but reverse situation when you build Web service client from the remote WSDL and then WS developer updates the original WSDL with new methods. Web service call will still be successful if you stored WSDL locally; regardless of new methods being added.
See also:
Upvotes: 1