How to get all binding information from WSDL using JAX-WS API

703 Views Asked by At

How to get all bindings declared in a WSDL using JAX-WS (Metro implementation) API?

Use case : I am going to enable the users of my application to dynamically invoke a web service. For that I am discovering the bindings first, then ports associated with the binding etc. at runtime.

I was going through the Metro documentation and found WSDLport class might useful to get port information and then binding information. But any idea how to get the reference of this class in the first place?

1

There are 1 best solutions below

0
On

Wesnt through JAX-WS reference implementation documentation, there are few steps by which we can parse WSDL at runtime to get the required information. But all of these methods return XML representations i.e. QName class.


    WSDLModel model = WSDLModel.WSDLParser.parse(parser, null, true, new WSDLParserExtension[0]);
    //To get all service tags
    Map serviceMap = model.getServices();
    //To get all the bindings
    Map bindingInfomation = model.getBindings();
    //To get ports
    Map portMap = model.getPortTypes();