How to dynamically create a WSDL programmatically and also parse requests without generated code or stubs in Java?
Here is what I wanna do:
I have an Java web-app where i can define a service which executes code (e.g. JRuby), and it also specifies the input parameters and output parameters. All this information is stored in a DB.
Today from that information I can render a webpage presenting form fields for the inputs. If the user submits the form I parse the input request parameters and pass them to the actual JRuby code and return the outputs back to a response page.
What I want to do now is to do the exact same thing but don't show the user a HTML website, but show a WSDL instead. Assuming the consumer of this WSDL creates a SOAP client on his end and calls my webservice including the required input parameters, I would like to have some java code which can parse the incomming SOAP request, validate it against the dynamically generated WSDL file, extract the input request parameters, pass them to the JRuby code and return results as another SOAP request.
Long story short:
Which Java based framework can help me with that? I can't create java classes to generate WSDL or use any annotations because the specification of the input and outputs is dynamic from the database.
I think I could generate the WSDL really manually (concatenating strings or some e.g. freemarker t开发者_运维问答emplate) and then parse the xml also manually, but I thought if there is a better way to do this programmatically.
Thanks Christoph
You could try giving a look at wsdl4j. I'm having a similar problem and I stumbled on wsdl4j while looking for a solution, I haven't fully tested it yet. there is a pdf document here explaining how use it (chapter 10 "Programmatically Creating Definitions") hope it can help.
Maxx
精彩评论