Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dynamically autogenerate Java Beans from WSDL?

I would like to develop an application to test Web Services, which will automatically generate a JSF form using parameters from the provided WSDL.

The WSDL URL is provided by user and I don't know the names of operations before parsing it. I would like the app to go through the parsed operations and its parameters, and autogenerate the appropriate Java Beans, which I will use to generate a JSF form.

I have tested CXF and JAX-WS, but I think they need to know the operation names before generating Java beans. How to transparently generate Java Beans for any WSDL? Manually running wsdl2java is not a solution.

like image 206
niutech Avatar asked May 10 '12 13:05

niutech


1 Answers

CXF does have a "DynamicClient" (see: http://cxf.apache.org/javadoc/latest-2.6.x/org/apache/cxf/jaxws/endpoint/dynamic/JaxWsDynamicClientFactory.html ) that can be used for this. It parses the wsdl, generated JAXB objects and compiles them, and returns a client that can be used to get the operations and types and such associated with them.

like image 93
Daniel Kulp Avatar answered Nov 07 '22 12:11

Daniel Kulp