简体   繁体   中英

How to convert wsdl to java?

I've a WSDL file and i need to convert it into java, so for this i use step by step procedure from below link

http://axis.apache.org/axis2/java/core/tools/eclipse/wsdl2java-plugin.html

like adding axis2 codegen jar file into dropins folder in eclipse folder and restarted eclipse but i didn't get "Axis2 Wizard" in my eclipse IDE, so any one plz help me to get out of this.

Thanks, @nagaraju.

Recently I have to convert a WSDL file to Java code. I tried Axis2 Plugins with my Eclipse-Indigo and failed. I tried it in many ways but failed. Wasted my precious time and energy. I would like to suggest you one easy way i succeeded.

  1. Create a Java Project: File->New->Other->Java Project. (Suppose I named it TestWSDL)
  2. Create a WSDL File: File->New->Other->Web Services->WSDL File-> Name the file->Next->finish. (Suppose I named it NewWSDLFile.wsdl)
  3. Modify the WSDL File: Open NewWSDLFile.wsdl and replace all its content by your desired WSDL file.Save it. (Suppose I have saved my desired wsdl file at D:\sampleWSDL.xml, which i want to convert. Open this xml file using Notepad++,copy all its content and paste it to NewWSDLFile.wsdl)
  4. Create Web Service Client: File->New->Other->Web Services->Web Service Client->Next->Browse Service definition and show the path of the NewWSDLFile.wsdl file we created at step 2 ->OK-> Click Client Project(blue colored link at right) and set it to the project we created at step 1.
  5. Press Next -> Set Output Folder->Finish.
  6. You will have all the converted Java files at the folder you set at step 5.

There are two things you can do here. You can use that plugin or use web service wizard(which is available in Eclipse 3.3 also).

(i) Using the plugin:: You can download the latest Eclipse WSDL2JAVA Codegen plugin, paste it in the plugins folder of eclipse folder. Start the eclipse and you can find the Axis Codegen plugin on pressing ('Ctrl+N') or under 'File/New/Other/Axis'

(ii) Using the Web Service plugin: Press 'Ctrl+N ', and go to Web Service/Web Service Client. Paste the url(WSDL), select the client project you are working on, press next, specify the output folder and press finish.

Any of these two steps will generate the client stub(java code) for the wsdl you have given.

i founded this tool to auto generate wsdl to android code,

http://www.wsdl2code.com/example.aspx

 SampleService srv1 = new SampleService();
 req = new Request();                     
 req.companyId = "1";
 req.userName = "userName";                                     
 req.password = "pas";
 Response response =    srv1.ServiceSample(req);

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