简体   繁体   中英

Java - create SOAP From a given WSDL programatically

Most web service provide a WSDL Link. When you pass this WSDL link to Eclipse it generates the JAVA coded Client. When you Pass the WSDL Link to SOAPUI It generates the SOAP envelope.

the question is:

is there an API in java that will allow me to generate the SOAP XML programatically?

Something like this :

WSDLReader re = new WSDLReader("WSDLURL");
String s = re.getWSDL();

ADDITIONAL INFO: I found an API that does something similar, Its called SOAP-WS. but the example given in the document is maven based. I want it in normal JAVA, ie non-maven base.

I have solved this problem with the following link :
http://www.membrane-soa.org/create-soap-request.htm
This IS the answer to my question. just download the required JARs, include them in your project and use the attached example. after that , if you pass a WSDL file the program will generate the required SOAP request. This is for anyone that happens to have the same problem as i did. :)

I am against of messing the philosphy with coding but.

You should know that WSDL use XML for its own purpose. So on this fact, you can dwonload a XML file from given web adres. Then XML file do not differ from any other text file. So on this fact we can say thay problem is reduced do downloading and reading a text file.

To allow that you can use Java NIO , ( example ) to download the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM