• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

approaches for web service development. how to extend web services (code-wsdl first approaches)

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Usually the web services are done either using the code-first approach, or using the contract(i.e.WSDL) first approach. Some times a mixture of both is used (if needed) I guess.
The problem I have is the following:
I have to work on a project that uses web services extensively. Specifically axis stack.
The project is, of course a version-ed project inside a version-ed base.
I am not sure how, would I start to understand the approach that has been used to build the various web services so far.
I mean some files are auto-generated while others are not, so I am not sure if the web services were done via the code-first approach or the wsdl first approach.
Also if I want to add new operations in the existing web services, doesn't this matter to me? I mean in WSDL first approach I would have to modify the wsdl. In code first, I would not.
I want to figure it out myself (before start asking questions to the web service implementers) but I am not sure how to approach this.
So what is the best approach to understand how a project using web services was done and how would I work on it?
Note:I am new in axis2 (but not in web services)
Any advice is highly welcome
Thank you for your time.
 
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jim,
I think you know the question you are asking is not specific to Axis2 but web services in general.

There are some of the hints you are apply to understand if a web service is created using top-down(WSDL2Java) or bottom-up(Java2WSDL) approach.

Hint1: If you are using any build script, check which task (WSDL2Java or Java2WSDL) is being called. If WSDL2Java, then it means WSDL should have been available first and vice-versa.

Hint2: Check the existing Java POJO classes referred from WSDL (like java beans and exception classes). The structure of these classes should give an indication if they have been generated by web services API or hand-made.

Also, as you said you wanted to create new web services. It doesn't really matter which approach you are using.
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Naren,

When I said I wanted to create new web services, I used wrong phrasing. I edited my post.
What I meant was I need to add new operations in the existing services (i.e. ports).
So my concern is whether I should modify the WSDL to add the new operations or not.
 
Naren Chivukula
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, in that case without necessarily needing to know which approach has been used so far, you can do in either way. But, if you are particular then one of my hints might help.
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Okay, in that case without necessarily needing to know which approach has been used so far, you can do in either way


If the current services were auto-generated by WSDL, and I add a service (or operation) starting from code, then I also need to manually modify the WSDL right? Since I can not use WSDL auto-generation
If the current services were created code-first, then I write the code and regenerate the WSDL
So it is seems to me, that it is not straightforward to do by just choosing either way.
Right?
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My concern is, since it is a versioned project if I do it the wrong way I may not update a file and break something
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
It is quite simple, regardless of which approach you use:
As long as you only add things to your WSDL and XML schemas, old clients will be able to communicate with your service.
As soon as you remove something or change something in the WSDL or XML schemas you will break old clients.
In cases like this, the WSDL-first approach is much simpler than code-first, but this does not mean that code-first is impossible.
You just have to compare the new generated WSDL against the old and be very careful. It may also result in tedious tweaking of the code, using annotations etc etc, in order to generate a WSDL that can be accepted by old clients.
Best wishes!
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

compare the new generated WSDL against the old and be very careful


Is this best done by a tool? WinMerge is hard to use for WSDL. Is there a similar tool for comparison?Because doing it manually for non-trivial WSDL is a real headache
 
Naren Chivukula
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you not using any tool to generate code or WSDL? Are you going to do entirely manually? If so, what are the problems in using a tool like Axis2, which you said. As long as you don't modify existing stuff within Java artefacts or WSDL, you don't need to worry about affecting existing services by adding new ones.
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Naren,

As I mentioned the project is in version base. It is not easy to just regenerate everything. I have to know which files I have to checkout etc.
I thought that for adding new operations it might be faster and less error prone to modify WSDL as Ivan mentions.
 
Naren Chivukula
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jim,

I thought that for adding new operations it might be faster and less error prone to modify WSDL as Ivan mentions.


To be honest, I don't see any reason why one approach is better than other in this particular case. Each has some work to do.

If you manually change WSDL, you have to validate it and re-generate your server side artefacts. Needless to say, you also have to provide implementation code for the operations you add in WSDL.

If you first manually add implementation code for the operation you wish you add in WSDL, then you can regenerate WSDL, which will be bug free (taking into account of web service implementors who you said might not have to worry about WSDL complexities). This will also update your web service interface classes with new operations.

It's upto your discretion which approach to pick up. Good luck!
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Note that you can maintain an existing WSDL and have a web service endpoint implemented in Java use the existing WSDL.
At least this is possible with JAX-WS.
This way you can hopefully avoid comparing automatically generated WSDLs.
If you choose this option, I would stress the usefulness of automated tests that makes sure the WSDL and the implementation are working as expected.
Best wishes!
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ivan and Naren thank you both for your help!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic