5

I have been asked to look at the build process of an existing service based application. It has several service based modules in which some of the services are provided by a 3rd party. The wsdls used in the build process are brought down and into the build via http. For competeness, I am using maven 3 and axistools-maven-plugin to generate the classes from the wsdl.

This started me thinking. If the remote server is down my build will fail. If the wsdl changes my build may also fail. Do I want this? The remote wsdls are versioned in the service/wsdl name, so no major changes should be made to the APIs, but they are 3rd party and I cant really rely on this convention.

Would it not be better to download the wsdl locally and build against a file that is under source control? I would have a proper repeatable build then with no danger of the remote server being unavailable. This doesnt seem very agile though. If I adopt this approach, how do I then become aware of any changes in the remote wsdl?

I'm sure I'm not the first person to wonder the best practice on building from wsdls. Can anybody highlight what mechanism is deemed the best pratice way to produce a repaeatable build from services generated from remote wsdls?

theINtoy
  • 3,388
  • 2
  • 37
  • 60
  • Might be better on programmers.stackexchange.com but its a good question. – Qwerky Dec 14 '12 at 11:06
  • Is the server offering the wsdl down so often someone actually noticed this or is it just a general thought? Sounds like an unreliable service :) I'm usually more worried about changes rather than downtimes. Just curious, because you mentioned downtimes first. – Scorpio Dec 14 '12 at 11:21
  • 1
    Its quite ok to keep a copy of the WSDL locally (as everyone is suggesting). The WSDL is a contract for the remote web service. It's completely normal for both parties to keep a copy of a contract especially to resolve later disputes when the contract is changed without consultation :-) – Mark O'Connor Dec 16 '12 at 20:42

3 Answers3

4

If you want fast and reliable builds then the golden rule is not to rely on anything you don't control!

In your case I would be caching the WSDL locally so that the build does not fail if the original source is unavailable or changes. However, if you are at all concerned that the WSDL might change, then I would also be creating a separate build job that runs each day and compares the cached copy with the original, failing if they are different. That gives you the best of both worlds... repeatable builds and early warning if the WSDL changes.

Where/how you cache the WSDL is entirely up to you, but sticking it in version control is a quick and simple option.

0

I would download the WSDL files and put them into source control with the rest of the project.

The main advantage is that it guarantees a repeatable build. If you download them on each build it is not repeatable. For example lets say you build and deploy to a dev or test environment, get the application signed off, then build and deploy to live. If the WSDL has changed, then your live build is different to what was signed off in test and may well work differently. If you have network comms issues then you might not even be able to build at all.

It means you won't automatically get the latest version of the WSDL, but that is a good thing.

Qwerky
  • 18,217
  • 6
  • 44
  • 80
  • I usually go with the same approach at client coding, ie local wsdl (+xsd, if any), yet I'm unhappy with it. Generally, I fear the unannounced wsdl or schema change. Just something to remember, although it *should* not *really* happen. – Scorpio Dec 14 '12 at 11:20
  • I am all for downloading the wsdl/xsds and storing them in source control. I think this gives me the repeatable build I crave. If I release software, say version 1.0.0, then changes to the wsdls cause a new build, I have to release 1.0.1 and I would store the wsdls/xsds with that build. My fear is as U-No-Poo suggests, by storing the wsdls I cant pick changes up during development. Is there a way to do this. i.e. have the perfect world? – theINtoy Dec 14 '12 at 11:59
0

If you know that the web service has a fixed wsdl, better use a local copy of it.

If the wsdl itself is likely to change, better use the url always for your build.

If network down is an issue, make two separate build profile(in maven), one for local and another for the url.

Mawia
  • 4,220
  • 13
  • 40
  • 55