<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DkQDSXk4cCp7ImA9WhRbGU8.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159</id><updated>2012-02-10T17:39:38.738-08:00</updated><category term="developmentmode" /><category term="personalizationconcept" /><category term="clustering" /><category term="ExternalizeResourceSecurity" /><category term="wsadmin" /><category term="lookaside" /><category term="tunningwas" /><category term="sitemanagement" /><category term="wasndruntimearchitecture" /><category term="sessionaffinity" /><category term="WASPMI" /><category term="blazeds" /><category term="pack" /><category term="xmlaccesscopyresource" /><category term="ffdctool" /><category term="loginfilters" /><category term="webserver" /><category term="wcmmigration" /><category term="impersonation70" /><category term="JMS" /><category term="portletlifecycle" /><category term="mashup" /><category term="EstablishSSO" /><category term="describefederatedrepository" /><category term="rememberme" /><category term="portletloadmonitoring" /><category term="ajaxperformance" /><category term="createprofile" /><category term="ehancedportaltheme" /><category term="webdav" /><category term="deregisteringusersandgroup" /><category term="processerverintegration" /><category term="singlecluster" /><category term="lcconfigureadmin" /><category term="installingportlet" /><category term="databaseclustering" /><category term="iwidget" /><category term="utilizeportalscriptinginterface" /><category term="tuningdatasource" /><category term="wps70admin" /><category term="impersonation" /><category term="loginportlet" /><category term="portletfilter" /><category term="virtualportal" /><category term="pumasample" /><category term="usetracefacility" /><category term="rest" /><category term="enableclientsidelogging" /><category term="IntegrateExternalizeResourceSecurity" /><category term="dojo" /><category term="annotation" /><category term="portalstyleclasses" /><category term="themecustomizer" /><category term="userinformation" /><category term="wastroubleshooting" /><category term="rad8" /><category term="portalconfigwizard" /><category term="clientsideapi" /><category term="j2ee6" /><category term="wsrp" /><category term="enablesecrurity" /><category term="csatheme" /><category term="PortalScriptingInterface" /><category term="wps70" /><category term="lcdeploywidget" /><category term="j2c" /><category term="rafw" /><category term="buildscript" /><category term="portletevent" /><category term="xmlaccessresourcemodify" /><category term="replicationincluster" /><category term="ModifyPortalURI" /><category term="tracestrings" /><category term="Managedeploymentandremovalofportletapplication" /><category term="loganalyzer" /><category term="attributebasedadministration" /><category term="lcajaxproxy" /><category term="dijitwebsphereportal" /><category term="managingreplication" /><category term="csptools" /><category term="administersearch" /><category term="portletincluster" /><category term="webcaching" /><category term="classloader" /><category term="rad" /><category term="plugin" /><category term="portletcontainerinwas" /><category term="portletmode" /><category term="personalization" /><category term="tuning" /><category term="whatsnewinwas7" /><category term="configurationtemplate" /><category term="verticalclustering" /><category term="configurepagelayout" /><category term="Copyportletandportletapplication" /><category term="wps70dev" /><category term="troubleshootinstallationissues" /><category term="systemeventlogging" /><category term="portalsiteoptimization" /><category term="sessionmanagement" /><category term="installoptions" /><category term="implementingcluster" /><category term="lcadminhomepage" /><category term="sslmanagement" /><category term="securitypolicy" /><category term="pumaspi" /><category term="spi" /><category term="migration" /><category term="lcbranding" /><category term="managewebserverinmanagedunmanagedmode" /><category term="dynamiccaching" /><category term="loginservice" /><category term="etag" /><category term="nodefederation." /><category term="skin" /><category term="delegatedadministration" /><category term="createcluster" /><category term="ccavsssa" /><category term="caching" /><category term="applicationserverlogs" /><category term="Administerparallelportletrendering" /><category term="MemberFixer" /><category term="applicationobject" /><category term="applicationperformanceconsiderations" /><category term="xmlaccessvswpscript" /><category term="newfeaturesinwsrp2.0" /><category term="webappintegration" /><category term="implementcustomuniquename" /><category term="urlmapping" /><category term="hangdetection" /><category term="enablerapi" /><category term="portalwebsiteoptimization" /><category term="EnableSSL" /><category term="installlationfactory" /><category term="deletepage" /><category term="was7" /><category term="understandportalproperties" /><category term="UsersGroups" /><category term="utilizecommandline" /><category term="dumpnamespace" /><category term="replicationdomain" /><category term="popup" /><category term="realm" /><category term="profiles" /><category term="servlet3" /><category term="spring" /><category term="websiteoptimization" /><category term="securityincluster" /><category term="persontag" /><category term="lotusconnections" /><category term="was8" /><category term="performance" /><category term="eclipse" /><category term="definejdbcanddatasource" /><category term="IBMSupportassistance" /><category term="asa" /><category term="ajaxproxy" /><category term="XMLAccess" /><category term="siteanalytics" /><category term="connectionapi" /><category term="ncsa" /><category term="security" /><category term="lcsynchronizeldap" /><category term="troubleshootingxmlaccess" /><category term="threaddumpanalyzer" /><category term="managepluginconfiguration" /><category term="wasinstallation" /><category term="filter" /><category term="performanceadvisor" /><category term="dynamicclustering" /><category term="deletingorphanedata" /><category term="basicauthentication" /><category term="silentinstall" /><category term="configurationtask" /><category term="jpa" /><category term="configurewsrp" /><category term="adobeflex" /><category term="geographydeployed" /><category term="restspi" /><category term="wsrpsecurity" /><category term="theme70" /><category term="forcessa" /><category term="cpi" /><category term="flexdevelopment" /><category term="verifyinstallation" /><category term="architecture" /><category term="lcbrowsercaching" /><category term="tpv" /><category term="releasebuilder" /><category term="portleturlgeneration" /><category term="keepalive" /><category term="configurelocking" /><category term="shrinksafe" /><category term="pagebuildertheme" /><category term="deploymentservice" /><category term="monitorsizeoflogfiles" /><category term="ConfigureCooperativePortlets" /><category term="packagej2eeapplication" /><category term="jvmtroubleshooting" /><category term="adminsecrutiy" /><category term="implementsecuritypolicy" /><category term="wps615" /><category term="wasextensions" /><category term="webservicecert" /><category term="sip" /><category term="gzip" /><category term="portalspi" /><category term="PortalAccessControl" /><category term="ldap" /><category term="clientsideaggregation" /><category term="collaborativeservice" /><category term="implementfederatedrepository" /><category term="multiplecluster" /><category term="webspherecomponents" /><category term="jaxrs" /><category term="administerpersonalization" /><category term="pagebuilder2" /><category term="UnderstandLTPAcookies" /><category term="googlegadget" /><category term="database" /><category term="clientsideperformance" /><category term="friendlyurl" /><category term="testdrivendevelopment" /><category term="nameservicemanagement" /><category term="minification" /><category term="portletpmi" /><category term="manageusergroup" /><category term="apachehttpserver" /><category term="lceditingconfigfiles" /><category term="wsadminvswpscript" /><category term="federatedrepository" /><category term="lotusconnection" /><category term="wlmandfailover" /><category term="lotusconnection3" /><category term="jsr286" /><category term="AdministerPageSecurity" /><category term="stepupauthentication" /><category term="backupconfig" /><category term="configureandreviewlogs" /><category term="themeinear" /><category term="tdi" /><category term="sitewizard" /><category term="jmeter" /><category term="securingwsrpproducer" /><category term="cooperativeportlet" /><category term="UtilizeLogFortroubleshootin" /><category term="servicelogs" /><category term="developmentenv" /><category term="applicationsecurity" /><category term="businessprocessintergation" /><category term="springportletmvc" /><category term="businesssolutioncatalog" /><category term="jaxr" /><category term="ndclustering" /><category term="sharedlib" /><category term="LogsForTroubleshootinInstallationIssues" /><category term="startstopportalserver" /><category term="portletmvc" /><category term="securityrole" /><category term="portletcss" /><title>WebSphere Notes</title><subtitle type="html">My study notes for both WebSphere Application Server and WebSphere Portal Server</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://wpcertification.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>931</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/WebspherePortalCertification" /><feedburner:info uri="websphereportalcertification" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>WebspherePortalCertification</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;CEICQXo6fSp7ImA9WhRUE0o.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-8759810074953250301</id><published>2012-01-23T18:36:00.000-08:00</published><updated>2012-01-23T18:36:00.415-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-23T18:36:00.415-08:00</app:edited><title>Performance monitoring of portlet</title><content type="html">One of the common requirement that i hear is how  do i monitor performance of my portlets and get some useful information when the portlet is misbehaving. I used the concept of &lt;a href='http://wpcertification.blogspot.com/2010/11/applying-global-filter-to-all-portlets.html'&gt;Global Filters&lt;/a&gt; to create a filter that will monitor all your portlets (render, resource, action and Event phase) and write a message in the log if one of the method takes more than the threshold time. You can download the performance filter code from &lt;a href='http://www.box.net/shared/2oykoex1hh'&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is how one of the doFilter() method of PerformanceFilter looks like &lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;public void doFilter(RenderRequest request, RenderResponse response,FilterChain filterChain) &lt;br /&gt;throws IOException, PortletException {&lt;br /&gt;  long beforeTime = System.currentTimeMillis();&lt;br /&gt;  filterChain.doFilter(request, response);&lt;br /&gt;  long afterTime = System.currentTimeMillis();&lt;br /&gt;  long executionTime = (afterTime - beforeTime)/100;&lt;br /&gt;  System.out.println("Time for execution " + executionTime);&lt;br /&gt;  if(executionTime &gt; debugThreshold){&lt;br /&gt;    Map&lt;String,String&gt; portletInfoMap = getCurrentPortletInfo(request.getWindowID(),&lt;br /&gt;(ServletRequest)request, (ServletResponse)response);&lt;br /&gt;    portletInfoMap.put("PORTLET_METHOD", "render");&lt;br /&gt;    portletInfoMap.put("PORTLET_EXECUTIONTIME", Long.toString(executionTime));&lt;br /&gt;    printDebugInformation(request, response,portletInfoMap);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In the doFilter() method i am taking the time before and after i forwarded control up the chain and using that time to calculate execution time. If the execution time is more than threshold then i am printing debug information. In my simple filter i am only printing request parameter, but you can print all the information that you want ex. portlet prefrences, portlet session information... &lt;br /&gt;&lt;br /&gt;Since this is a Global Filter i have a plugin.xml file which looks like this &lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;?eclipse version="3.0"?&amp;gt;&lt;br /&gt;&amp;lt;plugin id="com.webspherenotes.filter.performancemonitorfilter" name="WS_Server" &lt;br /&gt;provider-name="IBM" version="2.0.0"&amp;gt;&lt;br /&gt;  &amp;lt;extension point="com.ibm.ws.portletcontainer.portlet-filter-config"&amp;gt;&lt;br /&gt;    &amp;lt;portlet-filter-config &lt;br /&gt;class-name="com.webspherenotes.portlet.PerformanceMonitorFilter" order="99"&amp;gt;&lt;br /&gt; &amp;lt;description&amp;gt; Performance Filter, order = 102 &amp;lt;/description&amp;gt;&lt;br /&gt; &amp;lt;lifecycle&amp;gt;RENDER_PHASE&amp;lt;/lifecycle&amp;gt;&lt;br /&gt; &amp;lt;lifecycle&amp;gt;RESOURCE_PHASE&amp;lt;/lifecycle&amp;gt;&lt;br /&gt; &amp;lt;lifecycle&amp;gt;ACTION_PHASE&amp;lt;/lifecycle&amp;gt;&lt;br /&gt; &amp;lt;lifecycle&amp;gt;EVENT_PHASE&amp;lt;/lifecycle&amp;gt;&lt;br /&gt;&lt;b&gt; &amp;lt;init-param&amp;gt;&lt;br /&gt;      &amp;lt;name&amp;gt;DEBUG_THRESHOLD&amp;lt;/name&amp;gt;&lt;br /&gt;   &amp;lt;value&amp;gt;1&amp;lt;/value&amp;gt;&lt;br /&gt; &amp;lt;/init-param&amp;gt;&lt;/b&gt;&lt;br /&gt;   &amp;lt;/portlet-filter-config&amp;gt;&lt;br /&gt;    &amp;lt;/extension&amp;gt;&lt;br /&gt;&amp;lt;/plugin&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I am reading value of DEBUG_THRESHOLD input parameter from plugin.xml and using it to decide when should i generate debug log. In my case if the portlet takes more than 1 second to respond then i am generating log. This is how a sample log looks like&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt; ****Problematic portlet found ****&lt;br /&gt; Page -&gt; wps.LoginPorltet Name -&gt; wps.p.Login Method -&gt; render Took 7&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-8759810074953250301?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/g2Q1wvQ9758" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/8759810074953250301/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=8759810074953250301" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8759810074953250301?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8759810074953250301?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/g2Q1wvQ9758/performance-monitoring-of-portlet.html" title="Performance monitoring of portlet" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2010/11/performance-monitoring-of-portlet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUYMSHg5fip7ImA9WhRUEkw.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-8714065913664457590</id><published>2012-01-21T23:26:00.000-08:00</published><updated>2012-01-21T23:26:29.626-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-21T23:26:29.626-08:00</app:edited><title>Accessing JPA from JAX-RS service directly</title><content type="html">I wanted to create a REST service that uses JPA bean and i wanted to see if i can do that without using a EJB and these are my notes about how to do that. You can download the sample application from &lt;a href='http://www.box.com/s/qilysbvkxsmmmlfb3cnl'&gt;here&lt;/a&gt;. I am using JEE 6 compliant Websphere application Server for testing this code.

First i did create the Contact.java which is my JPA entity like this
&lt;pre&gt;&lt;code&gt;
package com.webspherenotes.jpa;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;


/**
 * The persistent class for the CONTACT database table.
 * 
 */
@Entity
@XmlRootElement
public class Contact implements Serializable {
  private static final long serialVersionUID = 1L;

  @Id
  private int contactid;

  private String email;

  private String firstname;

  private String lastname;

    public Contact() {
    }

  public int getContactid() {
    return this.contactid;
  }

  public void setContactid(int contactid) {
    this.contactid = contactid;
  }

  public String getEmail() {
    return this.email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

  public String getFirstname() {
    return this.firstname;
  }

  public void setFirstname(String firstname) {
    this.firstname = firstname;
  }

  public String getLastname() {
    return this.lastname;
  }

  public void setLastname(String lastname) {
    this.lastname = lastname;
  }

}
&lt;/code&gt;&lt;/pre&gt;

Next i had to create a persistence.xml file like this in the META-INF folder like this
&lt;pre&gt;&lt;code&gt;
&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"&amp;gt;
  &amp;lt;persistence-unit name="MyJPAJAXRS"&amp;gt;
    &amp;lt;jta-data-source&amp;gt;jdbc/demodb&amp;lt;/jta-data-source&amp;gt;
    &amp;lt;class&amp;gt;com.webspherenotes.jpa.Contact&amp;lt;/class&amp;gt;
  &amp;lt;/persistence-unit&amp;gt;
&amp;lt;/persistence&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

As you can see from my persistence.xml my application has only one entity which is Contact.java.

Next declare the &lt;code&gt;persistence-context-ref&lt;/code&gt; in the web.xml file like this 
&lt;pre&gt;&lt;code&gt;
&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&amp;gt;
  &amp;lt;display-name&amp;gt;MyJPAJAXRS&amp;lt;/display-name&amp;gt;
  &amp;lt;welcome-file-list&amp;gt;
    &amp;lt;welcome-file&amp;gt;index.html&amp;lt;/welcome-file&amp;gt;
    &amp;lt;welcome-file&amp;gt;index.htm&amp;lt;/welcome-file&amp;gt;
    &amp;lt;welcome-file&amp;gt;index.jsp&amp;lt;/welcome-file&amp;gt;
    &amp;lt;welcome-file&amp;gt;default.html&amp;lt;/welcome-file&amp;gt;
    &amp;lt;welcome-file&amp;gt;default.htm&amp;lt;/welcome-file&amp;gt;
    &amp;lt;welcome-file&amp;gt;default.jsp&amp;lt;/welcome-file&amp;gt;
  &amp;lt;/welcome-file-list&amp;gt;
  &lt;b&gt;&amp;lt;persistence-context-ref&amp;gt;
    &amp;lt;persistence-context-ref-name&amp;gt;
      MyJPAJAXRS
    &amp;lt;/persistence-context-ref-name&amp;gt;
    &amp;lt;persistence-unit-name&amp;gt;MyJPAJAXRS&amp;lt;/persistence-unit-name&amp;gt;
    &amp;lt;persistence-context-type&amp;gt;Transaction&amp;lt;/persistence-context-type&amp;gt;
  &amp;lt;/persistence-context-ref&amp;gt;&lt;/b&gt;
&amp;lt;/web-app&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

This is how my REST service looks like, note that you cannot inject EntityManager directly in your REST service class because your creating object of the REST service class in Application object instead of container creating it, so you would have to do some more work to look up the &lt;code&gt;EntityManager&lt;/code&gt; in the init method of the REST service class like this
&lt;pre&gt;&lt;code&gt;
package com.webspherenotes.jpa;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/contact")
public class ContactService {
  
  @PersistenceContext(name="MyJPAJAXRS")
  EntityManager entityManager;
  
  &lt;b&gt;@PostConstruct
  public void init(){
    System.out.println("Entering ContactService.init()");
    try {
      InitialContext context = new InitialContext();
      entityManager = (EntityManager)context.lookup("java:comp/env/MyJPAJAXRS");
      System.out.println("Object of mySessionBeanLocal " + entityManager);
    } catch (NamingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    System.out.println("Exiting ContactService.init()");
  }&lt;/b&gt;

  @GET
  @Produces(MediaType.APPLICATION_XML)
  public List&lt;Contact&gt; getContactList(){
    System.out.println("Inside ContactService.getContactList() " );
    Query q = entityManager.createQuery("SELECT x from Contact x");
  
    return (List&lt;Contact&gt;)q.getResultList();
  }

  @POST
  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
  @Produces(MediaType.APPLICATION_XML)
  public Contact insertContact(@FormParam("contactId")int contactId,@FormParam("firstName")
  String firstName,
      @FormParam("lastName")String lastName,@FormParam("email") String email) {
    Contact contact = new Contact();
    contact.setContactid(contactId);
    contact.setFirstname(firstName);
    contact.setLastname(lastName);
    contact.setEmail(email);
    entityManager.persist(contact);
    return contact;
  }
  
  @GET
  @Path("/{contactId}")
  @Produces(MediaType.APPLICATION_XML)
  public Contact getContact(@PathParam("contactId")int contactId) {
    Contact contact = entityManager.find(Contact.class, contactId);
    return contact;
  }

  @PUT
  @Path("/{contactId}")
  @Produces(MediaType.APPLICATION_XML)
  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
  public Contact updateContact(@PathParam("contactId")int contactId,@FormParam("firstName") 
  String firstName,
      @FormParam("lastName")String lastName,@FormParam("email") String email) {
    Contact contact = new Contact();
    contact.setContactid(contactId);
    contact.setFirstname(firstName);
    contact.setLastname(lastName);
    contact.setEmail(email);
    entityManager.merge(contact);
    return contact;
  }
  @DELETE
  @Path("/{contactId}")
  public void deleteContact(@PathParam("contactId")int contactId) {
    Contact contact = new Contact();
    contact.setContactid(contactId);
    entityManager.remove(contact);
  }
  
  
}

&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-8714065913664457590?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/Ltq-fJPnpWA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/8714065913664457590/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=8714065913664457590" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8714065913664457590?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8714065913664457590?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/Ltq-fJPnpWA/accessing-jpa-from-jax-rs-service.html" title="Accessing JPA from JAX-RS service directly" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2012/01/accessing-jpa-from-jax-rs-service.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QCSHo-cSp7ImA9WhRUEkw.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-4439803459688501007</id><published>2012-01-21T22:56:00.000-08:00</published><updated>2012-01-21T22:56:09.459-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-21T22:56:09.459-08:00</app:edited><title>Using JAMON for monitoring REST service</title><content type="html">&lt;a href='http://jamonapi.sourceforge.net/'&gt;JAMON&lt;/a&gt; is very nice and powerful performance monitoring tool. You can use it to monitor performance of java program. I wanted to monitor performance of a REST service so i built this generic purpose filter that any one can use. Once installed it generates performance stats like this. You can download the sample code from &lt;a href='http://www.box.com/s/euzk3hxkgkz68c3ylkk5'&gt;here&lt;/a&gt;

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-SuwEVKYhnhw/TxuvuGDChCI/AAAAAAAAB0A/GCXAl1Z4tTg/s1600/Snap%2B2012-01-21%2Bat%2B22.29.48.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="204" width="400" src="http://4.bp.blogspot.com/-SuwEVKYhnhw/TxuvuGDChCI/AAAAAAAAB0A/GCXAl1Z4tTg/s400/Snap%2B2012-01-21%2Bat%2B22.29.48.png" /&gt;&lt;/a&gt;&lt;/div&gt;

I followed these steps to create the filter

&lt;ol&gt;
&lt;li&gt;First download the JAMON binaries from &lt;a href='http://jamonapi.sourceforge.net/'&gt;AMON home page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Expand the binaries and copy the jamon.jar file in the shared library of your application server&lt;/li&gt;
&lt;li&gt;Next install jamon.war which is web application that ships with jamon binary and provides a UI to look at the stats. The screen shot that you see is taken using jamon.war&lt;/li&gt;
&lt;li&gt; I already have a REST service that exposes a CONTACT table as a resource, it provides GET, POST, PUT and DELETE operations on the Contact resource&lt;/li&gt;
&lt;li&gt; For the JAMON monitoring part i did create this simple filter 
&lt;pre&gt;&lt;code&gt;
package com.webspherenotes.performance.filter;

import java.io.IOException;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;

import com.jamonapi.Monitor;
import com.jamonapi.MonitorFactory;

/**
 * Servlet Filter implementation class RESTServiceJAMONFilter
 */
@WebFilter(dispatcherTypes = {DispatcherType.REQUEST }
          , urlPatterns = { "/*" })
public class RESTServiceJAMONFilter implements Filter {

    public RESTServiceJAMONFilter() {
        // TODO Auto-generated constructor stub
    }

  public void destroy() {
    // TODO Auto-generated method stub
  }

  /**
   * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
   */
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 
  throws IOException, ServletException {

    HttpServletRequest httpServletRequest= (HttpServletRequest)request;
   &lt;b&gt; Monitor monitor = MonitorFactory.start(RESTCacheKeyBuilder.buildCacheKey(httpServletRequest));
    chain.doFilter(request, response);
    monitor.stop();&lt;/b&gt;
  }

  public void init(FilterConfig fConfig) throws ServletException {
    // TODO Auto-generated method stub
  }

}
&lt;/code&gt;&lt;/pre&gt;
Inside the filter i start a monitor before passing control up the filter chain and i stop the JAMON monitor once the request is completed, that's all that you have to do to create and record JAMON monitor. You might notice that while starting filter i am calling &lt;code&gt;RESTCacheKeyBuilder.buildCacheKey(httpServletRequest)&lt;/code&gt; , this class takes care of creating the monitor key Ex.GET - &lt;code&gt;/JAMONRESTService/rest/contact/xxx&lt;/code&gt; is the key that gets created when you call the service by invoking &lt;code&gt;http://localhost:9080/JAMONRESTService/rest/contact/21&lt;/code&gt; url
&lt;/li&gt;
&lt;li&gt;This is how my key builder looks like
&lt;pre&gt;&lt;code&gt;
package com.webspherenotes.performance.filter;

import javax.servlet.http.HttpServletRequest;

public class RESTCacheKeyBuilder {
  
  public static String buildCacheKey(HttpServletRequest request){
    StringBuilder cacheKeyBuilder = new StringBuilder();
    cacheKeyBuilder.append(request.getMethod());
    cacheKeyBuilder.append(" - ");
    cacheKeyBuilder.append(request.getContextPath());
    cacheKeyBuilder.append(request.getServletPath());
    cacheKeyBuilder.append(request.getPathInfo());
    String cacheKey = cacheKeyBuilder.toString();
    System.out.println("Cache Key " + cacheKey);
    cacheKey = cacheKey.replaceAll("[0-9]+", "xxx");
    System.out.println("After replacing digits " + cacheKey);
    return cacheKey;
  }
}
&lt;/code&gt;&lt;/pre&gt;
Its very simple, all it does is adds the HTTP method name for the call and the URL for the call, i am replacing all the numbers with xxx. So that the calls for same resource generates same key. Ex. &lt;code&gt;/JAMONRESTService/rest/contact/xxx&lt;/code&gt; key would get generated for &lt;code&gt;http://localhost:9080/JAMONRESTService/rest/contact/22&lt;/code&gt; &lt;code&gt;http://localhost:9080/JAMONRESTService/rest/contact/2&lt;/code&gt; &lt;code&gt;http://localhost:9080/JAMONRESTService/rest/contact/210&lt;/code&gt;  and as a result i can see how is my GET call on CONTACT resource doing
&lt;/li&gt;
&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-4439803459688501007?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/O6klwnWpnu4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/4439803459688501007/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=4439803459688501007" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/4439803459688501007?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/4439803459688501007?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/O6klwnWpnu4/using-jamon-for-monitoring-rest-service.html" title="Using JAMON for monitoring REST service" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-SuwEVKYhnhw/TxuvuGDChCI/AAAAAAAAB0A/GCXAl1Z4tTg/s72-c/Snap%2B2012-01-21%2Bat%2B22.29.48.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2012/01/using-jamon-for-monitoring-rest-service.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4NRno9eyp7ImA9WhRVF0o.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-8787699839161628370</id><published>2012-01-16T21:26:00.000-08:00</published><updated>2012-01-16T21:26:37.463-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-16T21:26:37.463-08:00</app:edited><title>Using DynaCache as Cache Implementation in Hibernate</title><content type="html">Hibernate makes it very easy for us to use caching framework of our own choice. Now if you know the application that your developing is going to be deployed in WebSphere Application Server, then you might want to use the &lt;a href='http://wpcertification.blogspot.com/search/label/dynamiccaching'&gt;DynaCache&lt;/a&gt; caching framework which ships with IBM WebSphere Application Server. I wanted to try that so i did create this sample application that talks to database using Hibernate and makes use of DynaCache for caching. You can download the sample application from &lt;a href='http://www.box.com/s/51s4j505a1y3t1xe6a2c'&gt;here&lt;/a&gt; 

In order to ask Hibernate to use DynaCache as caching implementation first thing that you will have to do is create a class that implements &lt;code&gt;org.hibernate.cache.CacheProvider&lt;/code&gt; interface, this interface gets invoked whenever Hibernate wants to initialize cache for particular region.
&lt;pre&gt;&lt;code&gt;
package com.webspherenotes.hibernate.cache;

import java.util.Date;
import java.util.Properties;

import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.hibernate.cache.Cache;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.CacheProvider;

import com.ibm.websphere.cache.DistributedMap;

public class DynaCacheProvider implements CacheProvider {

  public DynaCacheProvider() throws NamingException {
    System.out.println("Entering DynaCacheProvider() constructor");

  }

  &lt;b&gt;public Cache buildCache(String regionName, Properties properties)
      throws CacheException {
    System.out.println("Inside DynaCacheProvider.buildCache " + regionName);
    
    String cacheInstanceJNDIName =(String) properties.get(regionName);
    
    if(cacheInstanceJNDIName == null){
      cacheInstanceJNDIName = (String) properties.get("dynacache.default.cacheinstancename");
      if(cacheInstanceJNDIName == null){
        cacheInstanceJNDIName = "services/cache/distributedmap";
      }  
    }
    System.out.println("Cache instance JNDI name " + cacheInstanceJNDIName);
    DistributedMap distributedMap;
    DynaCache cache = null;
    try {
      InitialContext ic = new InitialContext();
      distributedMap = (DistributedMap) ic.lookup(cacheInstanceJNDIName);
      System.out.println("DistributedMap found in JNDI " + distributedMap);
      cache = new DynaCache(distributedMap, regionName);
    } catch (NamingException e) {
      e.printStackTrace(System.out);
    }


    return cache;
  }&lt;/b&gt;

  public boolean isMinimalPutsEnabledByDefault() {
    return false;
  }

  public long nextTimestamp() {
    return new Date().getTime();
  }

  public void start(Properties properties) throws CacheException {
  }

  public void stop() {
  }

}
&lt;/code&gt;&lt;/pre&gt;
,.
The &lt;code&gt;buildCache&lt;/code&gt; method is responsible for returning object of class implementing &lt;code&gt;org.hibernate.cache.Cache&lt;/code&gt; interface that should be used for caching objects for this region. In my case i want to have granular control on which DynaCache instance should be used to store the cached object. The rule goes like this
&lt;ol&gt;
&lt;li&gt;First check if there is region specific instance, if yes use that&lt;/li&gt;
&lt;li&gt; If there is no region specific instance check the value of &lt;code&gt;dynacache.default.cacheinstancename&lt;/code&gt; to see if that's set if yes use it.&lt;/li&gt;
&lt;li&gt; The last option is to use &lt;code&gt;services/cache/distributedmap&lt;/code&gt; which is name of the default cache instance in WAS&lt;/li&gt;
&lt;/ol&gt;

Next i had to create &lt;code&gt;DynaCache&lt;/code&gt; class that implements  &lt;code&gt;org.hibernate.cache.Cache&lt;/code&gt;, the object of this class gets control for getting, setting, removing entries from cache. I am actually calling methods on &lt;code&gt;DistributedMap&lt;/code&gt;

&lt;pre&gt;&lt;code&gt;
package com.webspherenotes.hibernate.cache;

import java.util.Map;

import org.hibernate.cache.Cache;
import org.hibernate.cache.CacheException;

import com.ibm.websphere.cache.DistributedMap;

public class DynaCache implements Cache {

  private DistributedMap map;
  private String regionName;

  public DynaCache(DistributedMap map, String regionName) {
    System.out.println("Creating object of HibernateCache() " + regionName);
    this.map = map;
    this.regionName = regionName;
  }

  public void clear() throws CacheException {
    map.clear();
  }

  public Object get(Object key) throws CacheException {
    System.out.println("Inside HibernateCache.get " + key);
    return map.get(getMapKey(key));
  }

  public String getRegionName() {
    System.out.println("Inside HibernateCache.getRegionName " + regionName);

    return regionName;
  }

  public void put(Object key, Object value) throws CacheException {
    System.out.println("Inside HibernateCache.put " + key + " " + value);
    System.out.println(value.getClass().getName());
    map.put(getMapKey(key), value);
  }

  public Object read(Object key) throws CacheException {
    System.out.println("Inside HibernateCache.read " + key);

    return map.get(getMapKey(key));
  }

  public void remove(Object key) throws CacheException {
    map.remove(getMapKey(key));
  }

  public void update(Object key, Object value) throws CacheException {
    map.put(getMapKey(key), value);
  }

  private String getMapKey(Object key) {
    return regionName + "." + key;
  }

  @Override
  public void destroy() throws CacheException {

  }

  @Override
  public long getElementCountInMemory() {
    return this.map.size();
  }

  @Override
  public long getElementCountOnDisk() {
    return 0;
  }

  @Override
  public long getSizeInMemory() {
    return 0;
  }

  @Override
  public int getTimeout() {
    return 0;
  }

  @Override
  public void lock(Object arg0) throws CacheException {

  }

  @Override
  public long nextTimestamp() {
    return 0;
  }

  @Override
  public Map toMap() {
    return this.map;
  }

  @Override
  public void unlock(Object arg0) throws CacheException {

  }

}
&lt;/code&gt;&lt;/pre&gt;

Last thing is to define the &lt;code&gt;com.webspherenotes.hibernate.cache.DynaCacheProvider&lt;/code&gt; as cacheProvider in hibernate.cfg.xml this tells the Hibernate framework to use the DynaCacheProvider that we just created. 
&lt;pre&gt;&lt;code&gt;
&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&amp;gt;

&amp;lt;hibernate-configuration&amp;gt;

    &amp;lt;session-factory&amp;gt;

        &amp;lt;!-- Database connection settings --&amp;gt;
        &amp;lt;property name="connection.driver_class"&amp;gt;org.apache.derby.jdbc.ClientDriver&amp;lt;/property&amp;gt;
        &amp;lt;property name="connection.url"&amp;gt;jdbc:derby://localhost:1527/C:/data1/contact&amp;lt;/property&amp;gt;
        &amp;lt;property name="connection.username"&amp;gt;dbadmin&amp;lt;/property&amp;gt;
        &amp;lt;property name="connection.password"&amp;gt;dbadmin&amp;lt;/property&amp;gt;

        &amp;lt;!-- JDBC connection pool (use the built-in) --&amp;gt;
        &amp;lt;property name="connection.pool_size"&amp;gt;1&amp;lt;/property&amp;gt;

        &amp;lt;!-- SQL dialect --&amp;gt;
        &amp;lt;property name="dialect"&amp;gt;org.hibernate.dialect.DerbyDialect&amp;lt;/property&amp;gt;

      
       &lt;b&gt;&amp;lt;property name="cache.provider_class"&amp;gt;com.webspherenotes.hibernate.cache.DynaCacheProvider&amp;lt;/property&amp;gt;
       &amp;lt;property name="dynacache.default.cacheinstancename"&amp;gt;services/cache/distributedmap&amp;lt;/property&amp;gt;
       &amp;lt;property name="com.javaworld.memcache.Contact"&amp;gt;services/cache/contact&amp;lt;/property&amp;gt;&lt;/b&gt;
       
       &amp;lt;property name="hibernate.cache.use_second_level_cache"&amp;gt;true&amp;lt;/property&amp;gt;
       
         &amp;lt;property name="cache.use_query_cache"&amp;gt;true&amp;lt;/property&amp;gt;
       &amp;lt;property name=""&amp;gt;localhost:11211&amp;lt;/property&amp;gt;

        &amp;lt;!-- Echo all executed SQL to stdout --&amp;gt;
        &amp;lt;property name="show_sql"&amp;gt;true&amp;lt;/property&amp;gt;

        &amp;lt;!-- Drop and re-create the database schema on startup 
        &amp;lt;property name="hbm2ddl.auto"&amp;gt;create&amp;lt;/property&amp;gt;--&amp;gt;

        &amp;lt;mapping resource="com/javaworld/memcache/Contact.hbm.xml"/&amp;gt;
    &amp;lt;mapping resource="com/javaworld/memcache/Address.hbm.xml"/&amp;gt;
    &amp;lt;/session-factory&amp;gt;

&amp;lt;/hibernate-configuration&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

In this file i am telling hibernate to use &lt;code&gt;service/cache/contact&lt;/code&gt; cache instance for caching Contact object but the Address objects would get stored in the default cache. So after deploying the code i did hit the cache few times and this what i see in the cachemonitor

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-fpucz8lYbz8/TxUGaszgtxI/AAAAAAAABzo/OOQaxWF9EUA/s1600/Snap%2B2012-01-16%2Bat%2B21.25.06.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="221" width="400" src="http://2.bp.blogspot.com/-fpucz8lYbz8/TxUGaszgtxI/AAAAAAAABzo/OOQaxWF9EUA/s400/Snap%2B2012-01-16%2Bat%2B21.25.06.png" /&gt;&lt;/a&gt;&lt;/div&gt;


&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-UqvNJTV6BN4/TxUGhmNW2eI/AAAAAAAABz0/GLiZ_icstOM/s1600/Snap%2B2012-01-16%2Bat%2B21.26.19.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="221" width="400" src="http://4.bp.blogspot.com/-UqvNJTV6BN4/TxUGhmNW2eI/AAAAAAAABz0/GLiZ_icstOM/s400/Snap%2B2012-01-16%2Bat%2B21.26.19.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-8787699839161628370?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/nkEW6Wq-b6w" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/8787699839161628370/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=8787699839161628370" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8787699839161628370?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8787699839161628370?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/nkEW6Wq-b6w/using-dynacache-as-cache-implementation.html" title="Using DynaCache as Cache Implementation in Hibernate" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-fpucz8lYbz8/TxUGaszgtxI/AAAAAAAABzo/OOQaxWF9EUA/s72-c/Snap%2B2012-01-16%2Bat%2B21.25.06.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2012/01/using-dynacache-as-cache-implementation.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUFQXY8eip7ImA9WhRQFUk.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-3247789720266845878</id><published>2011-12-10T10:39:00.001-08:00</published><updated>2011-12-10T11:10:10.872-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-10T11:10:10.872-08:00</app:edited><title>Making asynchronous call to REST service</title><content type="html">In the &lt;a href='http://wpcertification.blogspot.com/2011/12/using-javaxxmlwsdispatch-for-rest.html'&gt;Using javax.xml.ws.Dispatch for REST Client&lt;/a&gt; entry i talked about how you can use the &lt;code&gt;javax.xml.ws.Dispatch&lt;/code&gt; class for making call to the REST service. As you can see it makes calling the REST service difficult and it might not make sense to use this approach for calling service in most cases but it might be good idea to think about this approach when you want to make asynchronous calls, i wanted to try this approach so i made following changes to the &lt;code&gt;DispatcherTest1.java&lt;/code&gt;

&lt;pre&gt;&lt;code&gt;
package com.webspherenotes.jaxrs;

import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.http.HTTPBinding;

public class DispatcherTest1 {

  public static void main(String[] args) {
    try {
      QName serviceName = new QName("http://www.webspherenotes.com/rest", "svc");
      QName portName = new QName("http://www.webspherenotes.com/rest", "port");
      Service svc = Service.create(serviceName);
      svc.addPort(portName, HTTPBinding.HTTP_BINDING, 
   "http://localhost:9080/MyWebService/rest/contact/1");
      Dispatch&lt;Source&gt; dis =
        svc.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
      Map&lt;String, Object&gt; requestContext = dis.getRequestContext();
      requestContext.put(MessageContext.HTTP_REQUEST_METHOD, "GET");
      &lt;b&gt;
      Future f= dis.invokeAsync(null, new DemoAyncHandler());
      System.out.println("After making async call to request");
      f.get();
    &lt;/b&gt;
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ExecutionException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

  }

}
&lt;/code&gt;&lt;/pre&gt; 

We have to change only couple of lines here, first change the &lt;code&gt;Dispatcher&lt;/code&gt; method that your calling from &lt;code&gt;invoke&lt;/code&gt; to &lt;code&gt;invokeAsync&lt;/code&gt;. The &lt;code&gt;invokeAsync&lt;/code&gt; method returns object of &lt;code&gt;java.util.concurrent.Future&lt;/code&gt;, calls its get method so that the current thread does not end before it gets calls response callback.

Then create DemoAsyncHandler class that gets called when the response for REST service is ready.

&lt;pre&gt;&lt;code&gt;

package com.test;

import java.util.concurrent.ExecutionException;

import javax.xml.transform.Source;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Response;

public class DemoAyncHandler implements AsyncHandler&lt;Source&gt;{

  @Override
  public void handleResponse(Response&lt;Source&gt; response) {
    try {
      System.out.println("Inside DemoAsyncHandler.handleResponse "
   + response);
      Source source = response.get();
      XMLHelper.prettyPrintXML(source, System.out);
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ExecutionException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }

}
&lt;/code&gt;&lt;/pre&gt;

Only thing that i am doing in the DemoAsyncHandler is to print the response on console, this is how the output looks like

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-kbDtOom_Ss0/TuOugddZ1II/AAAAAAAABzY/wWaOAZ_UwYo/s1600/reaasyncsnapshot.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="232" width="400" src="http://4.bp.blogspot.com/-kbDtOom_Ss0/TuOugddZ1II/AAAAAAAABzY/wWaOAZ_UwYo/s400/reaasyncsnapshot.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-3247789720266845878?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/Kav7e8cmIgc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/3247789720266845878/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=3247789720266845878" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/3247789720266845878?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/3247789720266845878?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/Kav7e8cmIgc/making-asynchronous-call-to-rest.html" title="Making asynchronous call to REST service" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-kbDtOom_Ss0/TuOugddZ1II/AAAAAAAABzY/wWaOAZ_UwYo/s72-c/reaasyncsnapshot.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/12/making-asynchronous-call-to-rest.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8BQ3c4eyp7ImA9WhRQFUk.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-4385348111533752161</id><published>2011-12-10T10:09:00.001-08:00</published><updated>2011-12-10T10:14:12.933-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-10T10:14:12.933-08:00</app:edited><title>Pretty print XML document</title><content type="html">I use the following XMLHelper.java code whenever i have a requirement to pretty print XML, it can handle String, Document and Source, the common objects that i need to print

&lt;pre&gt;&lt;code&gt;

package com.webspherenotes.xml;

import java.io.OutputStream;
import java.io.StringReader;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.w3c.dom.Document;

public class XMLHelper {

  public static void prettyPrintXML(Source source, OutputStream stream) {
    try {
      Transformer transformer = TransformerFactory.newInstance()
          .newTransformer();
      transformer.setOutputProperty(OutputKeys.INDENT, "yes");
      transformer.
   setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
      transformer.transform(source, new StreamResult(stream));
    } catch (Exception e) {
      e.printStackTrace(System.out);
    }
  }
  
  public static void prettyPrintXML(Document doc, OutputStream stream) {
    prettyPrintXML(new DOMSource(doc),stream);
  }
  
  public static void prettyPrintXML(String xmlString, OutputStream stream){
    prettyPrintXML(new StreamSource(new StringReader(xmlString)),stream);
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-4385348111533752161?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/s-bNlNhyJ_M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/4385348111533752161/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=4385348111533752161" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/4385348111533752161?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/4385348111533752161?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/s-bNlNhyJ_M/pretty-print-xml-document.html" title="Pretty print XML document" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/12/pretty-print-xml-document.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0ADQ3s6eSp7ImA9WhRQFUk.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-8229996909346360384</id><published>2011-12-10T09:52:00.001-08:00</published><updated>2011-12-10T10:29:32.511-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-10T10:29:32.511-08:00</app:edited><title>Using javax.xml.ws.Dispatch for REST Client</title><content type="html">The JAX-WS has a &lt;code&gt;javax.xml.ws.Dispatch&lt;/code&gt; class that you can use for making HTTP call, So i can use it even for making call to REST service and i wanted to see how that works.

I do have a Contact REST service that allows me to make CRUD calls on the Contact table, For example i can call &lt;code&gt;http://localhost:9080/MyWebService/rest/contact/1&lt;/code&gt; URL to get a record from &lt;code&gt;CONTACT&lt;/code&gt; table where contact Id is 1. This is the output i get when i call it for contactId 1

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-tH2e1K64gGI/TuOix-v5V8I/AAAAAAAABzA/PQmgiWc3DYA/s1600/restclientsnapshot.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="213" width="400" src="http://2.bp.blogspot.com/-tH2e1K64gGI/TuOix-v5V8I/AAAAAAAABzA/PQmgiWc3DYA/s400/restclientsnapshot.png" /&gt;&lt;/a&gt;&lt;/div&gt;

The REST service returns CONTACT object in XML format for contactId equal to 1, I wanted to try making the same call using the &lt;code&gt;javax.xml.ws.Dispatch&lt;/code&gt; object, this is the code that i built for it.

&lt;pre&gt;&lt;code&gt;
package com.webspherenotes.rest;

import java.util.Map;

import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.http.HTTPBinding;

public class DispatcherTest1 {

  public static void main(String[] args) {
    QName serviceName = new QName("http://www.webspherenotes.com/rest", "svc");
      QName portName = new QName("http://www.webspherenotes.com/rest", "port");
      Service svc = Service.create(serviceName);
      svc.addPort(portName, HTTPBinding.HTTP_BINDING,
   "http://localhost:9080/MyWebService/rest/contact/1");
      Dispatch&lt;Source&gt; dis =
        svc.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
      Map&lt;String, Object&gt; requestContext = dis.getRequestContext();
      requestContext.put(MessageContext.HTTP_REQUEST_METHOD, "GET");
      Source responseSource = dis.invoke(null);
     XMLHelper.prettyPrintXML(responseSource, System.out);
  }
}
&lt;/code&gt;&lt;/pre&gt;

In this class first i am creating a &lt;code&gt;Service&lt;/code&gt; object pointing to &lt;code&gt;http://localhost:9080/MyWebService/rest/contact/1&lt;/code&gt; URL and then i am getting the &lt;code&gt;Dispatcher&lt;/code&gt; object pointing to it. Next i use the &lt;code&gt;RequestContext&lt;/code&gt; object to set the HTTP request method to &lt;code&gt;GET&lt;/code&gt; and then i call the &lt;code&gt;Dispatcher.invoke()&lt;/code&gt; which actually makes HTTP request and it returns &lt;code&gt;Source&lt;/code&gt; object representing the response. Once i have the response i am uing the &lt;a href='http://wpcertification.blogspot.com/2011/12/pretty-print-xml-document.html'&gt;XMLHelper.prettyPrintXML()&lt;/a&gt; for pretty printing the XML, this is how the output looks like


&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-dG_jubEmncM/TuOi1MPcpsI/AAAAAAAABzM/v1QwQ4F5uus/s1600/radsnapshot.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="232" width="400" src="http://2.bp.blogspot.com/-dG_jubEmncM/TuOi1MPcpsI/AAAAAAAABzM/v1QwQ4F5uus/s400/radsnapshot.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-8229996909346360384?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/QpUD1GzErnc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/8229996909346360384/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=8229996909346360384" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8229996909346360384?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8229996909346360384?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/QpUD1GzErnc/using-javaxxmlwsdispatch-for-rest.html" title="Using javax.xml.ws.Dispatch for REST Client" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-tH2e1K64gGI/TuOix-v5V8I/AAAAAAAABzA/PQmgiWc3DYA/s72-c/restclientsnapshot.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/12/using-javaxxmlwsdispatch-for-rest.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMNR3wyfip7ImA9WhRTF0s.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-646617902061131187</id><published>2011-11-08T07:50:00.000-08:00</published><updated>2011-11-08T07:51:36.296-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-08T07:51:36.296-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="rest" /><category scheme="http://www.blogger.com/atom/ns#" term="jaxr" /><category scheme="http://www.blogger.com/atom/ns#" term="j2ee6" /><title>Returning a binary file from REST service</title><content type="html">You might want to return a binary file such as image or pdf from a REST service, if thats the case then JAX-RS provides you with 3 options. I wanted to try those options to i did create a sample application, that you can download from &lt;a href='http://www.box.net/shared/7e2clrpl2rpkg070do5s'&gt;here&lt;/a&gt;.

I did create a HelloBinaryService.java file which is a resource class that has 3 methods in each of these methods i am reading a static image file from c:/temp and returning it

&lt;pre&gt;&lt;code&gt;
package com.webspherenotes.rest;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.StreamingOutput;

@Path("/hellobinary")
public class HelloBinaryService {

  @GET
  @Path("/file")
  @Produces("image/png")
  public File getFile(){
    File samplePDF = new File("c:/temp/distributedmap.png");
    return samplePDF;
  }

  @GET
  @Path("/fileis")
  @Produces("image/png")
  public InputStream getFileInputStream()throws Exception{
    FileInputStream fileIs = new FileInputStream("c:/temp/distributedmap.png");
    return fileIs;
  }

  @GET
  @Path("/fileso")
  @Produces("image/png")
  public StreamingOutput getFileStreamingOutput() throws Exception{
    
    return new StreamingOutput() {
      
      @Override
      public void write(OutputStream outputStream) throws IOException,
          WebApplicationException {
        FileInputStream inputStream = new FileInputStream("c:/temp/distributedmap.png");
        int nextByte = 0;
        while((nextByte  = inputStream.read()) != -1 ){
          outputStream.write(nextByte);
        }
        outputStream.flush();
        outputStream.close();
        inputStream.close();
      }
    };
  }
  
}
&lt;/code&gt;&lt;/pre&gt; 

The first and easiest option would be to return a object of &lt;code&gt;java.io.File&lt;/code&gt; directly and the JAX-RS will figure out how to read the file and return binary content of the file, but you cannot use this option if your returning a file that is not stored on the file system.

Second option would be to return object of &lt;code&gt;InputStream&lt;/code&gt;, in that case the &lt;code&gt;InputStream&lt;/code&gt; could be pointing to file on local system or file stored in database or something like that, in this case JAX-RS container will figure out how to return bytes from &lt;code&gt;InputStream&lt;/code&gt; and return it 

The last option would be to return object of &lt;code&gt;StreamingOutput&lt;/code&gt;, this gives you most flexibility in this case JAX-RS container will give you control at the time of writing body of the message, this is little more work for you since you have to take care of reading the bytes from &lt;code&gt;InputStream&lt;/code&gt; and write into output stream but then you get chance to compress the content,....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-646617902061131187?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/SVty3FTWN9c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/646617902061131187/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=646617902061131187" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/646617902061131187?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/646617902061131187?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/SVty3FTWN9c/returning-binary-file-from-rest-service.html" title="Returning a binary file from REST service" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/11/returning-binary-file-from-rest-service.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0IFR3Y8cSp7ImA9WhdbGEw.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-8135030267044470407</id><published>2011-10-16T17:11:00.001-07:00</published><updated>2011-10-16T17:31:56.879-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-16T17:31:56.879-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="rest" /><category scheme="http://www.blogger.com/atom/ns#" term="j2ee6" /><category scheme="http://www.blogger.com/atom/ns#" term="jaxrs" /><title>Createing Hello JAXRS service for deployment using Sun Jersey</title><content type="html">If you want to build a REST service and deploy it in one of the Java EE 5 compliant containers for example WebSphere APplication Server 7.0, then you will have to use one of the external JAXRS containers such as &lt;a href='http://jersey.java.net/'&gt; Jersey&lt;/a&gt;, which is very popular among REST service developers.&lt;br /&gt;&lt;br /&gt;I wanted to try this option out so i built a HelloJersey application that you can download from &lt;a href='http://www.box.net/shared/km2963fjlu4a07784p69'&gt;here&lt;/a&gt;. I followed these steps for building my sample application&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;First create a Dynamic Web APplication project called HelloJersey&lt;/li&gt;&lt;br /&gt;&lt;li&gt; Download following .jar files and add it to the WEB-INF/lib folder of your web application&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;asm-3.1.jar&lt;/li&gt;&lt;br /&gt;&lt;li&gt;jersey-core-1.5.jar&lt;/li&gt;&lt;br /&gt;&lt;li&gt;jersey-server-1.5.jar&lt;/li&gt;&lt;br /&gt;&lt;li&gt;jsr311-api-1.1.1.jar&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Next create a HelloJerseyRESTService.java file like this&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;package com.webspherenotes.rest;&lt;br /&gt;&lt;br /&gt;import javax.ws.rs.GET;&lt;br /&gt;import javax.ws.rs.Path;&lt;br /&gt;import javax.ws.rs.Produces;&lt;br /&gt;import javax.ws.rs.QueryParam;&lt;br /&gt;import javax.ws.rs.core.MediaType;&lt;br /&gt;&lt;br /&gt;@Path("/hellojersey")&lt;br /&gt;public class HelloJerseyRESTService {&lt;br /&gt;&lt;br /&gt;  @GET&lt;br /&gt;  @Produces(MediaType.TEXT_HTML)&lt;br /&gt;  public String sayHello(@QueryParam("name") String name ){&lt;br /&gt;    return "Hello " + name;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The HelloJerseyRESTService only handles GET request and returns HTML markup&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;Next declare the Jersey servlet in the web.xml and create servlet mapping &lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;web-app id="WebApp_ID" version="2.5"&lt;br /&gt;  xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&amp;gt;&lt;br /&gt;  &amp;lt;display-name&amp;gt;DynaCacheSample1&amp;lt;/display-name&amp;gt;&lt;br /&gt;  &amp;lt;servlet&amp;gt;&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;Jersey REST Service&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;servlet-class&amp;gt;com.sun.jersey.spi.container.servlet.ServletContainer&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;    &amp;lt;init-param&amp;gt;&lt;br /&gt;      &amp;lt;param-name&amp;gt;com.sun.jersey.config.property.packages&amp;lt;/param-name&amp;gt;&lt;br /&gt;      &amp;lt;param-value&amp;gt;com.webspherenotes.rest&amp;lt;/param-value&amp;gt;&lt;br /&gt;    &amp;lt;/init-param&amp;gt;&lt;br /&gt;    &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;  &amp;lt;/servlet&amp;gt;&lt;br /&gt;  &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;Jersey REST Service&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;url-pattern&amp;gt;/rest/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;  &amp;lt;/servlet-mapping&amp;gt;  &lt;br /&gt;    &amp;lt;welcome-file-list&amp;gt;&lt;br /&gt;      &amp;lt;welcome-file&amp;gt;index.html&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;      &amp;lt;welcome-file&amp;gt;index.htm&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;      &amp;lt;welcome-file&amp;gt;index.jsp&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;      &amp;lt;welcome-file&amp;gt;default.html&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;      &amp;lt;welcome-file&amp;gt;default.htm&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;      &amp;lt;welcome-file&amp;gt;default.jsp&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;    &amp;lt;/welcome-file-list&amp;gt;&lt;br /&gt;&amp;lt;/web-app&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;After you deploy the application in container you should see that when the server is starting it will scan all the resource and in our case it should find only &lt;code&gt;com.webspherenotes.rest.HelloJerseyRESTService&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;[10/16/11 17:17:47:250 PDT] 0000000e ApplicationMg I   WSVR0228I: User initiated module stop operation request completed on Module, HelloJersey.war, of application, DynaCacheSample1EAR&lt;br /&gt;[10/16/11 17:17:49:932 PDT] 0000000e ApplicationMg I   WSVR0225I: User initiated module start operation requested on Module, HelloJersey.war, of application, DynaCacheSample1EAR&lt;br /&gt;[10/16/11 17:17:50:466 PDT] 0000000e webapp        I com.ibm.ws.webcontainer.webapp.WebGroupImpl WebGroup SRVE0169I: Loading Web Module: HelloJersey.&lt;br /&gt;[10/16/11 17:17:50:521 PDT] 0000000e WASSessionCor I SessionContextRegistry getSessionContext SESN0176I: Will create a new session context for application key default_host/HelloJersey&lt;br /&gt;&lt;b&gt;&lt;br /&gt;[10/16/11 17:17:50:602 PDT] 0000000e PackagesResou I   Scanning for root resource and provider classes in the packages:&lt;br /&gt;  com.webspherenotes.rest&lt;br /&gt;[10/16/11 17:17:50:666 PDT] 0000000e ScanningResou I   Root resource classes found:&lt;br /&gt;  class com.webspherenotes.rest.HelloJerseyRESTService&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;[10/16/11 17:17:50:667 PDT] 0000000e ScanningResou I   No provider classes found.&lt;br /&gt;[10/16/11 17:17:50:850 PDT] 0000000e WebApplicatio I   Initiating Jersey application, version 'Jersey: 1.5 01/14/2011 12:36 PM'&lt;br /&gt;[10/16/11 17:17:51:816 PDT] 0000000e servlet       I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [DynaCacheSample1EAR] [/HelloJersey] [Jersey REST Service]: Initialization successful.&lt;br /&gt;[10/16/11 17:17:51:817 PDT] 0000000e webcontainer  I com.ibm.ws.wswebcontainer.VirtualHost addWebApplication SRVE0250I: Web Module HelloJersey has been bound to default_host[*:9080,*:80,*:9443,*:5060,*:5061,*:443].&lt;br /&gt;[10/16/11 17:17:51:824 PDT] 0000000e ApplicationMg I   WSVR0226I: User initiated module start operation request completed on Module, HelloJersey.war, of application, DynaCacheSample1EAR&lt;br /&gt;[10/16/11 17:17:51:825 PDT] 0000000e AppBinaryProc I   ADMA7021I: Distribution of application DynaCacheSample1EAR completed successfully.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;You can test the service by either directly going to the &lt;code&gt;http://localhost:9080/HelloJersey/rest/hellojersey?name=sunil&lt;/code&gt; URL or using the REST client&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-qPYnjVSo4rY/Tpt3MD4JHqI/AAAAAAAAByU/TiH4NfSmXGo/s1600/hellojersey.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 240px;" src="http://3.bp.blogspot.com/-qPYnjVSo4rY/Tpt3MD4JHqI/AAAAAAAAByU/TiH4NfSmXGo/s400/hellojersey.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5664252005431451298" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-8135030267044470407?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/s38KH6pYxAI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/8135030267044470407/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=8135030267044470407" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8135030267044470407?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8135030267044470407?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/s38KH6pYxAI/createing-hello-jaxrs-service-for.html" title="Createing Hello JAXRS service for deployment using Sun Jersey" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-qPYnjVSo4rY/Tpt3MD4JHqI/AAAAAAAAByU/TiH4NfSmXGo/s72-c/hellojersey.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/10/createing-hello-jaxrs-service-for.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMBRX0-eyp7ImA9WhdbGE0.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-3785894159950572404</id><published>2011-10-13T13:25:00.000-07:00</published><updated>2011-10-16T16:40:54.353-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-16T16:40:54.353-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="was8" /><category scheme="http://www.blogger.com/atom/ns#" term="j2ee6" /><title>Create Hello JAX-RS service in WAS 8.0</title><content type="html">The WAS 8.0 is Java EE 6.0 compliant that means it allows you to deploy JAX-RS compliant service and you dont have to go through painful steps for setting up external JAXRS container such as Jersey in your web application&lt;br /&gt;&lt;br /&gt;I wanted to figure out what it takes to create HelloREST application in WAS 8.0 so i followed this steps to create Hello JAX-RS service. You can download the source code for sample from &lt;a href='http://www.box.net/shared/abzu4cq4tx32ooia6122'&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt; First i used RAD 8.0 to create Servlet Technology 3.0 compliant web application( Which means no need for web.xml or no need of declaring servlets)&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Next create a &lt;code&gt;HelloRestService&lt;/code&gt; class that is basically a REST service and is available at &lt;code&gt;/hellorest&lt;/code&gt; url&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;package com.webspherenotes.rest;&lt;br /&gt;&lt;br /&gt;import javax.ws.rs.GET;&lt;br /&gt;import javax.ws.rs.Path;&lt;br /&gt;import javax.ws.rs.Produces;&lt;br /&gt;import javax.ws.rs.QueryParam;&lt;br /&gt;&lt;br /&gt;@Path("/hellorest")&lt;br /&gt;public class HelloRESTService {&lt;br /&gt;&lt;br /&gt;  @GET&lt;br /&gt;  @Produces("text/html")&lt;br /&gt;  public String sayHello(@QueryParam("name") String name){&lt;br /&gt;    return "Hello " + name;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;Next create &lt;code&gt;HelloApplication &lt;/code&gt; class which is basically a REST servlet class like this.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;package com.webspherenotes.rest;&lt;br /&gt;&lt;br /&gt;import java.util.HashSet;&lt;br /&gt;import java.util.Set;&lt;br /&gt;&lt;br /&gt;import javax.ws.rs.ApplicationPath;&lt;br /&gt;import javax.ws.rs.core.Application;&lt;br /&gt;&lt;br /&gt;@ApplicationPath("/rest/")&lt;br /&gt;public class HelloApplication extends Application{&lt;br /&gt;&lt;br /&gt;  @Override&lt;br /&gt;  public Set&amp;lt;Class&amp;lt;?&amp;gt;&amp;gt; getClasses() {&lt;br /&gt;     Set&amp;lt;Class&amp;lt;?&amp;gt;&amp;gt; s = new HashSet&amp;lt;Class&amp;lt;?&amp;gt;&amp;gt;();&lt;br /&gt;     s.add(HelloRESTService.class);&lt;br /&gt;     return s;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The &lt;code&gt;HelloApplication&lt;/code&gt; class extends &lt;code&gt;javax.ws.rs.core.Application&lt;/code&gt; which helps you to declare the JAX-RS application, in this class i am overriding the getClasses() method which returns set of JAX-RS classes that act as JAX-RS service. In my case i do have only one HelloRESTService class so i am only adding that&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Now deploy the application on your WAS 8.0 server, if you try accessing it by sending GET request to http://localhost:9080/HelloRESTService/rest/hellorest?name=Sunil URL and you should get Hello Sunil as response&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-3785894159950572404?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/xOCNsSVY1LM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/3785894159950572404/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=3785894159950572404" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/3785894159950572404?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/3785894159950572404?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/xOCNsSVY1LM/create-hello-jax-rs-service-in-was-80.html" title="Create Hello JAX-RS service in WAS 8.0" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/10/create-hello-jax-rs-service-in-was-80.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUIFR3wzfSp7ImA9WhdbFU4.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-4730616905292345617</id><published>2011-10-13T09:41:00.000-07:00</published><updated>2011-10-13T13:25:16.285-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-13T13:25:16.285-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="was8" /><category scheme="http://www.blogger.com/atom/ns#" term="j2ee6" /><title>Hello Container dependency injection in Java EE 6</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-zh9-WfZvevQ/TpdI-QESi1I/AAAAAAAAByI/b5xcpNnWj3M/s1600/hellocdi.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 318px;" src="http://1.bp.blogspot.com/-zh9-WfZvevQ/TpdI-QESi1I/AAAAAAAAByI/b5xcpNnWj3M/s400/hellocdi.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5663075290743737170" /&gt;&lt;/a&gt;&lt;br /&gt;The Java EE 6 introduces generic dependency injection support, I wanted to try this feature so i built a sample application that you can download from &lt;a href='http://www.box.net/shared/bn71qonlkb3a4bxxd9fs'&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The IBM WebSphere Application Server 8.0 is Java EE 6 compliant and i am using RAD 8 + WAS 8 for testing my sample. The sample application has a Servlet that takes name as request parameter and an instance of &lt;code&gt;GreetingBean&lt;/code&gt; class is injected into the servlet, The servlet calls method of GreetingBean to get the actual greeting method. Follow these steps&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;First create a &lt;code&gt;GreetingBean&lt;/code&gt; like this&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;package com.webspherenotes.jee6.cdi;&lt;br /&gt;&lt;br /&gt;import javax.enterprise.inject.Default;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;@Default&lt;/b&gt;&lt;br /&gt;public class GreetingBean {&lt;br /&gt;&lt;br /&gt;  public String getMessage(String userName){&lt;br /&gt;    return "Hello " + userName;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;Next create &lt;code&gt;HelloCDIServlet&lt;/code&gt; servlet like this&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;package com.webspherenotes.jee6.cdi;&lt;br /&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;import javax.inject.Inject;&lt;br /&gt;import javax.servlet.ServletException;&lt;br /&gt;import javax.servlet.annotation.WebServlet;&lt;br /&gt;import javax.servlet.http.HttpServlet;&lt;br /&gt;import javax.servlet.http.HttpServletRequest;&lt;br /&gt;import javax.servlet.http.HttpServletResponse;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Servlet implementation class HelloCDIServlet&lt;br /&gt; */&lt;br /&gt;@WebServlet("/")&lt;br /&gt;public class HelloCDIServlet extends HttpServlet {&lt;br /&gt;&lt;b&gt;&lt;br /&gt;  @Inject&lt;br /&gt;  GreetingBean greetingBean;&lt;br /&gt;&lt;/b&gt;  &lt;br /&gt;  /**&lt;br /&gt;   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)&lt;br /&gt;   */&lt;br /&gt;  protected void doGet(HttpServletRequest request, HttpServletResponse response) &lt;br /&gt;  throws ServletException, IOException {&lt;br /&gt;    response.setContentType("text/html");&lt;br /&gt;    response.getWriter().println(greetingBean.getMessage(request.getParameter("name")));&lt;br /&gt;    &lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In this sample the &lt;code&gt;@Inject&lt;/code&gt; annotation tells container to create object of GreetingBean and inject it into the servlet&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Create a empty beans.xml file in the WEB-INF folder of your application. An application that uses CDI must have a file named beans.xml. The file can be completely empty (it has content only in certain limited situations), but it must be present. For a web application, the beans.xml file must be in the WEB-INF directory. For EJB modules or JAR files, the beans.xml file must be in the META-INF directory.&lt;br /&gt;&lt;/li&gt; &lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Deploy your servlet in WAS 8 and when you invoke it with name query parameter you should see greeting message like this&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-4730616905292345617?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/1QvFiBHWums" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/4730616905292345617/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=4730616905292345617" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/4730616905292345617?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/4730616905292345617?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/1QvFiBHWums/hello-container-dependency-injection-in.html" title="Hello Container dependency injection in Java EE 6" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-zh9-WfZvevQ/TpdI-QESi1I/AAAAAAAAByI/b5xcpNnWj3M/s72-c/hellocdi.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/10/hello-container-dependency-injection-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4MRHYycCp7ImA9WhdUGUk.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-9213475921840991495</id><published>2011-10-06T10:22:00.000-07:00</published><updated>2011-10-06T16:33:05.898-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-06T16:33:05.898-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="webservicecert" /><title>Pretty printing SOAP messages</title><content type="html">If your dealing with SAAJ API or you want to create a Debug Message Handler that prints the SOAP Message then you can call &lt;code&gt;SOAPmessage.writeTo(System.out)&lt;/code&gt;, but this method writes the full SOAP message in one line and which can be little hard to read this is sample output&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&amp;gt;&amp;lt;SOAP-ENV:Body&amp;gt;&amp;lt;wn:sayHello SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wn="http://ws.websphrenotes.com/"&amp;gt;&amp;lt;arg0&amp;gt;Sunil&amp;lt;/arg0&amp;gt;&amp;lt;/wn:sayHello&amp;gt;&amp;lt;/SOAP-ENV:Body&amp;gt;&amp;lt;/SOAP-ENV:Envelope&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you want to pretty print the SOAPMessage then you can use the following method. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;package com.webspherenotes.ws;&lt;br /&gt;import java.io.ByteArrayOutputStream;&lt;br /&gt;&lt;br /&gt;import javax.xml.soap.SOAPMessage;&lt;br /&gt;import javax.xml.transform.OutputKeys;&lt;br /&gt;import javax.xml.transform.Source;&lt;br /&gt;import javax.xml.transform.Transformer;&lt;br /&gt;import javax.xml.transform.TransformerFactory;&lt;br /&gt;import javax.xml.transform.stream.StreamResult;&lt;br /&gt;public class SOAPHelper {&lt;br /&gt;   public static String getSOAPMessageAsString(SOAPMessage soapMessage) {&lt;br /&gt;      try {&lt;br /&gt;&lt;br /&gt;         TransformerFactory tff = TransformerFactory.newInstance();&lt;br /&gt;         Transformer tf = tff.newTransformer();&lt;br /&gt;&lt;br /&gt;         // Set formatting&lt;br /&gt;        &lt;b&gt;&lt;br /&gt;         tf.setOutputProperty(OutputKeys.INDENT, "yes");&lt;br /&gt;         tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",&lt;br /&gt;               "2");&lt;br /&gt;         &lt;/b&gt;&lt;br /&gt;         Source sc = soapMessage.getSOAPPart().getContent();&lt;br /&gt;&lt;br /&gt;         ByteArrayOutputStream streamOut = new ByteArrayOutputStream();&lt;br /&gt;         StreamResult result = new StreamResult(streamOut);&lt;br /&gt;         tf.transform(sc, result);&lt;br /&gt;&lt;br /&gt;         String strMessage = streamOut.toString();&lt;br /&gt;         return strMessage;&lt;br /&gt;      } catch (Exception e) {&lt;br /&gt;         System.out.println("Exception in getSOAPMessageAsString "&lt;br /&gt;               + e.getMessage());&lt;br /&gt;         return null;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It generates the output which looks like this&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&amp;gt;&lt;br /&gt;  &amp;lt;SOAP-ENV:Body&amp;gt;&lt;br /&gt;    &amp;lt;wn:sayHello SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wn="http://ws.websphrenotes.com/"&amp;gt;&lt;br /&gt;      &amp;lt;arg0&amp;gt;Sunil&amp;lt;/arg0&amp;gt;&lt;br /&gt;    &amp;lt;/wn:sayHello&amp;gt;&lt;br /&gt;  &amp;lt;/SOAP-ENV:Body&amp;gt;&lt;br /&gt;&amp;lt;/SOAP-ENV:Envelope&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I ended up doing this because i could not find &lt;code&gt;SaajOutputer.java&lt;/code&gt; class&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-9213475921840991495?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/kq-uBhO1Pe0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/9213475921840991495/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=9213475921840991495" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/9213475921840991495?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/9213475921840991495?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/kq-uBhO1Pe0/pretty-printing-soap-messages.html" title="Pretty printing SOAP messages" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/10/pretty-printing-soap-messages.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcER306eip7ImA9WhdUGUk.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-8940688266765124186</id><published>2011-10-05T16:42:00.000-07:00</published><updated>2011-10-06T16:33:26.312-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-06T16:33:26.312-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="was8" /><title>Updating WAS 8</title><content type="html">In the &lt;a href='http://wpcertification.blogspot.com/2011/04/installing-was-8-beta-on-your-machine.html'&gt;Installing WAS 8 Beta on your machine&lt;/a&gt;, entry i talked about how IBM has changed the way we installed WebSphere Application Server starting from V8.0. Now we have to use the IBM Installation Manager,&lt;br /&gt;&lt;br /&gt;One advantage of using the IBM Installation manager for installing/managing the WAS 8.0 is that updating it has become very easy, I had to use simple wizard to install latest WAS 8.0 recommended fixes on my machine, no need to go through the process of finding recommended fixes, downloading them and the using update installer to install fixes.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-nJST5YaSY94/Toz7hNUevcI/AAAAAAAABxg/W9NFvzcpPwA/s1600/updatewas8.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://1.bp.blogspot.com/-nJST5YaSY94/Toz7hNUevcI/AAAAAAAABxg/W9NFvzcpPwA/s400/updatewas8.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5660175379627687362" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-2W_TFk9d2cA/Toz7kPBJozI/AAAAAAAABxo/a4uhGRJ3kZw/s1600/updatewas81.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://4.bp.blogspot.com/-2W_TFk9d2cA/Toz7kPBJozI/AAAAAAAABxo/a4uhGRJ3kZw/s400/updatewas81.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5660175431623090994" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-9-86hsrpn6g/Toz7onCmHWI/AAAAAAAABxw/50guZteeBhY/s1600/updatewas82.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://3.bp.blogspot.com/-9-86hsrpn6g/Toz7onCmHWI/AAAAAAAABxw/50guZteeBhY/s400/updatewas82.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5660175506791079266" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-gi6zDoHMAWs/Toz7sYyzpnI/AAAAAAAABx4/DO4drqqdpoc/s1600/updatewas83.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://3.bp.blogspot.com/-gi6zDoHMAWs/Toz7sYyzpnI/AAAAAAAABx4/DO4drqqdpoc/s400/updatewas83.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5660175571686237810" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-8940688266765124186?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/zL527WGqVy0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/8940688266765124186/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=8940688266765124186" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8940688266765124186?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8940688266765124186?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/zL527WGqVy0/updating-was-8.html" title="Updating WAS 8" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-nJST5YaSY94/Toz7hNUevcI/AAAAAAAABxg/W9NFvzcpPwA/s72-c/updatewas8.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/10/updating-was-8.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUFQ34yeyp7ImA9WhZaGUo.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-8015500183087282968</id><published>2011-07-05T12:35:00.000-07:00</published><updated>2011-07-06T11:16:52.093-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-06T11:16:52.093-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="was8" /><title>Installing enterprise application files by adding them to a monitored directory</title><content type="html">The WebSphere Application Server 8.0 introduces this new feature, in which you can copy enterprise application file in the monitoredDirectory and it automatically gets installed on the server. This feature is similar to concept of copying .war file in the webapps directory. I wanted to try this feature, so i followed these steps &lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;The monitored directory feature is disabled by default so the first step would be to enable this feature, for that login into WAS Admin Console and go to Applications -&amp;gt; Global Deployment settings.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-6nDuC_F8lGQ/ThSkT2f1s3I/AAAAAAAABww/VEevF8d5xyQ/s1600/monitoreddirectory.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 270px;" src="http://3.bp.blogspot.com/-6nDuC_F8lGQ/ThSkT2f1s3I/AAAAAAAABww/VEevF8d5xyQ/s400/monitoreddirectory.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5626302495446119282" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;On this page the &lt;code&gt;Monitor directory to automatically deploy applications&lt;/code&gt; check box is unchecked by default, so check it. Then you can either use the default path for the monitored directory which is &lt;code&gt;app_profile_root/monitoredDeployableApps&lt;/code&gt; or you can change this path to something else, save the changes and restart the server&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Once the server is restarted you will notice that &lt;code&gt;app_profile_root/monitoredDeployableApps&lt;/code&gt; gets created for you&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-pRDjQ18snic/ThSlRA5jxUI/AAAAAAAABw4/L_okUhpVyeA/s1600/monitordirectorycreatd.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 270px;" src="http://2.bp.blogspot.com/-pRDjQ18snic/ThSlRA5jxUI/AAAAAAAABw4/L_okUhpVyeA/s400/monitordirectorycreatd.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5626303546210370882" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;I did export HelloMonitoredDirectoryEAR.ear into the monitoredDirectory &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-Z_Dco4weQZs/ThSloU5WJUI/AAAAAAAABxA/6BBrG_EzSM8/s1600/aftercopyingtomanageddeploy.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 270px;" src="http://2.bp.blogspot.com/-Z_Dco4weQZs/ThSloU5WJUI/AAAAAAAABxA/6BBrG_EzSM8/s400/aftercopyingtomanageddeploy.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5626303946715178306" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;After copying the .ear into monitoredDirectory i was looking at the logs and i could notice that it is being picked up for deployment&lt;br /&gt;&lt;code&gt;&lt;br /&gt;[7/5/11 12:32:35:944 PDT] 00000013 WatchService  I   CWLDD0007I: Event id 1937700630-1. Start of processing. Event type: Added, File path: C:\IBM\WebSphere\AppServer\profiles\AppSrv01\monitoredDeployableApps\servers\server1\HelloMonitoredDirectoryEAR.ear.&lt;br /&gt;[7/5/11 12:32:36:022 PDT] 00000013 ModelMgr      I   WSVR0801I: Initializing all server configuration models&lt;br /&gt;[7/5/11 12:32:37:303 PDT] 00000013 WorkSpaceMana A   WKSP0500I: Workspace configuration consistency check is disabled.&lt;br /&gt;[7/5/11 12:32:38:475 PDT] 00000013 AppManagement I   CWLDD0028I: Event id 1937700630-1. The target of the current operation is [WebSphere:cell=ascendan-ggbz6iNode01Cell,node=ascendan-ggbz6iNode01,server=server1]. &lt;br /&gt;[7/5/11 12:32:38:553 PDT] 00000013 AppManagement I   CWLDD0014I: Event id 1937700630-1. Installing application HelloMonitoredDirectoryEAR... &lt;br /&gt;[7/5/11 12:32:40:022 PDT] 00000013 annotations   I ArchiveInputStreamData mapData Collision on [ WEB-INF/classes/com/webspherenotes/test/HelloMonitoredServlet.class ] in [ HelloMonitoredDirectory.war ]&lt;br /&gt;[7/5/11 12:32:43:631 PDT] 00000014 annotations   I ArchiveInputStreamData mapData Collision on [ WEB-INF/classes/com/webspherenotes/test/HelloMonitoredServlet.class ] in [ HelloMonitoredDirectory.war ]&lt;br /&gt;[7/5/11 12:32:55:645 PDT] 00000014 webcontainer  I com.ibm.ws.webcontainer.internal.WebContainer addExtensionFactory SRVE0239I: Extension Factory [class com.ibm.ws.soa.sca.web.extension.SCAWebExtensionFactory] was registered successfully.&lt;br /&gt;[7/5/11 12:32:55:676 PDT] 00000014 webcontainer  I com.ibm.ws.webcontainer.internal.WebContainer addExtensionFactory SRVE0240I: Extension Factory [class com.ibm.ws.soa.sca.web.extension.SCAWebExtensionFactory] has been associated with patterns [""].&lt;br /&gt;[7/5/11 12:32:55:692 PDT] 00000014 WebSphereSCAS I   Added Servlet mapping: /dojo&lt;br /&gt;[7/5/11 12:32:55:692 PDT] 00000014 WebSphereSCAS I   Added Servlet mapping: /dojo&lt;br /&gt;[7/5/11 12:32:55:692 PDT] 00000014 WebSphereSCAS I   Added Servlet mapping: /tuscany&lt;br /&gt;[7/5/11 12:32:55:692 PDT] 00000014 WebSphereSCAS I   Added Servlet mapping: /tuscany&lt;br /&gt;[7/5/11 12:32:58:848 PDT] 00000014 annotations   I ArchiveInputStreamData mapData Collision on [ WEB-INF/classes/com/webspherenotes/test/HelloMonitoredServlet.class ] in [ HelloMonitoredDirectory.war ]&lt;br /&gt;[7/5/11 12:32:58:957 PDT] 00000014 InstallSchedu I   ADMA5013I: Application HelloMonitoredDirectoryEAR installed successfully.&lt;br /&gt;[7/5/11 12:33:03:223 PDT] 00000013 annotations   I ArchiveInputStreamData mapData Collision on [ WEB-INF/classes/com/webspherenotes/test/HelloMonitoredServlet.class ] in [ HelloMonitoredDirectory.war ]&lt;br /&gt;[7/5/11 12:33:04:144 PDT] 00000013 annotations   I ArchiveInputStreamData mapData Collision on [ WEB-INF/classes/com/webspherenotes/test/HelloMonitoredServlet.class ] in [ HelloMonitoredDirectory.war ]&lt;br /&gt;[7/5/11 12:33:04:207 PDT] 00000013 annotations   E   CWWAM0001E: An exception occurred during annotation processing: java.lang.IllegalArgumentException: The feature 'annotated-classes' is not a valid feature&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;li&gt;I did wait for couple of minutes and then i checked the WAS Admin console and i could see newly installed application like this&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-xnNpv_GSBRU/ThSmcsK4XcI/AAAAAAAABxQ/UsEPle44h2s/s1600/checkdeployed.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 270px;" src="http://1.bp.blogspot.com/-xnNpv_GSBRU/ThSmcsK4XcI/AAAAAAAABxQ/UsEPle44h2s/s400/checkdeployed.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5626304846315937218" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;I wanted to see where exactly the application is getting installed so i looked at the value of application binaries and i can see that it got installed in regular installedApp directory&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-Gtek1ZZ9vd8/ThSmU9JRmDI/AAAAAAAABxI/puEHlMkfu4E/s1600/wsadminconsoleafterinstall.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 247px;" src="http://3.bp.blogspot.com/-Gtek1ZZ9vd8/ThSmU9JRmDI/AAAAAAAABxI/puEHlMkfu4E/s400/wsadminconsoleafterinstall.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5626304713433651250" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-8015500183087282968?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/ZE8JTn5c3PU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/8015500183087282968/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=8015500183087282968" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8015500183087282968?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/8015500183087282968?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/ZE8JTn5c3PU/installing-enterprise-application-files.html" title="Installing enterprise application files by adding them to a monitored directory" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-6nDuC_F8lGQ/ThSkT2f1s3I/AAAAAAAABww/VEevF8d5xyQ/s72-c/monitoreddirectory.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/07/installing-enterprise-application-files.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08CQHg8eSp7ImA9WhZbGEg.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-1355489397919622764</id><published>2011-06-23T10:26:00.000-07:00</published><updated>2011-06-23T10:57:41.671-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-23T10:57:41.671-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="webservicecert" /><title>How to use TCP/IP monitor for web service</title><content type="html">The TCP/IP monitor view in Rational Application developer lets you monitor HTTP traffic. It makes it easier to monitor the Web Service request and response. The basic idea is you create a tunnel for example the default HTTP port for WAS  is 9080, and i want to monitor traffic on localhost:9080, so i did create a monitor for port localhost:80 and now whenever i make a request to localhost:80, the TCP/IP monitor will forward that request to localhost:9080 and also log it. This is same principle as that of &lt;a href='http://ws.apache.org/commons/tcpmon/'&gt;Tcpmon&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I wanted to try this feature so i used these steps.&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;In the TCP/IP montior view click on properties sub menu like this&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-KpFQjrHPM-8/TgN7jQ7BFgI/AAAAAAAABwQ/80W39uc8cLQ/s1600/createmonitor1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 225px;" src="http://4.bp.blogspot.com/-KpFQjrHPM-8/TgN7jQ7BFgI/AAAAAAAABwQ/80W39uc8cLQ/s400/createmonitor1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5621472605656651266" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;On the next window i did create a monitor that will forward requests sent to localhost:8080 to localhost:9080 like this&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-Sm4UdFxmOIg/TgN70-JkYJI/AAAAAAAABwY/DmmIO9u6Vd8/s1600/createtcpipmonitor.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 377px; height: 320px;" src="http://1.bp.blogspot.com/-Sm4UdFxmOIg/TgN70-JkYJI/AAAAAAAABwY/DmmIO9u6Vd8/s400/createtcpipmonitor.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5621472909855056018" /&gt;&lt;/a&gt;&lt;br /&gt;After creating the monitor start it, if its not already started.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Create a web service client using RAD, when you create the web service client, RAD copies the wsdl file in the META-INF/wsdl folder and this file has the service binding section, which has the URL for actual service. The Web Service client created by RAD reads URL of the service from wsdl to communicate with the service.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;@WebServiceClient(name = "HelloWebServiceService", targetNamespace = "http://services.webspherenotes.com/",&lt;br /&gt; wsdlLocation = "META-INF/wsdl/HelloWebServiceService.wsdl")&lt;br /&gt;public class HelloWebServiceService&lt;br /&gt;    extends Service&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    private final static URL HELLOWEBSERVICESERVICE_WSDL_LOCATION;&lt;br /&gt;    private final static Logger logger = Logger.getLogger(com.webspherenotes.services.HelloWebServiceService.class.getName());&lt;br /&gt;&lt;br /&gt;    static {&lt;br /&gt;        URL url = null;&lt;br /&gt;        try {&lt;br /&gt;&lt;b&gt;&lt;br /&gt;            url = com.webspherenotes.services.HelloWebServiceService.class.getResource("/META-INF/wsdl/HelloWebServiceService.wsdl");&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;            if (url == null) throw new MalformedURLException("/META-INF/wsdl/HelloWebServiceService.wsdl does not exist in the module.");&lt;br /&gt;        } catch (MalformedURLException e) {&lt;br /&gt;            logger.warning("Failed to create URL for the wsdl Location: 'META-INF/wsdl/HelloWebServiceService.wsdl', retrying as a local file");&lt;br /&gt;            logger.warning(e.getMessage());&lt;br /&gt;        }&lt;br /&gt;        HELLOWEBSERVICESERVICE_WSDL_LOCATION = url;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public HelloWebServiceService(URL wsdlLocation, QName serviceName) {&lt;br /&gt;        super(wsdlLocation, serviceName);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public HelloWebServiceService() {&lt;br /&gt;        super(HELLOWEBSERVICESERVICE_WSDL_LOCATION, new QName("http://services.webspherenotes.com/", "HelloWebServiceService"));&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * &lt;br /&gt;     * @return&lt;br /&gt;     *     returns HelloWebService&lt;br /&gt;     */&lt;br /&gt;    @WebEndpoint(name = "HelloWebServicePort")&lt;br /&gt;    public HelloWebService getHelloWebServicePort() {&lt;br /&gt;        return super.getPort(new QName("http://services.webspherenotes.com/", "HelloWebServicePort"), HelloWebService.class);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * &lt;br /&gt;     * @param features&lt;br /&gt;     *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  &lt;br /&gt;  Supported features not in the &lt;code&gt;features&lt;/code&gt; parameter will have their default values.&lt;br /&gt;     * @return&lt;br /&gt;     *     returns HelloWebService&lt;br /&gt;     */&lt;br /&gt;    @WebEndpoint(name = "HelloWebServicePort")&lt;br /&gt;    public HelloWebService getHelloWebServicePort(WebServiceFeature... features) {&lt;br /&gt;        return super.getPort(new QName("http://services.webspherenotes.com/", "HelloWebServicePort"), HelloWebService.class, features);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In the static block of the &lt;code&gt;HelloWebServiceService&lt;/code&gt;, it is reading the wsdl and using the URL for making request. &lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;Now in order for TCP/IP monitor to monitor the traffic, we will have to change the value of the URL so that it goes through the port monitored by TCP/IP monitor. I changed the value to 80 like this&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-OLZyV0Vvv_M/TgN9wb5tBEI/AAAAAAAABwg/hzWdT_nQ4RI/s1600/changeport.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 271px;" src="http://4.bp.blogspot.com/-OLZyV0Vvv_M/TgN9wb5tBEI/AAAAAAAABwg/hzWdT_nQ4RI/s400/changeport.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5621475030965486658" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Now when i run the client i can see the traffic using TCP/IP monitor like this&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-sTKHL7w9wDg/TgN99xaLbHI/AAAAAAAABwo/tiCtJMuLKW4/s1600/tcpipmonitor.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://4.bp.blogspot.com/-sTKHL7w9wDg/TgN99xaLbHI/AAAAAAAABwo/tiCtJMuLKW4/s400/tcpipmonitor.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5621475260077141106" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-1355489397919622764?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/Xya7lCoYQd8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/1355489397919622764/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=1355489397919622764" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/1355489397919622764?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/1355489397919622764?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/Xya7lCoYQd8/how-to-use-tcpip-monitor-for-web.html" title="How to use TCP/IP monitor for web service" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-KpFQjrHPM-8/TgN7jQ7BFgI/AAAAAAAABwQ/80W39uc8cLQ/s72-c/createmonitor1.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/06/how-to-use-tcpip-monitor-for-web.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QMR349eSp7ImA9WhZVEE4.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-7423555479040329409</id><published>2011-05-21T20:21:00.000-07:00</published><updated>2011-05-21T20:36:26.061-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-21T20:36:26.061-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="lcajaxproxy" /><category scheme="http://www.blogger.com/atom/ns#" term="ajaxproxy" /><title>Using Ajax Proxy in the Connections</title><content type="html">The Connections server has &lt;a href='http://wpcertification.blogspot.com/2009/03/introduction-to-ajax-proxy.html'&gt;Ajax Proxy&lt;/a&gt; that you can use to make cross domain calls. In order to try the Ajax proxy i did create a iWidget that makes call to http://www.atech.com from the page http://wpconnections.atech.com/. In order to test iWidget i did add it to &lt;a href='http://wpcertification.blogspot.com/2011/04/deploying-custom-widget-on-connections.html'&gt;Connections HomePage&lt;/a&gt;. You can download the AjaxProxy iWidget from &lt;a href=''&gt;here&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;This is how my AjaxProxy.xml file the iWidget xml definition file looks like&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" ?&amp;gt;&lt;br /&gt;&amp;lt;iw:iwidget id="AjaxProxy" &lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget" &lt;br /&gt;supportedModes="view" mode="view" lang="en" iScope="com.webspherenotes.ajaxproxy" &lt;br /&gt;allowInstanceContent="true" &amp;gt;&lt;br /&gt;&amp;lt;iw:resource uri="ajaxproxy.js" /&amp;gt;&lt;br /&gt;  &amp;lt;iw:content mode="view"&amp;gt;&lt;br /&gt;      &amp;lt;![CDATA[&lt;br /&gt;      &amp;lt;div&amp;gt;Ajax proxy&amp;lt;/div&amp;gt;&lt;br /&gt;   &amp;lt;span id="replacecontent"&amp;gt;Replace content&amp;lt;/span&amp;gt;&lt;br /&gt;      ]]&amp;gt;&lt;br /&gt;&amp;lt;/iw:content&amp;gt;&lt;br /&gt;&amp;lt;/iw:iwidget&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The ajaxproxy.xml declares ajaxproxy.js as a resource, which has all the JavaScript logic for the widget. The ajaxproxy widget displays a place holder div, &lt;code&gt;replacecontent&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This is how my ajaxproxy.js file looks like &lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;dojo.provide("com.webspherenotes.ajaxproxy");&lt;br /&gt;dojo.declare("com.webspherenotes.ajaxproxy", [], {&lt;br /&gt; onview: function(){&lt;br /&gt;       console.log("Inside the onView function()");&lt;br /&gt;    var currContext = this.iContext;&lt;br /&gt;    try{&lt;br /&gt;   dojo.xhrPost({&lt;br /&gt;  url: "/homepage/web/proxy/http/www.atech.com",&lt;br /&gt; &lt;br /&gt;  load: function(data, ioargs){&lt;br /&gt;   currContext.getElementById("replacecontent").innerHTML = data;&lt;br /&gt;   console.log(data);&lt;br /&gt;  },&lt;br /&gt;  error: function(error,ioargs){&lt;br /&gt;   alert("Error :" + data);&lt;br /&gt;  }&lt;br /&gt;   });&lt;br /&gt;   }catch(error){&lt;br /&gt;   console.log("Error in the dojo.xhrPost " + error );&lt;br /&gt;   }&lt;br /&gt;    }&lt;br /&gt;});&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The &lt;code&gt;onview()&lt;/code&gt; method of the ajaxproxy widget will get called to generate the VIEW mode markup, in this method i am making &lt;code&gt;HTTP POST&lt;/code&gt; to &lt;code&gt;/homepage/web/proxy/http/www.atech.com&lt;/code&gt; which actually means http://www.atech.com, once the response is back i will get control in the load() method and i am using the response to display markup in the widget, which looks like this&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-VdeGXVxgoXQ/TdiEY0KwBgI/AAAAAAAABwE/rA1DNP5RwU4/s1600/ajaxproxymarkup.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 225px;" src="http://2.bp.blogspot.com/-VdeGXVxgoXQ/TdiEY0KwBgI/AAAAAAAABwE/rA1DNP5RwU4/s400/ajaxproxymarkup.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5609378897745413634" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The markup looks unformatted because it does not include the necessary resources. When you deploy the widget on your server it will fail with 403 forbidden error at the time of making &lt;code&gt;xhrPost()&lt;/code&gt; call unless your ajax proxy is configured to make POST request.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-7423555479040329409?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/_E-kKAggiCM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/7423555479040329409/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=7423555479040329409" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/7423555479040329409?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/7423555479040329409?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/_E-kKAggiCM/using-ajax-proxy-in-connections.html" title="Using Ajax Proxy in the Connections" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-VdeGXVxgoXQ/TdiEY0KwBgI/AAAAAAAABwE/rA1DNP5RwU4/s72-c/ajaxproxymarkup.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/05/using-ajax-proxy-in-connections.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEEFR3w_fip7ImA9WhZVEE4.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-2968404347057661352</id><published>2011-05-20T09:53:00.000-07:00</published><updated>2011-05-21T19:50:16.246-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-21T19:50:16.246-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="lcajaxproxy" /><category scheme="http://www.blogger.com/atom/ns#" term="ajaxproxy" /><title>Troubleshooting Ajax Proxy</title><content type="html">I was trying to configure the Ajax proxy in the Connections product but i ran into bunch of issues, so i had to figure out how to turn the trace for Ajax proxy by turning trace for &lt;code&gt;com.ibm.ws.ajaxproxy.*=all&lt;/code&gt; but once i did i can see it does generate good trace like this. &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;[5/19/11 22:02:38:407 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service entering service(..)com.ibm.ws.ajaxproxy.servlet.ProxyServlet&lt;br /&gt;[5/19/11 22:02:38:501 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service &lt;br /&gt;&lt;b&gt;com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) Method:GET; URI:/homepage/web/proxy/ibm/us/en/sandbox/ver1/; QueryString:null; ContextPath:/homepage; ServletPath:/web/proxy; PathInfo:/ibm/us/en/sandbox/ver1/&lt;br /&gt;[5/19/11 22:02:38:501 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) targetPath: http://www.ibm.com&lt;br /&gt;[5/19/11 22:02:38:501 PDT] 00000087 Policy        3 com.ibm.ws.ajaxproxy.proxy.RequestBean &lt;init&gt; com.ibm.ws.ajaxproxy.proxy.Policy RequestBean(URL, String, String):[Ljava.lang.Object;@6f726f72&lt;br /&gt;[5/19/11 22:02:38:501 PDT] 00000087 Policy        3 com.ibm.ws.ajaxproxy.proxy.RequestBean &lt;init&gt; com.ibm.ws.ajaxproxy.proxy.Policy RequestBean(URL, String, String):http://www.ibm.com/ibm/us/en/sandbox/ver1/&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 URINormalizer 3 com.ibm.ws.ajaxproxy.util.URINormalizer normalize com.ibm.ws.ajaxproxy.util.URINormalizer normalize(..) Orginal URI: http://www.ibm.com/ibm/us/en/sandbox/ver1/ Normalized URI: http://www.ibm.com/ibm/us/en/sandbox/ver1/&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) Attempting to match Policy too: /http/www.ibm.com/ibm/us/en/sandbox/ver1/&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServletPolicies for: *&lt;br /&gt;&lt;br /&gt;  ACF: none&lt;br /&gt;  Actions:&lt;br /&gt;    GET&lt;br /&gt;&lt;br /&gt;  Cookies:&lt;br /&gt;&lt;br /&gt;  Headers:&lt;br /&gt;  Users:&lt;br /&gt;&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..)1305867758532&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..)1305867758532&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) HostConfiguration set too: HostConfiguration[host=http://wpconnections.atech.com]&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) Assigning GetMethod as method&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 Policy        3 com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders(..) entering&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 Policy        3 com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders(..)Reusing pattern for User-Agent&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 Policy        3 com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders(..)Reusing pattern for Accept.*&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 Policy        3 com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders(..)Reusing pattern for Content.*&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 Policy        3 com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders(..)Reusing pattern for Authorization.*&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 Policy        3 com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders com.ibm.ws.ajaxproxy.proxy.Policy getValidHeaders(..) exiting&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) Adding Request Header [User-Agent : Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1]&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) Adding Request Header [Accept-Charset : ISO-8859-1,utf-8;q=0.7,*;q=0.7]&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) Adding Request Header [Accept-Encoding : gzip, deflate]&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) Adding Request Header [Accept : text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) Adding Request Header [Accept-Language : en-us,en;q=0.5]&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 ProxyServlet  3 com.ibm.ws.ajaxproxy.servlet.ProxyServlet service com.ibm.ws.ajaxproxy.servlet.ProxyServlet service(..) Adding Request Header [Content-Type : application/x-www-form-urlencoded]&lt;br /&gt;[5/19/11 22:02:38:532 PDT] 00000087 Policy        3 com.ibm.ws.ajaxproxy.proxy.Policy getFilteredCookieString com.ibm.ws.ajaxproxy.proxy.Policy getFilteredCookieString(..) rawCookieString: editMode=false; __utma=249276503.1859418337.1303153383.1303153383.1303153383.1; __utmz=249276503.1303153383.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); JSESSIONID=0000UQ_tLLLGMSwyBt5z5_Xd10t:15td46icp; LtpaToken2=VQZuwqjVCdZQtnucuRYbpDNspppYkuTG5jaRDPRMbfI89rxcJBaJ0J4qUMgkw6M3OWJ8N2DpI5zm5f+4AIM3l5IDBdt8WiI04G6MTELExy0nTdt5pBlquum/DMA8OoTYZcpADrN/dHicV8hTiiExAjyZQrOe8WQ2QvA9hFnS1IK5wZM+C7a400lcOt3pzh1T3mr65/SPKXW2LLfFIAXIzFcrqj18Af7Ak6zcb1MmX9lFTRdgopVSxVOBq+5ReL0SJkwwuuaO/WiZptOmuP/1Js4QJ60ekfn8+AQ0znWdtV8khwgV/6Searq14egNeSswzoLdtla8XmxXvT9bN+Ht/5VtXKEXkGRwNglHlbZmg74mHIjnhgf4svqYzJM6kuWK/fnHtkFfAj5iaJQ46zYUzGwMHEMaYqfU217WliF4BD5W8wSrZPc+qYseNUb9zMQ3pF0k4sVi5fkYWWkZ9G6eWNvXCinjQPq5Xt3CtJh+sERJs3zuKepD/milfm29QCsTN0klc8bLCT+x+NFx2bwrAs2hpfywQWoFguwt3pdUw71GfaCzvSU3eIj7EmWDfzm9kQtWpDYSfzhSlbDkKb4N5joSNWlOVWk7BRqkWDqx4bSY3jLUFkg8YIAqSf07ZX4LXp0S5FGkCRs8iTZAmpWuddZoWjGkh4TZwUOKd8oGz1hCqVYsaXHK6ZOX6xjpP7dBC++1NGFeuB5dRIy2swj8MA==; LtpaToken=3FQ3Cxvhqjt0NgBdBtA7adO0uhc79AJbvbc1BgkpjWBRdRevNX0wEoT9Q66qd56aALSOlleaerpij2MXbCGkCSx2cHx/SSNjxdBqYWeXIYvG+542IsczVs3w97GxmBXURp0pc/AYTDd1+ZCmep2zGqyhnKbGNdbQJ5eHMON3KLzerrgtrX9H4rrfvLZUEH3Ejq4ota4XMwrqNz2cJCUOJxig+ygmf0oAUR34kUp+8LSebTY+P8uwEGS/d4d8uh3jWR1seXu4XHUDceqV308GH1ewCMraOEJPq2/k5Cw7vHjcd3V+xdKK3PrV+0Ao65DdyMph+XZuo8yroJ730pHqSFYkAy+TsU6DfSJZm+XTcRo=; currentUserName=was bind; currentUserHandle=546b0260-6273-497e-acfa-1e898f3037d4&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-2968404347057661352?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/CSbutS3Tabk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/2968404347057661352/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=2968404347057661352" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/2968404347057661352?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/2968404347057661352?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/CSbutS3Tabk/troubleshooting-ajax-proxy.html" title="Troubleshooting Ajax Proxy" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/05/troubleshooting-ajax-proxy.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMASH44eyp7ImA9WhZVEE4.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-262325831897025020</id><published>2011-05-10T17:15:00.000-07:00</published><updated>2011-05-21T20:04:09.033-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-21T20:04:09.033-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="lcsynchronizeldap" /><category scheme="http://www.blogger.com/atom/ns#" term="tdi" /><category scheme="http://www.blogger.com/atom/ns#" term="lotusconnection" /><title>Synchronizing between LDAP and the profiles database</title><content type="html">When you install connection, you will &lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Go to the E:\IBM\LotusConnections directory, there you will see two TDISOL.zip expand the platform specific version in the same directory like this&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-61bWLHYhaNg/TcnWqkdhBrI/AAAAAAAABvU/5j2M2uAPX7Y/s1600/TDISOL.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://3.bp.blogspot.com/-61bWLHYhaNg/TcnWqkdhBrI/AAAAAAAABvU/5j2M2uAPX7Y/s400/TDISOL.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5605247238069618354" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Open the tdienv.bat file and change value of TDIPATH to point to the location where TDI is installed on your machine, By default it is set to &lt;code&gt;C:\Program Files\IBM\TDI\V7.0&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;@REM ***************************************************************** &lt;br /&gt;@REM                                                                   &lt;br /&gt;@REM IBM Confidential                                                  &lt;br /&gt;@REM                                                                   &lt;br /&gt;@REM OCO Source Materials                                              &lt;br /&gt;@REM                                                                   &lt;br /&gt;@REM Copyright IBM Corp. 2010                                          &lt;br /&gt;@REM                                                                   &lt;br /&gt;@REM The source code for this program is not published or otherwise    &lt;br /&gt;@REM divested of its trade secrets, irrespective of what has been      &lt;br /&gt;@REM deposited with the U.S. Copyright Office.                         &lt;br /&gt;@REM                                                                   &lt;br /&gt;@REM ***************************************************************** &lt;br /&gt;&lt;br /&gt;@echo off&lt;br /&gt;IF "%TDIPATH%" == "" (&lt;br /&gt;&lt;b&gt;SET TDIPATH=E:\IBM\TDI\V7.0&lt;/b&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;IF "%TDI_CS_HOST%" == "" (&lt;br /&gt;SET TDI_CS_HOST=localhost&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;IF "%TDI_CS_PORT%" == "" (&lt;br /&gt;SET TDI_CS_PORT=1527&lt;br /&gt;)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;li&gt;Then open the profiles_tdi.properties file which is in the E:\IBM\LotusConnections\TDISOL\TDI directory in text editor and set following values&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;source_ldap_url=ldap://directory.atech.com:1389&lt;br /&gt;source_ldap_user_login=cn=root&lt;br /&gt;source_ldap_user_password=tdsadmin&lt;br /&gt;source_ldap_search_base=dc=webspherenotes,dc=com&lt;br /&gt;source_ldap_search_filter=(objectclass=inetOrgPerson)&lt;/b&gt;&lt;br /&gt;source_ldap_use_ssl=false&lt;br /&gt;source_ldap_authentication_method=Simple&lt;br /&gt;source_ldap_time_limit_seconds=0&lt;br /&gt;source_ldap_required_dn_regex=&lt;br /&gt;source_ldap_collect_dns_file=collect.dns&lt;br /&gt;source_ldap_map_functions_file=profiles_functions.js&lt;br /&gt;source_ldap_page_size=0&lt;br /&gt;source_ldap_logfile=logs/PopulateDBFromSource.log&lt;br /&gt;source_ldap_debug=true&lt;br /&gt;source_ldap_sort_attribute=&lt;br /&gt;source_ldap_sort_page_size=&lt;br /&gt;source_ldap_escape_dns=false&lt;br /&gt;source_ldap_compute_function_for_givenName=&lt;br /&gt;source_ldap_compute_function_for_sn=&lt;br /&gt;source_ldap_collect_updates_file=employee.updates&lt;br /&gt;source_ldap_binary_attributes=GUID&lt;br /&gt;source_ldap_manager_lookup_field=&lt;br /&gt;source_ldap_secretary_lookup_field=&lt;br /&gt;&lt;b&gt;dbrepos_jdbc_url=jdbc:db2://localhost:50000/peopledb&lt;/b&gt;&lt;br /&gt;dbrepos_jdbc_driver=com.ibm.db2.jcc.DB2Driver&lt;br /&gt;&lt;b&gt;dbrepos_username=LCUSER&lt;br /&gt;dbrepos_password=lcuser1&lt;/b&gt;&lt;br /&gt;dbrepos_mark_manager_if_referenced=true&lt;br /&gt;monitor_changes_debug=false&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Execute following task sync_all_dns.bat file which is in the &lt;code&gt;E:\IBM\LotusConnections\TDISOL\TDI&lt;/code&gt; directory and look at the logs in the E:\IBM\LotusConnections\TDISOL\TDI\logs directory&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;After the command is executed you should be able to see the changes right away you can keep executing the same task repeatedly&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-262325831897025020?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/w1UvnHwF-e0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/262325831897025020/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=262325831897025020" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/262325831897025020?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/262325831897025020?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/w1UvnHwF-e0/synchronizing-between-ldap-and-profiles.html" title="Synchronizing between LDAP and the profiles database" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-61bWLHYhaNg/TcnWqkdhBrI/AAAAAAAABvU/5j2M2uAPX7Y/s72-c/TDISOL.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/05/synchronizing-between-ldap-and-profiles.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4NRXw-fyp7ImA9WhZWEEg.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-136520764880894467</id><published>2011-05-10T11:01:00.000-07:00</published><updated>2011-05-10T11:59:54.257-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-10T11:59:54.257-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="googlegadget" /><category scheme="http://www.blogger.com/atom/ns#" term="lcdeploywidget" /><category scheme="http://www.blogger.com/atom/ns#" term="lotusconnection" /><title>Adding a Google gadget to Connection</title><content type="html">In the &lt;a href='http://wpcertification.blogspot.com/2011/05/adding-facebook-iwdiget-on-connections.html'&gt;Adding Facebook iWidget on the Connections Home page&lt;/a&gt; i talked about how you can add Facebook iWidget to the Connection page, If you look inside the Facebook iWidget you will notice that is simply wrapping the Facebook Google gadget which is hosted at &lt;a href='http://hosting.gmodules.com/ig/gadgets/file/100080069921643878012/facebook.xml'&gt;, i thought i will figure out the steps that are required to wrap Google gadget into Widget. I am using the &lt;a href='http://www.google.com/ig/directory?synd=open&amp;cat=tools&amp;url=http://hosting.gmodules.com/ig/gadgets/file/109162539679639397174/weather.xml'&gt;Google Weather Forcast&lt;/a&gt; as sample Gadget that i want to wrap into iWidget and it to the Connections Home page.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;First i went to &lt;a href='http://www.google.com/ig/directory?synd=open&amp;cat=all'&gt; Google Gadgets for your Web page&lt;/a&gt;, to find out all the Google Gadgets that are available to be added to my page&lt;/a&gt;&lt;br /&gt;&lt;li&gt; Then i went to the  &lt;a href='http://www.google.com/ig/directory?synd=open&amp;cat=tools&amp;url=http://hosting.gmodules.com/ig/gadgets/file/109162539679639397174/weather.xml'&gt;Weather Gadget page&lt;/a&gt;, and i did click on Add to your webpage button, on the next screen i did get screen that would let me configure the widget before adding it to page, Ex, i can select the city that i am interested in, i can change title of the gadget,...&lt;/li&gt; &lt;br /&gt;&lt;br /&gt;&lt;li&gt;After configuring the Gadget i did click on Get the code button, which gives me a HTML script tag like this &lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;script src="http://www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/100080069921643878012/facebook.xml&amp;amp;synd=open&amp;amp;w=320&amp;amp;h=400&amp;amp;title=&amp;amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;amp;output=js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;I copied this HTML into a HTML file called GoogleWeatherGadget.html file and i did copy it on my HTTP server at E:\IBM\HTTPServer\htdocs\weather&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;script src="http://www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/100080069921643878012/facebook.xml&amp;amp;synd=open&amp;amp;w=320&amp;amp;h=400&amp;amp;title=&amp;amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;amp;output=js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Next i had to create a GoogleWeatherGadget.xml file which points to the GoogleWeatherGadget.html file on my HTTP server in E:\IBM\HTTPServer\htdocs\weather directory like this&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;iw:iwidget name="googleFacebook" xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget"&amp;gt;&lt;br /&gt;   &amp;lt;iw:content mode="view"&amp;gt;&lt;br /&gt;   &amp;lt;![CDATA[&lt;br /&gt;      &amp;lt;iframe scrolling="auto" width="100%" height="330" frameborder="0" src="http://wpconnections.atech.com/weather/GoogleWeather.html"&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;        ]]&amp;gt; &lt;br /&gt;     &amp;lt;/iw:content&amp;gt;&lt;br /&gt;&amp;lt;/iw:iwidget&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In this the value of iframe src is fully qualified URL of the html page that has the Google  gadget&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The last step was to use the steps defined in &lt;a href='http://wpcertification.blogspot.com/2011/04/deploying-custom-widget-on-connections.html'&gt;Deploying custom widget on Connections Home Page &lt;/a&gt; for adding Weather widget to HomePage, If you want to add the widget to the profiles page use &lt;a href='http://wpcertification.blogspot.com/2011/05/adding-widget-on-profiles-page.html'&gt;Adding widget on profiles page &lt;/a&gt; for more information&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;This is how my HomePage looks like after adding it Weather widget to it &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-8W5cwfh8Na0/TcmLA68u6kI/AAAAAAAABvM/7sa2lyYk0eI/s1600/weather.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://1.bp.blogspot.com/-8W5cwfh8Na0/TcmLA68u6kI/AAAAAAAABvM/7sa2lyYk0eI/s400/weather.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5605164059179543106" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-136520764880894467?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/zww1pbhOxlw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/136520764880894467/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=136520764880894467" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/136520764880894467?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/136520764880894467?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/zww1pbhOxlw/adding-google-gadget-to-connection.html" title="Adding a Google gadget to Connection" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-8W5cwfh8Na0/TcmLA68u6kI/AAAAAAAABvM/7sa2lyYk0eI/s72-c/weather.JPG" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/05/adding-google-gadget-to-connection.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkAAQHg8fSp7ImA9WhZWEEk.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-5850869462685007226</id><published>2011-05-10T10:27:00.000-07:00</published><updated>2011-05-10T10:32:21.675-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-10T10:32:21.675-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="was8" /><title>WAS 8 is out</title><content type="html">I saw &lt;a href='http://www-03.ibm.com/press/us/en/pressrelease/34242.wss#release'&gt; WebSphere Application Server 8 &lt;/a&gt;  is out press release today. It looks like bunch of other software products are also released. The main focus is on Mobile, cloud,...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-5850869462685007226?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/Ym61nMZrH6o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/5850869462685007226/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=5850869462685007226" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/5850869462685007226?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/5850869462685007226?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/Ym61nMZrH6o/was-8-is-out.html" title="WAS 8 is out" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/05/was-8-is-out.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkYDRHw6fSp7ImA9WhZWEEg.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-3769508472942540958</id><published>2011-05-10T07:26:00.000-07:00</published><updated>2011-05-10T10:56:15.215-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-10T10:56:15.215-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iwidget" /><category scheme="http://www.blogger.com/atom/ns#" term="lcdeploywidget" /><category scheme="http://www.blogger.com/atom/ns#" term="lotusconnection" /><title>Adding facebook iwdiget on the Connections Home page</title><content type="html">YOu can add iWidgets to either Home, Profile or Communities page in the Connections. If you go to the &lt;a href='https://greenhouse.lotus.com/plugins/plugincatalog.nsf/home_full.xsp?fProduct=Lotus%20Connections'&gt;IBM Lotus and WebSphere Portal Business Solutions Catalog&lt;/a&gt; and search for Lotus Connections, you will find bunch of iWidgets that you can use, there is iWidget for LinkedIn, Facebook, Twitter, Flickr,... &lt;br /&gt;&lt;br /&gt;I wanted to try the iWidget for Facebook and these are the steps that i followed &lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;First i did download the Facebook iWidget from the &lt;a href='https://greenhouse.lotus.com/plugins/plugincatalog.nsf/assetDetails.xsp?action=editDocument&amp;documentId=A673B06B3EDE6B7D852576020075CB2B'&gt;Solution Catalog&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt; When i looked inside the .zip file i could see that it contains a FacebookGoogleGadget.xml (iWidget .xml file) and GoogleFacebook.html (Google gadget html file), i want to host this on my HTTP server so i did unzip it into the document root of my HTTP server at E:\IBM\HTTPServer\htdocs&lt;/li&gt;&lt;br /&gt;&lt;li&gt; Then i verified that i can access the FacebookGoogleGadget.xml at &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-AIFLASVkm9E/Tcl5LLXEZUI/AAAAAAAABu8/rGydgLVLh54/s1600/verifyfacebook.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://4.bp.blogspot.com/-AIFLASVkm9E/Tcl5LLXEZUI/AAAAAAAABu8/rGydgLVLh54/s400/verifyfacebook.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5605144444174361922" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The last step was to use the steps defined in &lt;a href='http://wpcertification.blogspot.com/2011/04/deploying-custom-widget-on-connections.html'&gt;Deploying custom widget on Connections Home Page &lt;/a&gt; for adding Facebook widget to HomePage, If you want to add the widget to the profiles page use &lt;a href='http://wpcertification.blogspot.com/2011/05/adding-widget-on-profiles-page.html'&gt;Adding widget on profiles page &lt;/a&gt; for more information&lt;/li&gt;&lt;br /&gt;&lt;li&gt;After the widget is added to home page i went to home page and it did prompt me for my facebook login and once i supply my login information i could see my facebook page&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-bwkjaq8QIiA/Tcl8LHDYNNI/AAAAAAAABvE/cYPjQ7Ne41E/s1600/facebookwidget.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://4.bp.blogspot.com/-bwkjaq8QIiA/Tcl8LHDYNNI/AAAAAAAABvE/cYPjQ7Ne41E/s400/facebookwidget.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5605147741552915666" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Using Facebook iWidget turned out to be really easy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-3769508472942540958?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/xkpnMpFLXA0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/3769508472942540958/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=3769508472942540958" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/3769508472942540958?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/3769508472942540958?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/xkpnMpFLXA0/adding-facebook-iwdiget-on-connections.html" title="Adding facebook iwdiget on the Connections Home page" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-AIFLASVkm9E/Tcl5LLXEZUI/AAAAAAAABu8/rGydgLVLh54/s72-c/verifyfacebook.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/05/adding-facebook-iwdiget-on-connections.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4BQXc4fip7ImA9WhZWEE4.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-3733014236816549760</id><published>2011-05-10T06:56:00.000-07:00</published><updated>2011-05-10T07:32:30.936-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-10T07:32:30.936-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iwidget" /><category scheme="http://www.blogger.com/atom/ns#" term="lotusconnection" /><title>Adding widget on profiles  page</title><content type="html">I was trying to add LinkedIn iWidget to my Connection's Homepage and as part of that process i had to figure out how to add custom iWidget to the profiles page, during the process i learned that the process for adding custom iWidget on profiles page is very similar to adding iWidget on the communities page. &lt;br /&gt;&lt;br /&gt;The configuration for the iWidget is stored in widgets-config.xml file, This file has two sections one for profiles and other for communities. While adding iWidget first i had to add the definition of the iWidget, by that i mean point to the URL, define preferences,... The widget-config.xml file also has page definition in xml format, so i had to add the widget definition to the suitable position on the page, i followed these steps to add LinkedIn iWidget &lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Connect to Deployment manager of your lotus connection server using wsadmin client&lt;br /&gt;&lt;code&gt;&lt;br /&gt;wsadmin.bat -lang jython -username wasadmin -password wasadmin -port 8879&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The profilesAdmin.py has some jython functions that make administration of the profiles functionality easier, you should execute that file to make the functions available in the wsadmin console by calling &lt;br /&gt;&lt;code&gt;&lt;br /&gt;execfile("profilesAdmin.py")&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Checkout the currents widgets-config.xml in c:/temp using following command&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ProfilesConfigService.checkOutWidgetConfig("c:/temp", "wpconnectionsCell01")&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;Open the widgets-config.xml file using a text editor, you will notice that it has two top level resource elements one for profiles and other for communities. Expand the profiles related related element. You will find bunch of widgetDef elements in that file add following widgetDef element at the end pointing to HelloWorld widget&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;widgetDef defId="HelloWorld" url="/hellowidget.xml"&amp;gt;&lt;br /&gt;&amp;lt;/widgetDef&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;In my case the hellowidget.xml is available on HTTP server at the root. Once widget is defined next step is to add it to one or more pages, under the layout element you will have multiple page elements, you can add the widget definition to one of the pages here, In my case i want to add HelloWorld widget to 3rd column on the profilesView page, so i did add it to the page like this&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;page pageId="profilesView"&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="col2" defIdRef="multiWidget"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="multiWidget" defIdRef="board"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="multiWidget" defIdRef="contactInfo"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="multiWidget" defIdRef="backgroundInfo"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="multiWidget" defIdRef="multiFeedReader"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="col1" defIdRef="socialTags"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="col1" defIdRef="sand_thingsInCommon"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="col1" defIdRef="LinkedIn"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="col3" defIdRef="sand_socialPath"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="col3" defIdRef="reportStructure"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="col3" defIdRef="friends"/&amp;gt;&lt;br /&gt; &amp;lt;widgetInstance uiLocation="col3" defIdRef="linkRoll"/&amp;gt;&lt;br /&gt; &lt;b&gt;&amp;lt;widgetInstance uiLocation="col3" defIdRef="HelloWorld"/&amp;gt;&lt;/b&gt;&lt;br /&gt;&amp;lt;/page&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Once your done making changes to the widgets-config.xml file you can check it in by executing following wsadmin command&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ProfilesConfigService.checkInWidgetConfig()&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;You can synchronize your changes across the nodes by executing following wsadmin function&lt;br /&gt;&lt;code&gt;&lt;br /&gt;synchAllNodes()&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Restart the Profiels application using the WAS Admin console for changes to take effect&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-tWnp5ez3OHY/TclMVPgD9iI/AAAAAAAABu0/mutwxeAZxlA/s1600/customwidget.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://3.bp.blogspot.com/-tWnp5ez3OHY/TclMVPgD9iI/AAAAAAAABu0/mutwxeAZxlA/s400/customwidget.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5605095139061265954" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-3733014236816549760?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/ZuQO5LM0Flk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/3733014236816549760/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=3733014236816549760" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/3733014236816549760?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/3733014236816549760?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/ZuQO5LM0Flk/adding-widget-on-profiles-page.html" title="Adding widget on profiles  page" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-tWnp5ez3OHY/TclMVPgD9iI/AAAAAAAABu0/mutwxeAZxlA/s72-c/customwidget.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/05/adding-widget-on-profiles-page.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QGRH4zeip7ImA9WhZXGUg.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-156391985723360916</id><published>2011-05-09T07:25:00.000-07:00</published><updated>2011-05-09T07:28:45.082-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-09T07:28:45.082-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="lotusconnection3" /><category scheme="http://www.blogger.com/atom/ns#" term="lotusconnection" /><title>Connections solution catalog</title><content type="html">The &lt;a href='https://greenhouse.lotus.com/catalog/home_full.xsp?fProduct=Lotus%20Connections'&gt;IBM Lotus and WebSphere Portal Business Solutions Catalog&lt;/a&gt; provides some ready made components that you might be interested in. It has some of the useful iWidgets such as iWidget for LinkedIn, facebook,... It also has plugings for Microsoft Outlook, Lotus Notes,...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-156391985723360916?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/9cEQralawnY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/156391985723360916/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=156391985723360916" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/156391985723360916?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/156391985723360916?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/9cEQralawnY/connections-solution-catalog.html" title="Connections solution catalog" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/05/connections-solution-catalog.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMAQXc4fip7ImA9WhZXEU0.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-4187726171153217519</id><published>2011-04-29T11:56:00.000-07:00</published><updated>2011-04-29T12:14:00.936-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-29T12:14:00.936-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="connectionapi" /><category scheme="http://www.blogger.com/atom/ns#" term="lotusconnection" /><title>Using Apache Abdera for working with Lotus Connections API</title><content type="html">In the &lt;a href='http://wpcertification.blogspot.com/2011/04/using-connection-api.html'&gt;Connections API&lt;/a&gt; entry i blogged about how to make a REST call to the Connection server using simple Java based API, But in order to work with Connections we need two parts first is ability to make HTTP call and other is ability to parse the feed and get information from it.&lt;br /&gt;&lt;br /&gt;The Apache Abdera project library provides infrastructure to help in both these infrastructure pieces. Both the part to make HTTP call and the part required for parsing and working with feed. I wanted to try this so i did create this HelloProfileAPI.java which is standalone Java application which makes a call to profile service and returns the result in ATOM format, once the results are returned it prints the content of feed entries on &lt;code&gt;System.Out&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;package com.webspherenotes.connections;&lt;br /&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.io.InputStream;&lt;br /&gt;import java.net.HttpURLConnection;&lt;br /&gt;import java.net.MalformedURLException;&lt;br /&gt;import java.net.URL;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;import org.apache.abdera.Abdera;&lt;br /&gt;import org.apache.abdera.model.Document;&lt;br /&gt;import org.apache.abdera.model.Entry;&lt;br /&gt;import org.apache.abdera.model.Feed;&lt;br /&gt;import org.apache.abdera.parser.Parser;&lt;br /&gt;&lt;br /&gt;public class HelloProfileAPI {&lt;br /&gt;&lt;br /&gt;  public static void main(String[] args) {&lt;br /&gt;    try {&lt;br /&gt;      URL url = new URL(&lt;br /&gt;          "http://wpconnections.atech.com/profiles/atom/search.do?name=was");&lt;br /&gt;&lt;br /&gt;      // Open the URL: throws exception if not found&lt;br /&gt;      HttpURLConnection conn = (HttpURLConnection) url.openConnection();&lt;br /&gt;      conn.connect();&lt;br /&gt;      InputStream inputStream = conn.getInputStream();&lt;br /&gt;      Abdera abdera = new Abdera();&lt;br /&gt;      Parser parser = abdera.getParser();&lt;br /&gt;      Document&lt;Feed&gt; feed_doc = parser.parse(inputStream);&lt;br /&gt;      Feed feed = feed_doc.getRoot();&lt;br /&gt;      List&lt;Entry&gt; entryList = feed.getEntries();&lt;br /&gt;      for (Entry e : entryList) {&lt;br /&gt;        System.out.println(e.getContent());&lt;br /&gt;      }&lt;br /&gt;    } catch (MalformedURLException e) {&lt;br /&gt;      e.printStackTrace(System.out);&lt;br /&gt;    } catch (IOException e) {&lt;br /&gt;      e.printStackTrace(System.out);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In this case i am making call to &lt;code&gt;          "http://wpconnections.atech.com/profiles/atom/search.do?name=was"&lt;/code&gt; and then parsing the feed and then i am printing content of feed entry to System.out. In my case there is only one user with name equal to was so it returns big chunk of HTML for that user like this &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;span xmlns="http://www.w3.org/1999/xhtml" class="vcard"&amp;gt;&amp;lt;div&amp;gt;&amp;lt;img src="http://wpconnections.atech.com/profiles/photo.do?key=c3219b57-5e65-4c50-b00a-3e722315d035&amp;amp;lastMod=1302886728960" class="photo"&amp;gt;&amp;lt;/img&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;&amp;lt;a class="fn url" href="http://wpconnections.atech.com/profiles/atom/profile.do?key=c3219b57-5e65-4c50-b00a-3e722315d035"&amp;gt;was bind&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;&amp;lt;a class="sound url" href="http://wpconnections.atech.com/profiles/audio.do?key=c3219b57-5e65-4c50-b00a-3e722315d035&amp;amp;lastMod=1302886728960"&amp;gt;Pronunciation&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class="x-groupwareMail" style="display:none"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class="org"&amp;gt;&amp;lt;span class="organization-unit"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class="role"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class="title"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class="x-office"&amp;gt;&amp;lt;span class="x-building"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class="x-floor"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class="x-office-number"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class="tel"&amp;gt;&amp;lt;abbr class="type" title="work"&amp;gt;Work:&amp;lt;/abbr&amp;gt;&amp;lt;span class="value"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class="x-manager-uid" style="display:none"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class="x-is-manager" style="display:none"&amp;gt;N&amp;lt;/div&amp;gt;&amp;lt;div class="x-profile-key"&amp;gt;c3219b57-5e65-4c50-b00a-3e722315d035&amp;lt;/div&amp;gt;&amp;lt;div class="uid"&amp;gt;546b0260-6273-497e-acfa-1e898f3037d4&amp;lt;/div&amp;gt;&amp;lt;div class="x-profile-uid"&amp;gt;wasbind&amp;lt;/div&amp;gt;&amp;lt;div class="x-lconn-userid"&amp;gt;546b0260-6273-497e-acfa-1e898f3037d4&amp;lt;/div&amp;gt;&amp;lt;div class="rev" style="display:none"&amp;gt;2011-04-15T16:58:48.960Z&amp;lt;/div&amp;gt;&amp;lt;div class="x-profile-type" style="display:none"&amp;gt;default&amp;lt;/div&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I tried pasting the HTML in a simple test.html to see what is getting returned and i can see the markup for person card like this&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-3_T2-F2ercU/TbsN5y6WJxI/AAAAAAAABus/h4W5wlueOH8/s1600/personcard.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://3.bp.blogspot.com/-3_T2-F2ercU/TbsN5y6WJxI/AAAAAAAABus/h4W5wlueOH8/s400/personcard.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5601085848135542546" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-4187726171153217519?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/-YNv5RQ1NVs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/4187726171153217519/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=4187726171153217519" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/4187726171153217519?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/4187726171153217519?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/-YNv5RQ1NVs/using-apache-abdera-for-working-with.html" title="Using Apache Abdera for working with Lotus Connections API" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-3_T2-F2ercU/TbsN5y6WJxI/AAAAAAAABus/h4W5wlueOH8/s72-c/personcard.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/04/using-apache-abdera-for-working-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkINRXYzeyp7ImA9WhZXEU0.&quot;"><id>tag:blogger.com,1999:blog-2202766463251903159.post-7737322426136781240</id><published>2011-04-29T10:37:00.000-07:00</published><updated>2011-04-29T11:09:54.883-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-29T11:09:54.883-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="connectionapi" /><category scheme="http://www.blogger.com/atom/ns#" term="lotusconnection" /><title>Using Connection API</title><content type="html">There could be situations when you would want to use the Connections API for interacting with Connections from outside the Web interface provided by Connection. Ex, you want to create a custom web application or portlet that will let you search for user in the Connection profile repository or want to pull users blog entries and display them outside, if thats the case you should use the REST API provided by Connections, basic idea is you make a HTTP call from your application to Connection, and it will return ATOM based response, you can then parse the feed,.. If you want to post data to connections you will have to create ATOM feed and send it to Connection using HTTP using either HTTP POST or PUT methods or you can delete a record by calling HTTP DELETE method.&lt;br /&gt;&lt;br /&gt;I wanted to try this feature so i did create a simple standalone Java application which makes use of plain java to make a HTTP call with name of the user as argument to profiles feature in Connections and the Connections server will return list of all the users with matching name and i will print the output to Standard output&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;package com.webspherenotes.ssl;&lt;br /&gt;&lt;br /&gt;import java.io.BufferedReader;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.io.InputStream;&lt;br /&gt;import java.io.InputStreamReader;&lt;br /&gt;import java.net.HttpURLConnection;&lt;br /&gt;import java.net.MalformedURLException;&lt;br /&gt;import java.net.URL;&lt;br /&gt;&lt;br /&gt;public class HelloSSL {&lt;br /&gt;&lt;br /&gt;  public static void main(String[] args) {&lt;br /&gt;        try {&lt;br /&gt;      URL url = &lt;br /&gt;      new URL("http://wpconnections.atech.com/profiles/atom/search.do?name=was");&lt;br /&gt;      &lt;br /&gt;      // Open the URL: throws exception if not found&lt;br /&gt;      HttpURLConnection conn = &lt;br /&gt;       (HttpURLConnection)url.openConnection();&lt;br /&gt;      conn.connect();&lt;br /&gt;      InputStream inputStream = conn.getInputStream();&lt;br /&gt;      BufferedReader reader = &lt;br /&gt;      new BufferedReader(new InputStreamReader(inputStream));&lt;br /&gt;      String line = null;&lt;br /&gt;      while((line = reader.readLine()) != null){&lt;br /&gt;        System.out.println(line);&lt;br /&gt;      }&lt;br /&gt;    } catch (MalformedURLException e) {&lt;br /&gt;      e.printStackTrace(System.out);&lt;br /&gt;    } catch (IOException e) {&lt;br /&gt;      e.printStackTrace(System.out);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In my case the profiles application is available at &lt;code&gt;http://wpconnections.atech.com/profiles&lt;/code&gt; and i am calling the Search API with one parameter &lt;code&gt;name=was&lt;/code&gt;, which is my search criteria. Similarly you can search for all the users from say Fremont city by passing city=fremont as argument.&lt;br /&gt;&lt;br /&gt;Connection will return a search result in ATOM feed format, i am reading that response and printing it to System.out.Take a look at &lt;a href='http://www-10.lotus.com/ldd/lcwiki.nsf/dx/Lotus_Connections_APIs_lc3'&gt;Lotus Connections API&lt;/a&gt; document for more information what API meets your requirement and what are the inputs and outputs of the API call.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2202766463251903159-7737322426136781240?l=wpcertification.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WebspherePortalCertification/~4/q8nVxZRkrYU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://wpcertification.blogspot.com/feeds/7737322426136781240/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2202766463251903159&amp;postID=7737322426136781240" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/7737322426136781240?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2202766463251903159/posts/default/7737322426136781240?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WebspherePortalCertification/~3/q8nVxZRkrYU/using-connection-api.html" title="Using Connection API" /><author><name>Sunil Patil</name><uri>http://www.blogger.com/profile/16075929903536310688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://wpcertification.blogspot.com/2011/04/using-connection-api.html</feedburner:origLink></entry></feed>

