Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wsdl

 
ben oliver
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is always a good practice to start with WSDL first to make sure that your WSDL is more interoperable.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan. What do I need to install to get this "wsimport" tool ?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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




 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic