2. Welcome
Zurich Insurance Group (Zurich) is a leading multi-line insurance provider with a global network of
subsidiaries and offices in Europe, North America, Latin America, Asia-Pacific and the Middle East as
well as other markets. For more information about the products and services it offers and people
Zurich employs around the world, go to http://www.zurichna.com/zna/aboutzurich/zna-home.htm.
In North America, Zurich (www.zurichna.com) is a leading commercial property-casualty insurance
provider serving the global corporate, large corporate, middle markets, specialties and programs
sectors. In addition, Zurich also offers life insurance products and services. 2012 marks Zurich’s 100
year anniversary of insuring America and the success of its customers, shareholders and employees.
Further information about Zurich’s 100 year anniversary of insuring America is available at
http://www.zurichna.com/100.
3. Architecture Landscape
• SFDC is the strategic platform to provide single-pane-of-glass user experience
• Service-Oriented Architecture established enterprise-wide
– SFDC exchanges data with on-premise applications via Enterprise Service Bus (ESB)
EnterpriseServiceBus
4. The Challenge is..
• Existing service contracts (defined in WSDLs) are based on IBM’s Industry Model
for Insurance
• These WSDLs uncovered some limitations of the WSDL2Apex tool
– Unsupported data types
– Complex namespace inheritance structure
– Multiple XSD imports into a single WSDL; otherwise a consolidated WSDL may exceed size limit
• Known workaround options didn’t work well
– Manually trim down each WSDL to fit in WSDL2Apex
– Develop custom APEX parser per service
5. POC: WSDL2Apex Stub vs. Framework
Results captured, with permissions to use, from http://www.villagechief.com/product/codescan
6. Overview of the Framework
• An abstract base class for requests
– Represents all type of requests
– Allows developers to inject logic to generate actual XML requests
• A generic XML parser class
– Parses XML stream into Map structures
• A common response class
– Checks the status of invocation
– Manages the Maps (containing data and metadata)
– Retrieves values using XPath-like keys
7. Sample Request Class – Per Service Endpoint
public class WeatherRequest extends EasySOARequest {
private String zipCode = ‘’;
public WeatherRequest() {
super();
httpMethod = 'POST';
endpoint = 'http://wsf.cdyne.com/WeatherWS/Weather.asmx';
headers.put('Content-Type', 'text/xml; charset=utf-8');
timeOut = 120000;
}
public void setZipCode(String s) {zipcode = s;}
public override String getPayload() {
return getSOAPRequest(‘<GetCityForecastByZIP><ZIP>’ + zipcode +
‘</ZIP></GetCityForecastByZIP>‘);
}
}
10. How the Framework Works..
2: populateReqData
4: callout
6: isValid
8: retrieveElements
11. Sample Invoker Class – Pattern-Based Development
// initiate a request object
WeatherRequest req = new WeatherRequest();
req.setZipCode(myAccount.zipcode);
// make the callout
EasySOAResponse resp = req.callout();
// check the status of a callout
if (! resp.isValid()) {
// handle exception;
}
// process data in the response
myAccount.WeatherStation = resp.retrieveElement(‘/ForecastReturn/WeatherStationCity’);
12. More Enriched Features
• Built out one more generic parser for JSON
• Support dynamically creating or populating Sobjects
Map<String, String> m = EasySOAHelper.getMappingRules(‘MyMappingRules__c');
resp.createNewSObject(‘MySObject', m);
Or
Map<String, String> m = EasySOAHelper.getMappingRules(‘MyMappingRules__c');
MySObject obj = new MySObject();
resp.populateFields(obj, m);
• Published a managed package – “Easy XML, JSON and Web Services”
https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B5DqiEAF
13. Goals Achieved; Uncovered Hidden Gems!
• Time saving in development phase per service
• Single set of APIs for SOAP, JSON, or Restful web services
• Highly configurable module supporting dynamic modifications
• Leverages WS-Security headers programmatically
• Significant reduction in code base
• True parallel development among SFDC development team, Service modeling
team, and Service implementation team