Skip to content

Fort Lauderdale Budget Data with Dygraphs

For those of you that don’t know,

Even though this data may not have been a perfect fit, I struggled with the 0 to visualized portion of Dygraphs longing for more basic and easy to follow examples. I have chopped up this tutorial into easy to follow steps and made it available on github. It’s a great way to learn about city data and data visualization using javascript.

Step 0 – Plain Jane

Step0-PlainJaneThis represents the starting point for the tutorial. Reorienting the data was omitted here but can be learned from comparing the reoriented file with the raw file in the data folder. Applying meaning to the data can be difficult at this stage. Basic javascript, dygraphs reference and scrubbed data are included but not much else.

Step 1 – Adding a Title

Step1-AddingTitle

To add the title, we pass in the options parameter to the dygraphs constructor using the below javascript. Notice the options parameter is a json object and properties are case-sensitive.

 Step 2 – Resize

Step2-Resize

After adding the title, the graph looks cramped. We can alter the height and width parameters to fix this as the below gist illustrates.

Step 3 – Formatting Currency

Step3-FormattingCurrency

The scientific notation on the left (y-axis) and on the values makes sense, but isn’t terribly readable. Fortunately, we can beautifully format currency with a great library called numeral.js. You can see it in action below. This turns “$10e+7″ into “$10 m”.

Step 4 – Set Axis Label Width

Step4-set_axis_label_width

The below javascript changes improve the readability of our left(y-axis) values by giving them some room to breath. Below we set the axisLabelWidth property to 100.

Step 5 – Refactor

Our astute readers and developers will notice the identical code that formats the currency for the axisLabelFormatter and
valueFormatter. For consistency’s and stability’s sake, we need to rectify this situation. In our case, we create and use a single function called formatLikeCurrency.

Step 6 – Debugging Tip

As you work through dygraphs, for debugging it can be helpful to use the hideOverlayOnMouseOut property. This prevents the chart corresponding to the mouse position to stay visible until making another selection. Consider moving between other sites, text editor, e-mail and folder/file viewer. It’s important to keep your frustration to a minimum.

Step 7 – Styling

Step7-StylingStyling creates a better visualize experience for anyone using or viewing your data. Fortunately, we easily style the visualizations generated with dygraphs using CSS. First we need to configure our class structure that will be used by CSS selectors. Then, we tell dygraphs the correct class to put the labels, that appear on mouse hover.

Step 8 – Profit

I hope that you learned something about dygraphs, Fort Lauderdale, data visualization or javascript.

South Florida Code Camp 2015

Thank you to NSU, all presenters, volunteers, participants and sponsors for making the 2015 code camp a great experience. A special thank you to Dave Noderer who helped organize the event and allowed me to use the community table to speak with people about getting involved in Code for Fort Lauderdale. An additional special thank you to Rachel for making registration a breeze for volunteers as well as attendees.


SharePoint for .NET Developers

By Gary Blatt

Client-side Object Model (CSOM) provides access to core objects within the SharePoint model. It is composed of three distinct APIs.

  • ECMAScript object model
  • Silverlight client object model
  • .NET managed client object model

Server-side Object Model (SOM) provides access to items in a list, items in a library and creating server controls from within the SharePoint Server Farm. Collaborative Markup Language (CAML) allows developers to define how to construct and display data within SharePoint. It is an xml based and contains specific elements for data definitions and rendering.

One decision will be whether to host your own SharePoint instance or not. One such offering is called Business Productivity Online Services (BPOS). BPOS includes a SharePoint offering hosted by Microsoft (referred to as SharePoint online). Having Microsoft host your SharePoint may be an attractive option in your situation. You should consider the following:

  1. Powershell
    • 800 commandlets with natively hosted SharePoint
    • 29 commandlets with SharePoint online

Best Practice

Never do queries against the SharePoint database directly. The reason boils down to the same reason any application exposes an API rather than the database itself. Before you ever started using it, other consumers tested the API. Direct querying opens the door for complex locking scenarios between you and other database users. It’s not supported, meaning if it breaks it’s your problem (aka no support).

References


EMV Training

By Frank Haggar

EMV stands for Europay, Master Card and Visa, a global standard for integrated circuit cards. The standard includes using the cards at Point of Sale (POS) terminals and ATMs. EMV uses dynamic authentication to validate the transaction via cryptograms. It focuses on authenticating the user. The standard includes improving security with the following

  • Card authentication – prevent card skimming and counterfeiting.
  • Cardholder verification – authenticating the cardholder
  • Transaction authorization – using credit card issuer-defined rules to authorize transactions

For any credit card number (in some cases called Primary Account Number or PAN)

  • digits 1-6 represent the Bank Identification Number(BIN)
  • a variable length (up to 12 digits) individual account identifier
  • a single check digit calculated using the Luhn algorithm

There are different requirements for different payment methods. Card present encompasses the following payment categories.

  • Contact – require physical contact with the device beginning the payment processing (e.g. credit card)
  • Contactless – requires proximity but not physical contact for initiating the payment processing

Card Not Present implementations include

  • Host Card Emulation uses software only rather than carrier issued sim cards to verify identity for mobile payments.
    • Apple Pay
    • Google Wallet

The Electronic Transaction Association is an International trade association for the payment processing industry. In an effort to decrease liability, the credit card companies developed EMV to shift fraud liability to any merchant that did not accept EMV chip cards.

They didn’t want to stop fraud, they just wanted to stop paying for it.” -Frank Haggar

Glossary

  • Point of Sale (POS) Payment Application – An application capable of accepting payment at the point of sale (e.g. a cash register at checkout).
  • PIN Pad – used to enter the personal identification number
  • EMV Kernel – Utilized for testing by the company producing products or software capable of passing the EMVCo tests. EMV by itself is not encrypted.

References


Lessons Learned: Being Agile in a Waterfall World

By Phillip Japikse

Estimation is going to be wrong, it’s not exactimation. Don’t try to hold anyone accountable for their estimates. Leverage estimates for planning and goal setting. Don’t be afraid to adjust when the unexpected predictably happens. Let communication drive your progress.

The #1 way to instill fear in someone is to not tell them anything. Colleagues will fear the unknown even more so than an unfavorable outcome. Leverage pizza & pop to get the right people in the room together. Ask for their opinion, make them co-conspirators in your project. Don’t ever mandate.

Choose your metrics carefully. What am I measuring? Burndown shows on track. Swim Lanes help present actionable items and make blocking more visible. Sprint Review communicates progress with stakeholders & users. It determines whether something was done or not.

Glossary

  • Release Plan – how you will release not the contents of the release. Release Planning doesn’t include what’s in the software.
  • Sprint planning – Estimate, Select and decompose. Never commit to 100% of the team’s capacity.
  • Scrummerfall – adopting the most comfortable portions of Scrum.
  • Keep meetings succinct and focused with time boxes. Always have an agenda. No agenda, No attenda.
  • Definition of Done

UAT is a joke, because it’s not actionable. UAT is performed after everyone has agreed not to change anything. Every sprint, get users involved. Let users enter defects into your bug tracking system. Users can be internal or external to the company but will always be external to the team. Bugs should go into the product backlog not the current sprint. Make your users co-conspirators.

Shift people around to make sure that the right people see each other all the time through Co-location. This prevents barriers from forming around departments hindering progress and communication. Keep your retrospectives simple and purposeful. Use cards that are Start (Green) Stop(Red) and Continue(Yellow). Take 1 item as an action item and commit to working on that.

Agile Transformation is slow. People only change 10% at a time. Find small wins. Use incremental progress to build a coalition.

Grow your people not your processes.


Getting started with Open Data

By Thomas Robbins

Open data represents a tremendous amount of data. Data is a national treasure. The type of data being released does not contain Personally Identifiable Information(PII). Protecting privacy and exchanging information happens through cleansing the data prior to its release to respect individuals’ privacy. Open data has many potential applications.

  • One great example is citygram.org updates on the topics and areas you care about for your city. Leverage it to participate locally in your community.
  • Many restaurant sites such as yelp, urban spoon and others push for health code inspection data. Imagine seeing this official data with customer reviews.

Wait a second, how does Socrata make any money? Rest assured, there is no hidden agenda. They charge data publishers to provide a no fee service for data consumers. They’ll even help you advertise and code review your app. Become a Socrata developer today

  1. Create a socrata account
  2. Follow the getting started guide

A special thank you to Thomas for setting aside time to let me plug Code for Fort Lauderdale. If you haven’t heard of us, please stop by our next meetup. We’d love to meet you.

References

SSRS Gotcha: AccessDeniedException Edition

The Gotcha

Configuring SSRS Reporting services involves quite a few steps and permission hoops that you will have to jump through. Then once you think you’ve done that correctly, the AccessDeniedException rears it’s ugly head.

SSRSReportsError

Server Error in '/' Application.

System.Web.Services.Protocols.SoapException: The permissions granted to user 'domain\user' are insufficient for performing this operation. ---> Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: The permissions granted to user 'domain\user' are insufficient for performing this operation.

  at Microsoft.ReportingServices.WebServer.ReportExecution2005Impl.LoadReport(String Report, String HistoryID, ExecutionInfo2& executionInfo)

  at Microsoft.ReportingServices.WebServer.ReportExecutionService.LoadReport(String Report, String HistoryID, ExecutionInfo& executionInfo)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: The permissions granted to user 'domain\user' are insufficient for performing this operation. ---> Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: The permissions granted to user 'domain\user' are insufficient for performing this operation.

  at Microsoft.ReportingServices.WebServer.ReportExecution2005Impl.LoadReport(String Report, String HistoryID, ExecutionInfo2& executionInfo)

  at Microsoft.ReportingServices.WebServer.ReportExecutionService.LoadReport(String Report, String HistoryID, ExecutionInfo& executionInfo)

Source Error:

Line 285:        [return: System.Xml.Serialization.XmlElementAttribute("executionInfo")]
Line 286:        public ExecutionInfo LoadReport(string Report, string HistoryID) {
Line 287:            object[] results = this.Invoke("LoadReport", new object[] {
Line 288:                        Report,
Line 289:                        HistoryID});

Stack Trace:

[SoapException: System.Web.Services.Protocols.SoapException: The permissions granted to user 'domain\user' are insufficient for performing this operation. ---> Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: The permissions granted to user 'domain\user' are insufficient for performing this operation.

   at Microsoft.ReportingServices.WebServer.ReportExecution2005Impl.LoadReport(String Report, String HistoryID, ExecutionInfo2& executionInfo)

   at Microsoft.ReportingServices.WebServer.ReportExecutionService.LoadReport(String Report, String HistoryID, ExecutionInfo& executionInfo)]

   System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +507386

   System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +215

   Project.RptExecSvc.ReportExecutionService.LoadReport(String Report, String HistoryID) in C:\git-tfs\eFileForBusiness\efile1.com\Web\Web References\RptExecSvc\Reference.cs

   Page.Page_Load(Object sender, EventArgs e) in Project\Page.aspx.cs
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   System.Web.UI.Control.OnLoad(EventArgs e)
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446


To Resolve this exception

  1. Open your servers report manager
  2. Click the right arrow on the desired folder
  3. Click security
  4. Click New Role Assignment
  5. Enter BUILTIN\Users for Group or User Name
  6. Click Browser
  7. Click OK


Explanation

The key here is the default configuration of SSRS reports that gives the BUILTIN\Administrators (aka local administrators) full permissions with the reports. This is necessary but not sufficient. In many cases, you want other users to be able to view, create, modify or do other operations on reports.

For this reason, I had to add BUILTIN\Users to be able to do anything with the reports, even run them. In my scenario, this resolved the issue as I only needed to run the reports from the server. If your scenario is more complex (e.g. users need to modify/build reports) you may end up with a more complex configuration.

WCF: Pick your flavor (SOAP, xml, json)

Let your consumers choose how to consume your service (in my case a WCF service). Encourage integration with your service by making life easy for your partners(or at least easier). A lack of SOAP support on non-Microsoft/.NET languages can be a barrier to entry for some programs/programmers. It’s not exactly easy or convenient to build a SOAP message with headers and all. Below is an example of the absolute minimum, which is 169 characters with no header or body.

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Header>
  </soap:Header>
  <soap:Body>
  </soap:Body>
</soap:Envelope>

Then I considered the possibility of using other such standards that are more terse and appeal to a wider audience (e.g. Plain Old Xml(POX) and JavaScript Object Notation(JSON)). I looked around at various projects online to find a suffix anti-pattern in service contracts. Below I have provided the example for a fictitious method called GetData, and the anti-pattern looks like this.

    [ServiceContract]
    public interface IService
    {
        [OperationContract]
        string GetData(int value);

        [WebInvoke(Method = "GET")]
        string GetDataXml(int value);

        [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetDataJSON(int value);
    }

Following this anti-pattern, I should create three methods in my interface for a single operation, because I want to support three output formats. Fortunately, there is a much better way. However it isn’t really well documented in its entirety(at least that I could find, which is as good as it not existing).

Our trusty and yet increasingly complicated web.config file is part of the solution. There will need to be three separate endpoints each with their own endpoint behavior.

  <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="jsonBinding"></binding>
        <binding name="xmlBinding"></binding>
      </webHttpBinding>
    </bindings>
    <services>
      <service name="JSONPOXSOAP.Service1">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Design_Time_Addresses/JSONPOXSOAP/Service1/"/>
          </baseAddresses>
        </host>
        <endpoint address="json" bindingConfiguration="jsonBinding" binding="webHttpBinding" behaviorConfiguration="jsonBehavior" contract="JSONPOXSOAP.IService1"></endpoint>
        <endpoint address="xml" bindingConfiguration="xmlBinding" binding="webHttpBinding" behaviorConfiguration="xmlBehavior" contract="JSONPOXSOAP.IService1"></endpoint>
        <endpoint address="" binding="wsHttpBinding" contract="JSONPOXSOAP.IService1">
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="jsonBehavior">
          <webHttp defaultOutgoingResponseFormat="Json"/>
        </behavior>
        <behavior name="xmlBehavior">
          <webHttp defaultOutgoingResponseFormat="Xml"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>

This allows for a much simpler and straight forward interface and service that implements it. This means one method for one operation, which is much nicer than three.

[ServiceContract]
public interface IService
{
    [OperationContract]
    [WebInvoke(Method = "GET")]
    string GetData(int value);
}

I hope this helps create cleaner interfaces and makes your services more accessible.

Async Your SMTP

While working on an ASP.NET MVC site, I had a scenario where I needed to send an e-mail using smtp. In my case, it was to confirm an e-mail address in the usual registration fashion. It was at this time that I noticed the SendAsync method of the SmtpClient, which sounded like a great fit. I added the code only to get the below nastiness for my troubles.

System.InvalidOperationException: Asynchronous operations are not allowed in this context. Page starting an asynchronous operation has to have the Async attribute set to true and an asynchronous operation can only be started on a page prior to PreRenderComplete event.

at System.Web.LegacyAspNetSynchronizationContext.OperationStarted()
at System.ComponentModel.AsyncOperation.CreateOperation(Object userSuppliedState, SynchronizationContext syncContext)
at System.Net.Mail.SmtpClient.SendAsync(MailMessage message, Object userToken)

The issue here has to do with the methodology of ASP.NET. Each request returns a response, period. To do anything asynchronously, you will need to use a different thread or process from the one currently servicing the request (or you could do it synchronously, but who wants that?). I developed the below code which draws heavily from information in this Stack Overflow question.

Note the below example uses log4net for logging.

        public static void Send(string recipients, string subject, string body)
        {
            Task.Factory.StartNew(() =>
                {
                    var from = ConfigurationManager.AppSettings["noreplyemail"].ToString();
                    Log.DebugFormat("Sending an e-mail to [{0}] from [{1}] with the subject [{2}] and body [{3}].", recipients, from, subject, body);
                    Send(new MailMessage(from, recipients, subject, body));
                });
        }

        public static void Send(MailMessage message)
        {
            var port = int.Parse(ConfigurationManager.AppSettings["SMTPPort"].ToString());
            var host = ConfigurationManager.AppSettings["SMTPserver"].ToString();
            var username = ConfigurationManager.AppSettings["SMTPusername"].ToString();
            var password = ConfigurationManager.AppSettings["SMTPpassword"].ToString();
            var smtpClient = new SmtpClient(host, port);
            smtpClient.UseDefaultCredentials = string.IsNullOrWhiteSpace(username) && string.IsNullOrWhiteSpace(password);
            smtpClient.Credentials = new NetworkCredential(username, password);

            smtpClient.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
            smtpClient.SendCompleted += (s, e) =>
            {
                smtpClient.Dispose();
                message.Dispose();
            };

            smtpClient.SendAsync(message, null);
        }

        private static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                Log.Error(e.Error);
            }
            else
            {
                Log.InfoFormat("The email message was successfully sent.");
            }
        }

There are some gotcha’s to keep in mind with disposing. Don’t dispose too early or else your message won’t be sent. I learned this the hard way after wrapping the SmtpClient and the MailMessage in using statements which did what they were supposed to (i.e. cleaning up any resources), just before I wanted them to.

You will notice that I chose to use a Task here. I chose to do this mainly for the sake of simplicity. One option to consider is using the WebBackgrounder for these kinds of tasks. In my case, this was overkill since I was only sending e-mail and occasionally at that. In other cases, it may very well be a good fit.

I hope this provides a more complete example to this problem than I could find myself.


 

Warning: Unsolicited Advice

If you are about to embark upon sending e-mail with smtp, I highly recommend that you take the time to learn how to debug it at a low level. You should be able to telnet into your smtp server and send e-mails that way. You should be able to sniff your network traffic with Wireshark, which allows you to even filter your traffic for the smtp protocol. Without this knowledge, you are guaranteed to have a difficult time troubleshooting any issues you encounter.

South Florida Code Camp 2014

Thank you to NSU, all presenters, volunteers, participants and sponsors for making this year’s code camp a great experience. A special thank you to Dave Noderer who helped organize the event and allowed me to use the community table to speak with people about getting involved in Code for Fort Lauderdale. The speakers did a great job focusing on application rather than theory and helped me to walk away with useful information.

I had the opportunity to attend the below sessions. I have included the notes for each of them.

I hope everyone that attended enjoyed themselves, and I am looking forward to seeing everyone again next year.


Intro to SQL Server CE – Benefits & how to use

by Walter V. Williams, Jr.
CHB Consulting

msde?

Notable highlights regarding SQL Server CE 4.0

  • Small footprint, less than 2 MB
  • Easy to install(copy dll’s, no registering)
  • Database management done within program (no need to hire DBA)
  • Similar CRUD calls as in SQL Server express or full
  • Full aggregate support ( I think joins too)
  • Simple setup for development with Nuget repository

Limitations to keep in mind

  • No stored procedures or triggers
  • No role based security
  • No direct upgrade path to sql server or full (i.e. you need to recreate structure and move the data yourself)
  • Limited to 256 simultaneous connections
  • Maximum size of 4 GB
  • No support for datetime stamp(workaround using bigint to store ticks)

We don’t need roads: A developer’s look into sql server indexes

by Richie Rump
Jorriss LLC

Stack Overflow is kind enough to do a data dump. Besides being an incredibly open treasure trove of information, it is a free large database to use for testing, indexes in this case. Richie was kind enough to provide a basic overview for those of us who aren’t DBA’s, experts or just a little rusty.

Starting with the baseics, we took a look at some execution plans and turned on IO statistics. You can use the free online statistics io parser to make the output more readable. The performance implications of scans and seeks became pretty clear, but it is important to understand the difference.

  • Scans -> read the entire table
  • Seeks -> use indexes to take shortcuts

These shortcuts are similar to the way we use alphabetical ordering in a phone book rather than flipping through each page while searching for an entry.

It turns out there are many different types of indexes.

  • clustered -> tell how to physically store the data, only 1 (highlander) uniqueifier?
  • nonclustered -> do not have to unique, maximum of 999 per table
  • heaps -> stored by the order it comes in (default without clustered index)
  • column store -> sort by column value rather than row
  • xml -> make xml faster, but shouldn’t be there
  • spatial -> for mapping stuff
  • full-text -> text field, search inside of text

Tables are a metadata construct, the clustered index is the table. Included columns -> put columns into the leaf level of the index. This prevents bookmark lookups in SQL Server.

If a column is in the where clause use it in the index, if it is in the select use it in the included columns index.

The Fill Factor has a significant impact on performance. It determines how full a page in memory can be before a new one is created. It only applies to leaf pages. Each leaf page contains a reference to each of it’s entries. Pages are typically organized sequentially, which doesn’t work so hot for guids. The result is fragmentation, which creates empty space all over the place. Using sequential guids can help this issue, but it doesn’t solve the issue completely.

Indexes presents some disadvantages and limitations.

  • Creates copies of the data(storage)
  • Insert, Updates and deletes are slower
  • Additional maintenance to keep indexes fast
  • Cannot create index on nvarchar(max)

Big takeaway: Be a part of the community!


A DiBA guide to SQL Server Database Standards

by Diana Betancourt
South Florida SQL Server User Group (SFSSUG)

One of the initial questions asked was,

What are database standards?

Unfortunately the only standards that exist are for coding and not configuration. The solution is a marriage of Microsoft’s best practices and your own.

Best practice analyzers and risk assessments . Have fun with it, because it can take a lot out of you. Create a set of rules that don’t overburden development or deployment. Developers and DBA’s have to play nice. No issue should ever happen twice.

Question everything! Don’t assume that someone else’s advice will work for your situation or system. Prove that it will, and understand why. This course introduced me to The Enterprise Policy Management Framework. This seems like an invaluable tool for anyone that is trying to run a sizeable production environment, which is no small task.

The Enterprise Policy Management Framework is a reporting solution on the state of the enterprise against a desired state defined in a policy. Extend Policy-Based Management to all SQL Server instances in the enterprise. Centralize and report on the policy evaluation results.


Clean JavaScript

by Patrick Delancy

What is “clean” in this context? Clean is easier to read, maintain and test. SOLID design principles can assist in producing cleaner JavaScript.

There are some constructs of JavaScript to keep in mind.
clean = easier to read and maintain

  • ECMA says that javascript is single threaded
  • nodejs is multi-threaded
  • Each page load is an application

Some of the barriers to clean JavaScript are:

  • Not knowing JavaScript
  • Inline code
  • The DOM (Mixture of concerns and a tight coupling)

Solutions! (aside: You will notice that the last one is not at all JavaScript specific)

  • Learn Javascript
    1. Read The ECMA standards
    2. Check out JavaScript: The Good Parts by Douglas Crockford
    3. Contribute to a JavaScript project on github
  • Externalize All JavaScript (data attributes and meta tags rather than using server variables inline)
  • Separate Your Concerns

Takeaways

  1. JavaScript is a real programming language
  2. Every page load is an application
  3. Make it testable, and you will make it clean

Recommended Unit Test Frameworks

Recommended Test Runners

Salesforce SOAP API Login – Minimum Pieces of Flair

I have been working with the Salesforce API lately, and have found the learning curve to be a little bit steep. I can’t say it’s been insurmountable, but often times the first day working with any API is the most frustrating.

So without further ado, I present the Minimum Pieces of Flair required to successfully login to the SOAP API.

Steps to add a Web Reference to your project in Visual Studio.

  1. Right Click Project
  2. Add
  3. Service Reference
  4. Advanced…
  5. Add Web Reference…
  6. Open your salesforce wsdl xml file
  7. Click Add Reference

C# code

var service = new SforceService.SforceService();
var result = service.login("user", "password");
service.Url = result.serverUrl;
service.SessionHeaderValue = 
    new SforceService.SessionHeader() 
    { 
        sessionId = result.sessionId 
    };

This will get you everything that you need to login and start making calls. Salesforce’s introductory example is lengthy with all kinds of exception handling and timeout setting. In my case, this was overkill, but your mileage may vary.

Follow

Get every new post delivered to your Inbox.

Join 104 other followers

%d bloggers like this: