This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Services and the fly likes wsdl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "wsdl" Watch "wsdl" New topic
Author

wsdl

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 375
new to web service. when developing a web service application, usually how do we come up with a wsdl file ? do we usually first write a java code then convert it to wsdl using tool or what ? does it make sense to create a wsdl first without using any java code ? -- assuming I am using java lang for WS.
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

It is always a good practice to start with WSDL first to make sure that your WSDL is more interoperable.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I remember when I started looking at SOAP web services and WSDLs. At that time, I thought WSDLs were slightly frightening and difficult to grasp.
Despite the experience I have gained, I still do not sit down and write a WSDL document from scratch, so I am going to suggest a slightly more convenient approach to WSDL-first web service development. I call this method "WSDL first with Some Java in the Beginning".
- Write a Java class representing the endpoint implementation class, but that only contains empty methods, that is, methods with no code (except for perhaps returning null or zero values as the result of the methods).
This class is to be annotated with all the appropriate web service annotations.
- If any bean classes are needed to pass information to, or return information from, methods in the class in the previous step then implement these.
- Use wsgen to generate a WSDL document from the Java class in the previous step.
- Manually edit the generated WSDL document and customize it as desired.
- Use the WS-I Basic Profile tool to verify that the WSDL complies with the WS-I Basic Profile.
This tool can be downloaded freely from: http://www.ws-i.org/deliverables/workinggroup.aspx?wg=testingtools
- Delete all the Java code written in the first two steps.
- Use wsimport to generate server side artifacts from the WSDL.
- Fill in the implementation of the different methods in the endpoint implementation class generated in the previous step.
- Use wsimport to generate client side artifacts from the WSDL.
- Implement a client using the artifacts generated in the previous step.
Best wishes!
ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 375
Thanks Ivan. What do I need to install to get this "wsimport" tool ?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Both wsimport and wsgen are part of the standard JDK as per version 1.6, so if you have it installed, then no additional installs are needed.
They are also present in GlassFish, in the bin directory in the installation directory.
Best wishes!
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
ben oliver wrote:new to web service. when developing a web service application, usually how do we come up with a wsdl file ? do we usually first write a java code then convert it to wsdl using tool or what ? does it make sense to create a wsdl first without using any java code ? -- assuming I am using java lang for WS.


It's a big question. Quite often it's referred to as Top Down or Bottom up approach. For example, in WebSphere, please look at sections 17 (JAXB - Top down) and 21 (JAXB - Bottom-up).

You can also Google for something like bottom up wsdl or top down interface.

Regards,
Dan





William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wsdl