title: WSO2 ESB: Unexpected Character Error when using Salesforce Connector
body: <p>When attempting to follow the WSO2 <a href="https://docs.wso2.com/display/ESBCONNECTORS/Working+with+Records+in+Salesforce#WorkingwithRecordsinSalesforce-query" rel="noreferrer">directions</a> to update a salesforce record I am getting the following error.</p>
  
  <blockquote>
    <p>Saleforce adaptor - error injecting sObjects to payload : org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '&lt;'</p>
  </blockquote>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;proxy
      xmlns="http://ws.apache.org/ns/synapse"
      xmlns:sfdc="sfdc" name="SalesforceUpdateTest" startOnLoad="true" statistics="enable" trace="enable" transports="http,https"&gt;
      &lt;target&gt;
          &lt;inSequence&gt;
              &lt;sequence key="conf:/SalesforceLoginInfo"/&gt;
              &lt;payloadFactory&gt;
                  &lt;format&gt;
                      &lt;sfdc:sObjects
                          xmlns:sfdc="sfdc" type="Account"&gt;
                          &lt;sfdc:sObject&gt;
                              &lt;sfdc:Id&gt;TestId1&lt;/sfdc:Id&gt;
                              &lt;sfdc:ValueToChange&gt;Yes&lt;/sfdc:ValueToChange&gt;
                          &lt;/sfdc:sObject&gt;
                      &lt;/sfdc:sObjects&gt;
                  &lt;/format&gt;
                  &lt;args/&gt;
              &lt;/payloadFactory&gt;
              &lt;salesforce.update&gt;
                  &lt;allOrNone&gt;0&lt;/allOrNone&gt;
                  &lt;allowFieldTruncate&gt;0&lt;/allowFieldTruncate&gt;
                  &lt;sobjects
                      xmlns:sfdc="sfdc"&gt;{//sfdc:sObjects}
                  &lt;/sobjects&gt;
              &lt;/salesforce.update&gt;
          &lt;/inSequence&gt;
          &lt;outSequence&gt;
              &lt;send/&gt;
          &lt;/outSequence&gt;
      &lt;/target&gt;
  &lt;/proxy&gt;
  </code></pre>
  
  <p>I am using WSO2 EI 6.1.0 and the salesforce connector 2.0.1. The Salesforce ID TestId1 exists as does the field ValueToChange. My SalesforceLoginInfo is correct (I can do Salesforce queries, just not updates).</p>
  
  <p>Attempting to solve the problem I saw this <a href="https://stackoverflow.com/questions/34281426/wso2-esb-unexpected-character-error-when-submitting-json-to-proxy-service">very similar</a> question. But I've added the lines to the <strong>axis2.xml</strong> according to the Solution, restarted, and the problem still exists.</p>
  
  <pre><code>&lt;messageBuilder contentType="application/json" class="org.wso2.carbon.integrator.core.json.JsonStreamBuilder"/&gt;
  &lt;messageBuilder contentType="text/javascript" class="org.wso2.carbon.integrator.core.json.JsonStreamBuilder"/&gt;
  
  &lt;messageFormatter contentType="application/json" class="org.wso2.carbon.integrator.core.json.JsonStreamFormatter"/&gt;
  &lt;messageFormatter contentType="text/javascript" class="org.wso2.carbon.integrator.core.json.JsonStreamFormatter"/&gt;
  </code></pre>
  
  <p>Does anyone know how to fix this problem? I feel like I'm just following a tutorial (my code is nearly exactly the given wso2 salesforce example) and yet the problem continues.</p>
  
  <p>UPDATE: To reduce confusion about the SalesforceLoginInfo call, I removed that and put the salesforce.init in the code. The error is still the same.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;proxy
      xmlns="http://ws.apache.org/ns/synapse"
      xmlns:sfdc="sfdc" name="SalesforceUpdateTest" startOnLoad="true" statistics="enable" trace="enable" transports="http,https"&gt;
      &lt;target&gt;
          &lt;inSequence&gt;
              &lt;salesforce.init&gt;
                  &lt;username&gt;developer@mycompany.com&lt;/username&gt;
                  &lt;password&gt;mypasswordandmytoken&lt;/password&gt;
                  &lt;loginUrl&gt;https://test.salesforce.com/services/Soap/u/27.0&lt;/loginUrl&gt;
                  &lt;blocking&gt;true&lt;/blocking&gt;
              &lt;/salesforce.init&gt;
  
              &lt;payloadFactory&gt;
                  &lt;format&gt;
                      &lt;sfdc:sObjects
                          xmlns:sfdc="sfdc" type="Account"&gt;
                          &lt;sfdc:sObject&gt;
                              &lt;sfdc:Id&gt;TestId1&lt;/sfdc:Id&gt;
                              &lt;sfdc:ValueToChange&gt;Yes&lt;/sfdc:ValueToChange&gt;
                          &lt;/sfdc:sObject&gt;
                      &lt;/sfdc:sObjects&gt;
                  &lt;/format&gt;
                  &lt;args/&gt;
              &lt;/payloadFactory&gt;
              &lt;salesforce.update&gt;
                  &lt;allOrNone&gt;0&lt;/allOrNone&gt;
                  &lt;allowFieldTruncate&gt;0&lt;/allowFieldTruncate&gt;
                  &lt;sobjects
                      xmlns:sfdc="sfdc"&gt;{//sfdc:sObjects}
                  &lt;/sobjects&gt;
              &lt;/salesforce.update&gt;
          &lt;/inSequence&gt;
          &lt;outSequence&gt;
              &lt;send/&gt;
          &lt;/outSequence&gt;
      &lt;/target&gt;
  &lt;/proxy&gt;
  </code></pre>