0
環境的NetBeans 6.9.1,GlassFish的3.1 + 2.1麥德龍給定一個WSDL,如何檢索有關可用操作的信息?
我想打一個JSF頁面,列出了Web服務所有操作。我已經有一個包含WSDL文件的File
實例。鑑於這些,我應該如何繼續僅列出可用的操作。什麼是最好的方法?
在此先感謝!
環境的NetBeans 6.9.1,GlassFish的3.1 + 2.1麥德龍給定一個WSDL,如何檢索有關可用操作的信息?
我想打一個JSF頁面,列出了Web服務所有操作。我已經有一個包含WSDL文件的File
實例。鑑於這些,我應該如何繼續僅列出可用的操作。什麼是最好的方法?
在此先感謝!
使用WSDL4J
import java.util.Map;
import javax.wsdl.Definition;
import javax.wsdl.Types;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
public class WSDLInspect {
public static void main(String[] args) throws Exception {
WSDLFactory factory = WSDLFactory.newInstance();
WSDLReader reader = factory.newWSDLReader();
// pass the URL to the reader for parsing and get back a WSDL definiton
Definition wsdlInstance
= reader.readWSDL(null, "xxx");
// get a map of the five specific parts a WSDL file
Types types = wsdlInstance.getTypes();
Map messages = wsdlInstance.getMessages();
Map portTypes = wsdlInstance.getPortTypes();
Map bindings = wsdlInstance.getBindings();
Map services = wsdlInstance.getServices();
/** Do other stuff with information **/
}
}