11.5.15

SOAP Request Message to Salesforce Login

Not sure why, but when I left the first line of the SOAP login request message as empty, I got 500 from salesforce.


def templ = '''
<?xml version="1.0" encoding="utf-8" ?>
                  <env:Envelope
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
                    <env:Body>
                      <n1:login xmlns:n1="urn:partner.soap.sforce.com">
                        <n1:username>{username}</n1:username>
                        <n1:password>{password}{token}</n1:password>
                      </n1:login>
                    </env:Body>
                  </env:Envelope>''';

def loginBody = templ.
    replace("{username}", p.getProperty("salesforce.username")).
    replace("{password}", p.getProperty("salesforce.password")).
    replace("{token}", p.getProperty("salesforce.token"));

No comments: