Installing Subversion on Windows (Client and Server)

Ok this was painful, so in order to save you some time (and pain) here’s a fairly straight forward step by step guide to get subversion up and running.  It’s only a basic install and doesn’t go into massive detail but should be just enought to get you started.

Just to give you an idea of envionments here and software used:

  • 2 PCs on the same domain, a dev PC and another PC acting as a server (used this just for testing but would be much the same process on Windows Server X).
  • Both PCs running Windows XP SP3.
  • Eclipse 3.3.2 (Europa).
  • Client side subversion Subclipse from Tigris.org and at the time of writing v1.6.17.  This is compatible with old and new versions of Eclipse (except Helios I think).  It will work with Europa, Callisto, Ganymede and Galileo.
  • Server side (also includes a client too but don’t worry about this) is from CollabNet – Subversion Server and Client v1.6.16 – click the download button – you may have to create an account with them, but it’s all free.

 

Client Install

1. In Eclipse go to Find and Install

2. Edit remote site like so:

You need to paste in the link URL:    http://subclipse.tigris.org/update_1.6.x

3. Select Subclipse as sites to update from and click Finish.

4.  If you are using Europa version of Eclipse you may also have to install Mylyn 3.0 before you can install Subclipse.

Server Install

This is just a PC with an IP address of 10.9.65.154.

1.  Download the Collabnet software as described above and double click the exe file to install.  You will see a screen like below – press Next.

2.  Skip past the View Latest Readme screen and Choose Components like below and press Next:

3. For svnserve Configuration I tend to change the Repository Path to something shorter like C:\svn, press Next:

4. For Apache Configuration, again change the Repository path to the shorter C:\svn, press Next.

5. At the Choose Install Location for the Subversion Server, install at the default location, press Next:

6.  The next screen is for Automatic Updates Configuration where you can choose to Enable update notifications for this Collabnet product and enter details if you are behind a proxy server:

 

7. The install will complete and finish with the following screen.  Click finish on the last screen:

8. Start the CollabNet Subversion svnserve service in Services:

9.  Then configure Collabnet Subversion Apache to run as Administrator to the local machine by right clicking, selecting Properties on the service.  Choose the radio button This account and edit the dialog like below, press OK, the start the service:

Create your first repository

1.  Open a command window and create your first repository by typing 

svnadmin create "C:\svn\repository"

2.  Navigate to that newly created directory and edit file svnserve.conf in conf folder.  Remove hash sign (#) with no leading spaces to the following:

anon-access = read
auth-access = write
password-db = passwd

Save the file and close.

3.  Open and edit file passwd.  Again, delete hash sign and add some users of your own if you like (<username> = <password>):

harry = harryssecret
sally = sallyssecret
simonearnshaw = wibble

4.  You can get really fancy and elaborate with users, groups and security.  I’ll leave that up to you, this configuration will just get you started.

5.  As subversion server operates on TCP port 3690 – you need to add this as an exception to the firewall.

Checking in your first project to Subversion from Eclipse

1. Go back to your dev PC, essentially the client.  Open Eclipse and make sure you are in SVN Repository Perspective.

2.  Now add a new SVN Repository to the view.  This relates to the command we issued on the server to create our first repository.  The protocol is svn://, and is followed by the servname or IP address.

3.  Go to your Java EE or Java persepective and right click one of your projects.  Select Team -> Share Project -> SVN -> Next.

4.  The next screen is Share Project with SVN Repository.  As we have already made a repository then we can select Use existing repository location:

5.   Leave the default, Use project name a folder name:

6.  At this point you should add comments – the comment “Initial import” is inserted as default, this is OK for our purpose so just press Finish.

7.  At this point you will be asked for your security credentials that you set up earlier in the Server section.

And that’s it you’re finished.  I hope you found this informative and useful. 

Advertisements
Installing Subversion on Windows (Client and Server)

A Simple SOAP Web Service Example in Eclipse (Ganymede)

Huh?  Not C#!!! – What’s all this “Rant in C Sharp” business then!?  Well, sometimes you have to be flexible in your job – well, lets just say we should be ‘language ambivalent’.

This is a VERY simple attempt to show show how to create a web service in Eclipse using Axis.  There is also some client code to show how you would interact with that web service.  For some reason I had to delve into a bazillion websites and scour a million books before I could make some sort of sense of it all – so just so you don’t have the same trouble – I have decided to publish it (well actually, it’s so that I don’t forget either).

Little disclaimer – I’m not saying that this is difinitive, I may be missing something, but it seems to work for me just now, and I haven’t gone into all the ‘bells and whistles’ of web services.  At the moment I’m writing down everything I learn and hopefully help others by sharing the knowledge.

(Using Java 1.5)

Create Basic Web Service

  1. Create new Dynamic Web Project.
  2. Create new Java class (call it “DoesMagic”).
  3. Add method like this (perhaps):
public class DoesMagic{
    public String doBasicStuff(String message)
    {
        return "This is your message: " + message;
    }
}

4. Right click on class you just made, New -> Other -> Web Services -> Web Service, you should get a form like the one below:

This will create all the necessary files to be able to publish your class as a web service.  If you want you can also create a client automatically by moving the slider – but what it generates may be hard to understand at first glance, so I have written a simple example of client code (see later on…).

5.  In order to run the web service – just,  Run as -> Run on Server.  Once the web service is running and alive on Tomcat – then we should be able to use it via some client code (see next bit).

Create Basic Web Service Client

Must create a project that has all the axis.jar type stuff in the WebContent folder – this can usually be made by generating a client application via the above wizard – you don’t have to use all the auto generated classes to access your web service, just do the following:

1.  Create a new Java Class – call it TestClient.

2.  Make it a main class, and enter the following code:


import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

public class TestClient {

public static void main(String [] args)
{
    try{
       String endpoint = "http://localhost:8080/TestWebService/services/DoesMagic";

       Service service = new Service();
       Call call = (Call) service.createCall();
       call.setTargetEndpointAddress( new java.net.URL(endpoint) );
       call.setOperationName( new QName("http://testPackage.fc.com", "doBasicStuff") );

       String ret = (String) call.invoke( new Object[] {"Hello World"} );
       System.out.println(ret);
       }
       catch(Exception e){
           System.err.println(e.toString());
       }
}
}

3.  Go to your web service project you made before and look at the source code for the wsdl file that has been created.  It’s in the folder WebContent -> wsdl.  Inside there you will find a wsdl that is the same name as your class.

4. You need to look at the wsdl and find the endpoint – which looks similar to:

"http://localhost:8080/TestWebService/services/DoesMagic"

and you need to get the namespace and the method name you want to invoke  (as shown above, should be in a very similar format).

5. In this case, when we get to the point that the call.invoke command is being issued it is casting the result to a String and we are sending in a String called “Hello World” – this should create a message in the console like “This is your message: Hello World”.

6. To test the class, just run the project as a Java Application and you should see the result in the Console printed out.

Conclusion

This is not indepth – this may not even be 100% correct, but it just gives you a taste of what can be achieved – it’s up to you now to read up more on Java Web Services.  Good luck !

PS – Take a sec just to vote whether this article helped you or not – see widget below.  If not, tell me what’t wrong with it and I’ll try and improve it.  I love feedback so I look forward to your comments!

A Simple SOAP Web Service Example in Eclipse (Ganymede)