views:

554

answers:

3

I want to automatically process a WSDL file to discover defined Service / Port elements. Is this possible, using Java or some sort of Ant utility? If so, how?

+1  A: 

The .NET framework has the System.Web.Services.Description.ServiceDescription type that will help, but you might want to check out this...

http://mikehadlow.blogspot.com/2006/06/simple-wsdl-object.html

... which shows you a "simple WSDL object".

Martin Peck
Thanks! Unfortunately I can't use .NET for this at work (Java shop- prob should have mentioned). I wonder what the comparable task would look like for Java...
Cuga
A: 

I believe I found what I'm looking for by learning about JAX-WS.

Cuga
Please clarify by specifying what you found by learning and place the answer here. That would help other people learn from the good question you asked.
Robert Nickens
See the accepted answer.
Cuga
+1  A: 

JAX-WS does indeed contain WSDL parsing code and does allow you to inspect the WSDL ports and services.

If you are looking for something that might be more robust, allows you to manipulate or inspect other parts of the WSDL, WSDL4J might be useful for you. WSDL4J may also have the added benefit of not being an endorsed "Standalone Technology" meaning that you can easily include it in your classpath without worrying about it conflicting with the version of the JVM your code runs on.

If you actually have to make Web service calls and only need to inspect the high-level parts of the WSDL, JAX-WS will work fine. If you need something more portable without possible configuration overhead and/or you don't actually need to make Web service calls, WSDL4J may be a better choice.

DavidValeri