import javax.wsdl.*; import javax.wsdl.factory.*; import javax.wsdl.xml.*; public class WSDLParser { public static void main(String[] args) { try { WSDLFactory wsdlFactory = WSDLFactory.newInstance(); WSDLReader wsdlReader = wsdlFactory.newWSDLReader(); Definition definition = wsdlReader.readWSDL("http://example.com/service.wsdl"); Service service = definition.getService("MyService"); Port port = service.getPort("MyPort"); Operation operation = port.getBinding().getPortType().getOperation("MyOperation", null, null); System.out.println("Operation name: " + operation.getName()); for (Object obj : operation.getInput().getMessage().getParts().values()) { Part part = (Part) obj; System.out.println("Parameter name: " + part.getName()); } } catch (WSDLException e) { e.printStackTrace(); } } }


上一篇:
下一篇:
切换中文