Parsing WSDL with Java
The Membrane SOA Model makes it easy to parse a WSDL. See listing 1 for an example. It parses a WSDL document and prints out the interface of the service with its operations.
package sample.wsdl;
import com.predic8.wsdl.*;
public class ListWSDLOperations {
public static void main(String[] args) {
WSDLParser parser = new WSDLParser();
Definitions defs = parser
.parse("http://ws.xwebservices.com/XWebBlog/V2/XWebBlog.wsdl");
for (PortType pt : defs.getPortTypes()) {
System.out.println(pt.getName());
for (Operation op : pt.getOperations()) {
System.out.println(" -" + op.getName());
}
}
}
}
Listing 1: ListWSDLOperations.java
In listing 2 you can see the output.
XWebBlogInterface
-LoadEntry
-LoadBlog
-LoadBlogPaged
-GetNewEntryID
-AddEntry
-UpdateEntry
-DeleteEntry
-LoadBlogByDateRange
-LoadBlogByDateRangePaged
-ProcessEntry
-AddReply
-UpdateReply
-DeleteReply
-ProcessReply
-GetNewReplyID
-LoadReply
Listing 2: The List of the operation in the WSDL Document