环境 NetBeans 6.9.1,GlassFish 3.1 + METRO 2.1
我想创建一个JSF页面,列出Web服务中的所有可用操作。我已经有一个包含WSDL文件的File
实例。鉴于这些,我应该如何继续列出可用的操作。什么是最好的方式?
提前致谢!
答案 0 :(得分:1)
使用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 **/
}
}