Wednesday, March 28, 2012

Polyglot Platform

Platform as a service (PaaS) like Salesforce, Heroku has evolved a new range of programmers called as Polyglot programmers; these programmers normally know  multiple languages.I have seen the era where a programmer used to code and master in single language across this career. But now that era is about to vanish and with the success of cloud and platforms like Heroku which support multiple languages on a single platform making demand of Polyglot programmers. This is amazing change going over and I am lucky to witness and part of it.....


I will keep posting on this.....


Thursday, February 23, 2012

Salesforce.com - Common issues while creating APEX from WSDL file

I faced lots of issues while creating APEX classes Generated by wsdl2apex tool of Salesforce. I really want to take note on some nasty ones which keep our days/night busy.

If you ever had chance to work this yourself you must know that Salesforce does not support WSDL with <Import> tags; it means if your client or fellow external application team member provides you a WSDL which have couple of these tags then Salesforce will straightaway reject these saying <import> is not supported. Only solution to work this is manually copying the referenced schema to the parent wsdl file.

Let say you WSDL file looks something like this..this is an example of Referenced Schema

 <wsdl:types>
   <xsd:schema targetNamespace="test.namespace">
      <xsd:import schemaLocation="testlocation" namespace="test.namespace"/>
    </xsd:schema>

 </wsdl:types>

Here above highlighted import tags are not supported. The solution for the above issue is simple ; just copy paste the content of schema from location "testlocation" inside <wsdl:types>, thats it. Some times there are dozens of import statements in WSDL and it becomes deficult to manually do so and these manual changes are error prone. So I will recommend to search for some WSDL flatner tool for this. I have used this one couple of times  http://wsdlflattener.codeplex.com .

Also if your WSDL  contains reference to another WSDL like the one highlighted below; this is an example of Referenced WSDL


<wsdl:definitions name="testservice" targetNamespace="testns" >
    <wsdl:import namespace="testwsdl" location="testlocation"/>

       <wsdl:types>.........
         ........
         .......
       </wsdl:types>
         ...................
         ...................
</wsdl:definitions>


This situation requires pure manual intervention as this is not supported by any flattner tool as of now.In fact the correct statement would be I am not able to find such tool myself till now.Now the steps needed to resolve this are -

  • Use  http://wsdlflattener.codeplex.com tool and create the flattened file.This will copy the Schemas from referenced WSDL location and auto merge some of the <WSDL:definition> tags.
  • Go to the referenced WSDL file ; copy the following tags from the referenced location to the parent WSDL - <wsdl:message> and <wsdl:portType>
  • Copy the targetnamespace="xyzee" from referenced WSDL location to <WSDL:definition> of Parent.
  • You need to check if any other namespace is required to be copied from referenced WSDL to  Parent WSDL:definition; you can do this my comparing the namespaces used.


Hope these steps will resolve some of your issues if you comes up with problems.