1

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, i.e. non-maven base.

Janik Zikovsky
  • 3,086
  • 7
  • 26
  • 34
Anas Dawood
  • 101
  • 2
  • 8

2 Answers2

1

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. :)

Anas Dawood
  • 101
  • 2
  • 8
  • Hi Anas, you are right, its working. we are able to generate SOAP request, but I have a problem facing here. When we have more namespaces available in WSDL file, we are not getting the required namespace references generated in SOAP request. Because of this, we are facing issue with elements which have wrong namespace reference. Could you help me regarding. – Mohan Kanakala Dec 10 '15 at 11:00
0

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.

Community
  • 1
  • 1
  • The reading part is not the problem. but after reading it, how would i generate the SOAP ? the WSDL file looks nothing like the SAOP file. And every WSDL is different. – Anas Dawood Dec 05 '12 at 06:02