function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
fouloxfoulox 

Questions regarding 2.1

Ever since I saw the mention of 2.1 in this message board I've been working on migrating my 2.0 code to 2.1, now I have a couple of questions. 

The first is how will point releases be announced in the future?  I only found out about the 2.1 release because of a response that Dave wrote to a question.

The next question is code related.  My query call isn't working, I suspect I made a mistake with the mapEntry for my filter, if you could verify my suspicion that'll be great, but here's the other thing that concerns me: the faultcode is 1005, and the faultString value is "size of request is too large".  According to the documentation 1005 is "session id is required for non-login request".  I don't see "size of request is too large" mentioned in the api documentation.

Below is the soap messages:
<pre>::SOAP Request:::
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Header>
  <ns1:commonRequest soapenv:mustUnderstand="0" xsi:type="ns1:headerStruct" xmlns:ns1="salesforce">
   <session_id xsi:type="xsd:string">yH2l5vCsmOkhKarOFTK39P9J0qI8M3K0yOjZ65KtkNPxWz.k1lOfC9sL7XIgOp1DMTgQvaHQ9S1.RZFDRUFYHPbtzKggVlhL</session_id>
   <version xsi:type="xsd:string">2.1</version>
  </ns1:commonRequest>
 </soapenv:Header>
 <soapenv:Body>
  <ns2:query soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="sfconnector:SalesforceConnector">
   <scope xsi:type="xsd:string">filter</scope>
   <type xsi:type="xsd:string">contact</type>
   <maxRows xsi:type="xsd:int">-1</maxRows>
   <select xsi:type="soapenc:Array" soapenc:arrayType="xsd:string[1]" xmlns:ns3="salesforce" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <item>id</item>
   </select>
   <filter xsi:type="soapenc:Array" soapenc:arrayType="ns4:mapEntry[][1]" xmlns:ns4="salesforce" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <item soapenc:arrayType="ns4:mapEntry[3]">
     <item>
      <key xsi:type="xsd:string">field</key>
      <value xsi:type="xsd:string">ownerID</value>
     </item>
     <item>
      <key xsi:type="xsd:string">value</key>
      <value xsi:type="xsd:string"></value>
     </item>
     <item>
      <key xsi:type="xsd:string">operator</key>
      <value xsi:type="xsd:string">not equals</value>
     </item>
    </item>
   </filter>
   <idList xsi:type="ns5:ArrayOfString" xsi:nil="true" xmlns:ns5="salesforce"/>
   <ifModifiedSince xsi:type="xsd:dateTime">1950-11-06T22:39:45.857Z</ifModifiedSince>
   <useCaseSafeIDs xsi:type="xsd:boolean">false</useCaseSafeIDs>
  </ns2:query>
 </soapenv:Body>
</soapenv:Envelope>

::SOAP Response:::
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="salesforce" xmlns:types="salesforce/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header/>
  <soap:Body>
    <soap:Fault>
      <faultcode>1005</faultcode>
      <faultstring>size of request is too large</faultstring>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>
</pre>
DevAngelDevAngel

Hi Lou,

The 2.1 was not meant to be a general dot release as it is specifically designed to be compliant with BEA's WebLogic Workshop 8.1.  Having said that, any client language can use it.  The "trick" we had to do for BEA involved the query as you have found.  For BEA WLW to operate with the service we had to modify the 2.1 query call on the service to accept an array of arrays for the filter.

Here is a rough sample of what I mean by that.

     void sampleFilterQuery_AndOr() throws java.net.MalformedURLException
 {

        mapEntry[][] map = new mapEntry[1][];
  mapEntry[][] filter = new mapEntry[1][]; //final filter array - one element
  mapEntry[][] andFilter1 = new mapEntry[2][]; //First "and'd" filter - two elements
  mapEntry[][] andFilter2 = new mapEntry[2][]; //second "and'd" filter - two elements
  mapEntry[][] andOrFilter = new mapEntry[2][]; //first and second filters "or'd" - two elements

  //This function will filter the contacts using this statement:
  //Select from contacts where (ownerid equals MyID and leadSource equals "Cold Call") or (ownerid equals MyID and leadSource = "Email")

  //Create simple filter as first part of first and'd filter
  andFilter1[0] = makeSimpleFilter("ownerID", userID, "equals");
  //Create simple filter as second part of first and'd filter
  andFilter1[1] = makeSimpleFilter("firstName", "bad", "contains");

  //Create simple filter as first part of second and'd filter
  andFilter2[0] = makeSimpleFilter("ownerID", userID, "equals");
  //Create simple filter as second part of second and'd filter
  andFilter2[1] = makeSimpleFilter("title", "president", "contains");

  //Create complex filter as first part of or'd filter
  andOrFilter[0] = makeAndOrFilter(andFilter1, "and");
  //Create complex filter as second part of or'd filter
  andOrFilter[1] = makeAndOrFilter(andFilter2, "and");

  //Create complex final or'd filter
  map[0] = makeAndOrFilter(andOrFilter, "or");

        testQuery(map);

 }

    public void testQuery(mapEntry[][] filter) throws java.net.MalformedURLException {
       
        XmlObject value;
        //if (serverURL.length() != 0) sforceControl.setEndPoint(new java.net.URL(serverURL));
        try {
            value = sforceControl.query("filter", "contact", 50, new String[] {"id", "lastName"}, filter, null, null, false);
        }
        catch (com.bea.control.ServiceControlException ex1) {
            if (ex1.hasSoapFault())
                lastFault = ex1.getSoapFault().get11Fault().getFaultstring();
            else
                lastFault = ex1.getMessage();
        }
       
        /**
         * Return structure
         *<return>
         *  <value xsi:type="tns:array">
         *      <valueMap xsi:type="tns:map">
         *          <mapEntry xsi:type="tns:mapEntry">
         *              <key xsi:type="xsd:string">lastName</key>
         *              <value xsi:type="xsd:string">Kurz</value>
         *          </mapEntry>
         *          <mapEntry xsi:type="tns:mapEntry">
         *              <key xsi:type="xsd:string">id</key>
         *              <value xsi:type="xsd:string">003x00000000DNX</value>
         *          </mapEntry>
         *      </valueMap>
         *      ...
         *      ...
         *  </value>
         *</return>
         */

    }

fouloxfoulox

Dave this one is killing me, please tell me where I'm going wrong.  Here's my code:

salesforce.MapEntry[][] filter = new salesforce.MapEntry[1][];
filter[0] = makeSimpleFilter("ownerID", "", "not equals");
String[] select = { id };
value =
 (org.w3c.dom.Element) binding.query(
 "filter",
 "contact",
 -1,
 select,
 filter,
 null,
 jc,
 false);

Here's my soap request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Header>
  <ns1:commonRequest soapenv:mustUnderstand="0" xsi:type="ns1:headerStruct" xmlns:ns1="salesforce">
   <session_id xsi:type="xsd:string">YMkKxutrvv.om.fSqmbTZAeI46Dx15_1H0Y2HzMalH7MNz3Ehimr9ylGAGXd5tFkvQIyVXXsm6o9EQLlsQlaBfbtzKggVlhL</session_id>
   <version xsi:type="xsd:string">2.1</version>
  </ns1:commonRequest>
 </soapenv:Header>
 <soapenv:Body>
  <ns2:query soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="sfconnector:SalesforceConnector">
   <scope xsi:type="xsd:string">filter</scope>
   <type xsi:type="xsd:string">contact</type>
   <maxRows xsi:type="xsd:int">-1</maxRows>
   <select xsi:type="soapenc:Array" soapenc:arrayType="xsd:string[1]" xmlns:ns3="salesforce" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <item>id</item>
   </select>
   <filter xsi:type="soapenc:Array" soapenc:arrayType="ns4:mapEntry[][1]" xmlns:ns4="salesforce" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <item soapenc:arrayType="ns4:mapEntry[3]">
     <item>
      <key xsi:type="xsd:string">field</key>
      <value xsi:type="xsd:string">ownerID</value>
     </item>
     <item>
      <key xsi:type="xsd:string">value</key>
      <value xsi:type="xsd:string"></value>
     </item>
     <item>
      <key xsi:type="xsd:string">operator</key>
      <value xsi:type="xsd:string">not equals</value>
     </item>
    </item>
   </filter>
   <idList xsi:type="ns5:ArrayOfString" xsi:nil="true" xmlns:ns5="salesforce"/>
   <ifModifiedSince xsi:type="xsd:dateTime">1950-11-06T15:09:14.915Z</ifModifiedSince>
   <useCaseSafeIDs xsi:type="xsd:boolean">false</useCaseSafeIDs>
  </ns2:query>
 </soapenv:Body>
</soapenv:Envelope>

And the response is:

INFO [main] sfdc.SOAPMonitor (invoke:33) - :::SOAP Response:::
INFO [main] sfdc.SOAPMonitor (invoke:35) - <?xml version="1.0" encoding="UTF-8"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="salesforce" xmlns:types="salesforce/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header/>
  <soap:Body>
    <soap:Fault>
      <faultcode>1005</faultcode>
      <faultstring>size of request is too large</faultstring>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>


Also notice the faultcode and faultstring.  What does size of request is too large mean, and why are they tied together.  Isn't faultcode 1005 suppose to be "Session ID required in cookie for non-login request"?

DevAngelDevAngel

Hi Lou,

Sorry, I should have mentioned this in the previous post.  Although that error response is, um, stupid, the reason you are getting an error is because you are trying to execute the query on www.salesforce.com instead of na1-api.salesforce.com or whatever the url is that is returned from the login call.  Check that you are rebinding the service endpoint to the returned url.

 

fouloxfoulox
That was it. Thanks Dave!