Skip to content

Instantly share code, notes, and snippets.

public static String buildSoapLogin(String username, String password) {
def builder = new StreamingMarkupBuilder()
builder.encoding = 'UTF-8'
def soapEnv = builder.bind {
mkp.xmlDeclaration()
mkp.declareNamespace(soapenv: SOAP.SOAP11_NS)
mkp.declareNamespace(tns: 'urn:partner.soap.sforce.com')
mkp.declareNamespace(ens: 'urn:sobject.partner.soap.sforce.com')
'soapenv:Envelope' {
'soapenv:Header' {
@gbutt
gbutt / ConfigLoader.java
Created May 16, 2014 20:46
configloader
package com.example;
import org.apache.commons.lang.NullArgumentException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
@gbutt
gbutt / ScheduledDispatcher.cls
Last active December 5, 2024 08:15
apex scheduled dispatcher - this is how you can schedule code in SFDC without locking up all your classes
/***
Adapted from the great Dan Appleman.
For more on this and many other great patterns - buy his book - http://advancedapex.com/
This class can be used to schedule any scheduled job without risk of locking the class.
DO NOT CHANGE THIS CLASS! It is locked by the scheduler. Instead make changes to ScheduledHelper or your own IScheduleDispatched class
To use:
1) Create a new class to handle your job. This class should implement ScheduledDispatcher.IScheduleDispatched
2) Create a new instance of ScheduledDispatcher with the type of your new class.
3) Schedule the ScheduledDispatcher instead of directly scheduling your new class.
See ScheduledRenewalsHandler for a working example.