Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="https://www.w3schools.com/xml/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="https://www.w3schools.com/xml/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="https://www.w3schools.com/xml/">
<s:element name="FahrenheitToCelsius">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Fahrenheit" type="s:string" />
</s:sequence>
</s:complexType>
public static void sendMessage(Message msg) {
HttpRequest req = new HttpRequest();
req.setMethod('POST');
//req.setEndpoint('https://api.learnsfdevwithapex.com/messages');
req.setEndpoint('callout:LearningSFDevAPI/messages'); //This is for the final version at the end of the chapter
req.setBody(JSON.serialize(msg));
req.setHeader('X-Auth-Token', 'SEE_BOOK_FOR_VALUE');
req.setHeader('content-type', 'application/json');
Http http = new Http();
{
"data": "test"
}
///System.TypeException: Invalid conversion from runtime type LIST to LIST
List<Object> objects = new List<Object>{'a','a','b','c','c','c','d','e','e'};
List<String> strings = (List<String>)objects;
System.debug(strings.size());
//WORKS
List<String> stringList = new List<String>{'a','a','b','c','c','c','d','e','e'};
@pbattisson
pbattisson / Output.json
Created October 31, 2014 12:14
Some JSON output for debugging.
{
"attributes": {
"type": "Profile",
"url": "\/services\/data\/v32.0\/tooling\/sobjects\/Profile\/00eA0000000WrUvIAK"
},
"Id": "00eA0000000WrUvIAK",
"Name": "Custom: Support Profile",
"CreatedDate": "2009-12-05T08:41:17.000+0000",
"LastModifiedDate": "2014-10-22T08:45:54.000+0000",
"Description": null,
//Create a resource mapping
// - * wildcard must be preceded and followed by a '/' unless * is end character
// - resource must start with '/'
// - one mapping per class
// - class must be global
@RestResource(urlMapping='/languages/*')
global with sharing class LanguageService {
// ROUTES:
@pbattisson
pbattisson / Performance Measuring Apex Loops
Created August 3, 2014 12:57
The reference code used in running performance metrics for loops
public with sharing class PreferencesManager {
//public static Account setEmailPreferences(Account acc, Boolean preference) {
// for(Integer i = 0; i < acc.Contacts.size(); i++) {
// acc.Contacts[i].Email_Preference__c = preference;
// }
// return acc;
//}
//2374
@pbattisson
pbattisson / gist:8009091
Created December 17, 2013 17:34
Calculator example for BDD in Apex on Force.com
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of 2 numbers
Scenario: Add two numbers
Given I have a calculator
And I have entered 50 into the calculator
And I have entered 70 into the calculator
When I press add
@pbattisson
pbattisson / gist:5262961
Created March 28, 2013 13:05
GSL Gem deploy error
Installing gsl (1.15.3)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking gsl version... 1.15
checking gsl cflags... -I/app/vendor/gsl-1/include
checking for main() in -lcblas... no
checking gsl libs... -L/app/vendor/gsl-1/lib -lgsl -lgslcblas -lm
checking for round()... no
checking for rngextra/rngextra.h... no
checking for qrngextra/qrngextra.h... no
@pbattisson
pbattisson / SchemspyDump
Created May 23, 2012 13:19
Java thread dump from hanging schemaspy run.
Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.1-b02 mixed mode):
"Low Memory Detector" daemon prio=6 tid=0x0000000006591800 nid=0xb74 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread1" daemon prio=10 tid=0x000000000658e800 nid=0x1614 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" daemon prio=10 tid=0x0000000006577800 nid=0x1160 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE