I a开发者_运维问答m new to SOAP Webservices. My requirement is to create a testing tool like SOAP UI wherein The inputs would be the URL of the Concrete WSDL and the operation. My task is to create SOAP Client Dynamically based on the WSDL and the operation. I am using java. Can anyone help me out with the java code?
Have a look at Axis2 an the especially the client generation.
http://axis.apache.org/axis2/java/core/docs/userguide-creatingclients.html
You dont really need to generate a SOAP client. You can use something like HTTPClient to post the request SOAP XML. This way whatever WSDL all you need to do is create a xml.
http://www.java-tips.org/other-api-tips/httpclient/how-to-send-an-xml-document-to-a-remote-web-server-using-http-5.html
Any reason why you're not using SoapUI to do this? As you point out, it does exactly what you want (and, FWIW, it's a Java app ;-) ).
Anyway, both the Axis and CXF web service frameworks (Apache) have wsdl2j
implementations that will generate your client stubs for you: you provide a WSDL URI as an argument on the command line when you invoke a wsdl2j
instance (this is the same code used under the covers by SoapUI, when generating a client with the relevant framework), and the class generates your stubs.
You might find this question useful: What methods exist to auto-generate java client stubs from WSDL files?
Take a look at JAX-WS API and its reference implementation: http://jax-ws.java.net/
It is a normalized specification for webservice publication and invocation (JSR 224)
精彩评论