Web Service Connector (WSC) and Duplicate boolean Getters

If you have worked with Salesforce WebService API or Metadata API from within Java environment, then it is possible that you might have used Salesforce WSC. This is a all inclusive high performance WebService stack, designed to access the Salesforce APIs easily.

I have been using that for a tool I have been working on and it has been working great.

One issue I found with this library is that it generates two getters for boolean variables (Both get and is variant). Some tools (like Jackson) doesn’t like this fact and complain about it.

org.codehaus.jackson.map.JsonMappingException: Conflicting getter definitions for property "booleanVariable"

Fortunately, it is easy fix this issue. WSC uses templates to generate the Java files. These templates are there in com.sforce.ws.tools. Template which generates the type source files is type.template. In this template, replace the following,

public <%=gen.javaType(el)%> <%=gen.getMethod(el)%>() {
    return <%=gen.fieldName(el)%>;


<% if(!"boolean".equals(gen.javaType(el))) { %>
  public <%=gen.javaType(el)%> <%=gen.getMethod(el)%>() {
    return <%=gen.fieldName(el)%>;
  <% }/**end if()*/%>

This should avoid generating the duplicate getters for boolean variables.

Enhanced service from Servers

You might have experienced this. You want to see an article in some site. When you navigate using your smart phone to read the article, instead of showing the article, site would show you the mobile version of their home page with assumption that they are providing you the enhanced service :). It just freaks me out and I wonder why they do that.

Well, Xkcd, says it well.

Hi I'm a Server