Friday, July 29, 2011

Search your history on WEB

Go to following URL and type your name in search box and get your history on the WEB ,

Thursday, July 21, 2011

Creating a Jira Soap Client

Mainly there are two ways of remote accessing for JIRA instance either using SOAP or XML-RPC.But easy way is to use SOAP Api.Because Atlassian Pages supply a SOAP Interface to work with more operations on remote accessing.

So following are the steps for creating Jira Soap client.

step 1 :
To work with Soap client, First you have to enable JAVA and MAVEN2 on linux environment.For that open ~/.bashrc file in your home directory and set the following variables.

export JAVA_HOME=path to Java dir
export M2_HOME=path to Maven2 dir
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin

step 2 :
Then open a terminal and go to your project home directory.Then use following command to retrieve svn checkout from demo soap client distribution.

$ svn co http://svn.atlassian.com/svn/public/atlassian/rpc-jira-plugin/tags/atlassian_jira_4_1_1_1/jira-soapclient/

step 3 :
After that you must change the pom.xml of jira-soapclient project as follows,

<properties>
          <jira.soapclient.jiraurl>your_jira_url</jira.soapclient.jiraurl>
</properties>

Then add following repositories to pom.xml file.

<repositories>
      <repository>
         <id>atlassian</id>
         <name>Atlassian Repository</name>
         <url>https://maven.atlassian.com/content/groups/public</url>
      </repository>
    </repositories>


  <pluginRepositories>
       <pluginRepository>
                <id>atlassian</id>
                <name>Atlassian Repository</name>
                <url>https://maven.atlassian.com/content/groups/public</url>
       </pluginRepository>
   </pluginRepositories>



step 4 :
Then download the .WSDL file relevant to your jira instance to your project /src/main/wsdl directory using following command.

mvn -Pfetch-wsdl -Djira.soapclient.jiraurl=http://{your_jira_instance}/

step 5 :
After downloading .wsdl file, now generate/download all the dependencies(.jar s) and other needed classes for Soap client.run following,

mvn -Pbuildclient

step 6 :
Then create your jira-soapclient project as a Eclipse project or Idea project.use following,

mvn eclipse:eclipse        or     mvn idea:idea

and then using File -> import -> Existing project to workspace, import your project to Eclipse IDE.

step 7 :
Let's code the Jira Soap Client.
For that create your class in com.atlassian.jira_soapclient package and then try with following codes.

 //setting base URL
                String baseUrl="<your_jira_url>/rpc/soap/jirasoapservice-v2";

// get  handle to the JIRA SOAP Service from a client point of view
                SOAPSession soapSession = new SOAPSession(new URL(baseUrl));

//Connect to jira
                soapSession.connect(LOGIN_NAME, LOGIN_PASSWORD);

//JIRA SOAP Service, authentication token are used to make authentication calls
                JiraSoapService jiraSoapService = soapSession.getJiraSoapService();

                String authToken = soapSession.getAuthenticationToken();

step 8 :               
After getting authentication to the Jira system, then test the connection with retrieving all the project names under your jira system using following code samples. 

   List<String> names = new ArrayList<String>();

   RemoteProject[] Projects = jiraSoapService.getProjectsNoSchemes(authToken);

            for (RemoteProject project : Projects) {

                names.add(project.getKey());

            }
           
            System.out.print(names);

Then build project and check whether the code samples are working.If not don't forget to make a comment.Now you can also extend this using your functionalities And try to work with different code samples to be with Jira Soap Client practice.

So I think, this doc will become a nice tutorial for who are using JIRA SOAP CLIENT first time.