Upload
salesforce-developers
View
479
Download
4
Embed Size (px)
DESCRIPTION
Web Services streamline integration projects when using the Force.com platform with other languages and frameworks. Join us as we demonstrate, through hands-on code examples, some best practices around integration, discuss issues around security, and learn how to consume Web Services from Force.com .Net & PHP projects. We'll cover how to build the receiving Web Service and how to drive outbound Web Service calls from triggers, Visualforce pages, and workflows.
Citation preview
Integrations using Web ServicesExamples with .NET & PHP
Martin Haagen, QlikTech, Systems Manager; CRM@sehaagen
Safe HarborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Martin HaagenSystems Manager; CRM@sehaagen
IntroductionMartin Haagen, QlikTech
What We Solved With Web Service integrationsSSO solution
▪ Expectations• Smooth and seem less experience for users• Minimize data maintenance for internal staff
▪ Authentication schemes: SAML, form posts, token based▪ Automatic mappings to company for new customer / partner▪ Easy user management for internal staff
What Have We Solved With Web Service integrationsDynamic Sharing
▪ Sharing set by field values on objects or related objects▪ Change of data can require sharing rule recalculation▪ Process expensive on SOQL limits
Session OutlineOutbound Web Services
▪ Originating in Salesforce targeting PHP / .NET web services▪ From APEX using triggers or Visual Force controllers▪ Outbound Message using Workflows
Inbound Web Services▪ Host your web service on the force.com platform
Security and lessons learned
Outbound Web Service Calls
WSDLs▪ Web Service Description Language▪ XML – Contract▪ Salesforce provides WSDLs for the different SOAP APIs▪ Use WSDL to generate Service / Client interfaces▪ Custom or third party Web Services usually provides the WSDL by
adding ?wsdl to the endpoint.
Generate proxy from WSDL in SalesforceLimitations to WSDL parser (wsdl2apex)http://bit.ly/dudMQvNot supported:
▪ RPC/Encoded Services▪ Multiple ports / services▪ @imports
Outbound – WSDL - .NET 2.0
Outbound – WSDL - WCF
Outbound - ConsiderationsIs @future (Callout = true) when called from triggers.
Cannot be called from Controller Constructor – use VisualForce – ”action”.
<apex:page
controller="CustomCreditStatusController"
action="{!doRedirectionNET}">
Governor Limits
Description LimitsTotal number of callouts in a transaction 10Maximum timeout for all callouts in a transaction 120 secondsTotal number of methods with the @future annotation allowed per Apex invocation 10
Maximum response data size is 3MB.
Outbound
Demo - .NET / C#
Outbound Messages
Outbound message from a Workflow▪ Configure workflow with outbound message▪ Define endpoint▪ Use WSDL to create interfaces / proxy
Outbound message from a Workflow
.NET – Generate the interface▪ wsdl.exe /serverInterface file.wsdl▪ SvcUtil.exe – for MCF▪ Codeplex – Wscfblue
http://wscfblue.codeplex.com/▪ Use session to handle callbacks with SOAP API
PHP – Generate class / proxy▪ WSDL2PHP
http://sourceforge.net/projects/wsdl2php/▪ Use session with PHP Toolkit to handle callback
Demo PHP
Inbound Web Services
Web Service SOAP APIEnterprise WSDL
▪ Custom objects▪ Generated from the structure in the current Salesforce Org
Partner WSDL▪ Query field / object existence before use▪ General API
REST APIRepresentational State TransferShort about all the available APIs - http://bit.ly/nPrXHGTypical applications
▪ Mobile▪ Web Applications▪ Chatter
Host Web Service on force.comExpose class methods in APEX
▪ Class needs to be defined as “global”▪ Method needs to be declared as “webservice static”
Methods available via SOAP and REST.Generate WSDL from Classes list.
Security, Gotchas and Tip & Tricks
Security▪ Multi tenant platform – secure external Web Services▪ IP Filtering▪ Username and Passwords using Basic authentication▪ SSL certificates
Gotchas and Tip & TricksOutbound calls
▪ Limits and triggers• 10 outbound calls per context• 10 @future calls per context
▪ Avoid call in loops – just like SOQL▪ Make Web Service methods support collection of data
Gotchas and Tip & TricksTesting
▪ Test methods are aborted if containing outbound calls▪ Use Mock classes to
• Improve test coverage• Simulate responses from web services• @future calls runs / completes when test.stopTest() is done
Gotchas and Tip & TricksTraffic inspection
▪ In regular web service development: fiddler2 ▪ Force.com: use developer instance
Remember to add remote site settings
SummaryOutbound web service calls
▪ Triggers and VF pages▪ Workflow rules
Inbound web service callsSecurity considerationsTip & TricksDemo code on GitHubhttps://github.com/haagen/DF13_WebServices_NETPHP
Martin Haagen
Systems Manager; CRM,@sehaagen
We want to hear from YOU!
Please take a moment to complete our session survey
Surveys can be found in the “My Agenda” portion of the Dreamforce app