0

I have WSDL file locally in my machine and using WSDL file I wanted to generate the web-service template in separate file, So later I can change tag values based on need. Not sure which jar files, settings and javacode are required in java to generate web service template in separate file using WSDL file.

nisi
  • 1
  • 1

3 Answers3

1

If i understand correctly, you want to generate the Java class files from your WSDL, right ? If you use metro, you have to go in the bin directory of metro. Then, you have to use "wsimport.sh -s " if you're on windows try wsimport.bat instead of wsimport.sh

vincent
  • 1,214
  • 12
  • 22
  • Thank you @vincent, I have locally WSDL file only. I wanted to generate the Request file(e.g. abc.xml request file from abc.wsdl file, don't want to call the abc.xml request but just request template file where I can later fill the all the node values in request xml file). I am using eclipse with java. So I wanted to create request xml file from WSDL file, not java file from wsdl file. – nisi Jan 18 '15 at 10:10
  • oh ok, so a simple way to do that is to use tools like SoapUI. Open your WSDL file with it, and this tool will generate request automatically. – vincent Jan 18 '15 at 11:22
  • We need to code it in java, to get request file from WSDL. not supposed to use SOAPUI tool. – nisi Jan 19 '15 at 10:46
  • there's a SoapUI jar which provides Java objects for generating request, look at that if it's help :http://stackoverflow.com/questions/7487699/how-to-generate-a-soap-message-with-a-fully-populated-request-from-wsdl-without – vincent Jan 19 '15 at 10:54
0

I think below should work for you.

wsimport -s src http://<ip address>:<port>/test?wsdl

-s specifies the location where you want to place source file.

or if your wsdl file is locally present,you can try below.

wsimport -keep -wsdllocation /<path to wsdl file>/MyService.wsdl

For more reference wsimport

dReAmEr
  • 6,986
  • 7
  • 36
  • 63
  • Thank you RE350, wsimport is ant tool I think and will it generate the request xml file from wsdl file(e.g. abc.xml request file from abc.wsdl file) – nisi Jan 18 '15 at 10:24
  • wsimport is not ant tool,it is java tool(bat /sh file), yoy can see inside JDK/bin directory. and do you have to generate xml file of java file from wsdl? – dReAmEr Jan 18 '15 at 12:17
  • it would be great, but we have more than 50 webservices and wanted to get the request file from wsdl file, so later I can use it just like SOAPUI tool. but are not allowed to use soapUI tool. If any java code to do this operation it will more help. – nisi Jan 19 '15 at 10:48
0

You can generate Java classes from WSDL file using axis2. Download axis2 binary distribution. Go to bin directory. Execute below command with correct file paths according to your requirement.

./wsdl2java.sh -uri <WSDL File Path> -o <Destination folder for Java files>

Example:

./wsdl2java.sh -uri Mytest.wsdl -o myservice

This will create java files in "myservices" folder in axis2 bin directory, using the WSDL file located in bin directory of axis2.

If your WSDL file and the target folder is not inside bin directory of axis2, put absolute paths for those parameters in the above command.

  • Thank you JSIK, I don't want to create the java file. I wanted to create the request xml file from wsdl file. I am using eclipse with java. – nisi Jan 18 '15 at 10:12