aspose file tools*
The moose likes Web Services and the fly likes Generating WSDL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Generating WSDL" Watch "Generating WSDL" New topic
Author

Generating WSDL

Seshagiri Kamalakaran
Greenhorn

Joined: Feb 12, 2004
Posts: 4
Hi,

I am new to Web Services. After going through documents I understood that we have to have WSDD for the service. Also we are in need of WSDL which will help us to create the stubs and skeletons.
At present I am using Apache Axis.
They are providing tools like Java2WSDL to create the WSDL file and WSDL2Jave to create the stub and skeletons.
But those we have to run from command mode .
Another way to generate the WSDL is to add ?WSDL in the URL.

I am not willing for both.
I am having a web based application, in which I wil specify a J2EE component, which has to be generated as web service.
So I am willing to generate the WSDD, WSDL and all other related things in background without any manual work.
At present I am having a template of WSDD and I am filling the necessary things in that in the back ground.

Whether WSDD will automatically generate the needed WSDL for us?
I am sure its not.. Please clear me on this.

Also let me know how I can proceed on with this issue?
Its very urgent!!!

Thanks in advcance
Sesh
Bill Werth
Greenhorn

Joined: Jul 14, 2004
Posts: 5
My understanding is that the ?WSDL doesn't generate the WSDL file, it just displays one that you've previously installed with your web service.

Here is a link to a great article on how to use Axis to create your Web service: Creating Web Services with Apache Axis.

This is the article I used to write my first Web Service (and the only one so far :-) About the only thing this article is missing is how to set your classpath to compile the Web service.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Seshagiri Kamalakaran:

Whether WSDD will automatically generate the needed WSDL for us?
I am sure its not.. Please clear me on this.



According to Apache axis Yes!..
with your scenario, its possible to dynamically locate a j2ee compoment and deploy it as a webservice, BUT most of the application servers expects you to restart the application(context) to detect the new services.... ..

For example , ServletExec has a webbased application deployment tool, which may expect you to restarted for new web applications!..


Spritle Software Blogs
Sandeep Bhagavatula
Greenhorn

Joined: Jul 25, 2004
Posts: 8
Originally posted by Seshagiri Kamalakaran:
Hi,

I am new to Web Services. After going through documents I understood that we have to have WSDD for the service. Also we are in need of WSDL which will help us to create the stubs and skeletons.
At present I am using Apache Axis.
They are providing tools like Java2WSDL to create the WSDL file and WSDL2Jave to create the stub and skeletons.
But those we have to run from command mode .
Another way to generate the WSDL is to add ?WSDL in the URL.

I am not willing for both.
I am having a web based application, in which I wil specify a J2EE component, which has to be generated as web service.
So I am willing to generate the WSDD, WSDL and all other related things in background without any manual work.
At present I am having a template of WSDD and I am filling the necessary things in that in the back ground.

Whether WSDD will automatically generate the needed WSDL for us?
I am sure its not.. Please clear me on this.

Also let me know how I can proceed on with this issue?
Its very urgent!!!

Thanks in advcance
Sesh


It is true that WSDL is dynamically generated when we say ?wsdl in url. I say this because, I manually edited the wsdl document to rename the parameter names of methods as I could not get axis to pickup debug info even if i run javac with debug on. I deployed the service after I did this but it would still show those in0 in1...as parameter names when I say ?wsdl. What i dont understand is the way wssd is updated when we run ant without starting the server
Sandeep Bhagavatula
Bill Werth
Greenhorn

Joined: Jul 14, 2004
Posts: 5
I'm not sure that editing the WSDL to change the parameter names proves anything. It may just be proving that your deployment script isn't configured correctly.

I've edit the names and deployed the service and have kept my changes, but I don't use an ant script. That was before I found that the manual has a minor error in it. It says you can generate the WSDL using Java2WSDL from either a interface or a class, when in fact the parameter names will only be correctly generated if you provide a class compiled with debug info (-g). After this slight change in the way I create the WSDL, I no longer have to edit the parameter names.
Sandeep Bhagavatula
Greenhorn

Joined: Jul 25, 2004
Posts: 8
I compile the interface with javac -g option and run java2wsdl on it but it never picksup the parameter names correctly for me. What I was trying to say is that after I change all the parameter names manually and install it, and open the browser and append ?wsdl to url, it comes up with wsdl that has the same old parameter names. This makes me think that wsdl file is generated on the fly looking at wssd or the interface itself..
That aside, I have another problem. I have 5 web applications in all that get built when I run ant script. The webservices are implemented as a web application. After running ant I would uninstall the application that is already running on the server and deploy the newly built application. I donot know how to update the wsdd in webapp on my local machine irrespective of the server. In other words, I want to be able to deploy webservices similar to other applications without any extra steps. What I currently do is, I manually copy paste the wsdd file that is generated by wsdl2java task into wsdd file and then deploy the app. am I doing anything strange here
Sandeep Bhagavatula
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Sandeep Bhagavatula:
I want to be able to deploy webservices similar to other applications without any extra steps. What I currently do is, I manually copy paste the wsdd file that is generated by wsdl2java task into wsdd file and then deploy the app.

Why don't you let your Ant script invoke wsdl2java and add the .wsdd file into your .war file? At least the process would then be automated.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Bill Werth
Greenhorn

Joined: Jul 14, 2004
Posts: 5
I'm a newbie with web services, so I don't know much about deployment. I have been deploying mine by putting everything in a jar file, copying it to the lib directory, and then using adminclient to deploy it.

About the only thing I see that you are doing wrong is that when you create the WSDL, use a class file instead of an interface and the parameter names will be generated correctly. That way they will end up correct in the WSDD file too. You can tell Java2WSDL the correct class file to use with the -i parameter or just change your interface into a class with empty method bodies (that is what I did).
Sandeep Bhagavatula
Greenhorn

Joined: Jul 25, 2004
Posts: 8
Originally posted by Lasse Koskela:

Why don't you let your Ant script invoke wsdl2java and add the .wsdd file into your .war file? At least the process would then be automated.


I could do that but the problem is that I have three services one for authorization, one for validation and another for all the business methods. These are three different interfaces. So what I get is 3 different wsdd's that have to be merged in to one. I can do this too in ant script but should'nt AdminClient be able to take a local file name and do what is to be done...you know it just has to append this service description to the end of the file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generating WSDL