Sunday, 4 November 2012

Using Abdera Client Creating Community in Ibm Connections 3,0

//Creating community pragmatically in Ibm Connections3.0 using abdera client


String communtiy_name="divine";//mention the name of the community
 Abdera abdera = new Abdera();
 AbderaClient client = new AbderaClient(abdera); //creating abdera client object
 try {//surround it with try and catch
 client.addCredentials(AuthScope.ANY_HOST, AuthScope.ANY_REALM,
 AuthScope.ANY_SCHEME, new UsernamePasswordCredentials("xxxx", "yyyy"));//pass your username and password
 System.out.println("After adding credentials");
 ClientResponse resp = client.get("   " title="https://x.y..com/communities/service/atom/communities/my");//title will be the post url
System.out.println("URI "+resp.getUri());
 Entry entry = abdera.newEntry();//creating an entry
 entry.setTitle(communtiy_name);//setting community title

 entry.setContentAsHtml("This is a practicse community");
 entry.addCategory("http://www.ibm.com/xmlns/prod/sn/type", (http://www.ibm.com/xmlns/prod/sn/type%22,) "community", "community");//specifying that it is a community
 System.out.println("XML as string is: "+entry.toString());//checking our entry
 resp = client.post(resp.getUri(), entry);//performing the post operation by passing the entry
 System.out.println("Status -->: "+resp.getStatusText()); //checking the status
 System.out.println("Response document is: "+resp.getDocument()); //getting the document if needed you can parse it using abdera you can see my next post for parsing using abdera

 }
 catch(Exception e)
 {
 e.printStackTrace();
 }
 

No comments:

Post a Comment

Custom single threaded java server

 package com.diffengine.csv; import java.io.*; import java.net.*; import java.util.Date; public class Server { public static void main(Str...