You need to sign in to do that
Don't have an account?
Problems returning all accounts
Hello All,
I am trying to query all accounts and I'm getting an error. Would you please take a look at my SOAP message and lemme know what I'm doing wrong thanx!
Request:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="salesforce" xmlns:types="salesforce/encodedTypes" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soap:Header>
<headerStruct>
<session_id xsi:type="xsd:string">XGd_7ULP.SCHlD9Hidxp4gqTMF1WlgtlNlHyJ9.iCf5mehNuWsT8zoblas.UB8n3Nup0UNXBACOOW3brM5mSovbtzKggVlhL</session_id>
<version xsi:type="xsd:string">2</version>
</headerStruct>
</soap:Header>
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<qry1:query xmlns:qry1="sfconnector:SalesforceConnector" type="methodCall">
<type xsi:type="xsd:string">account</type>
<maxRows xsi:type="xsd:int">20</maxRows>
<select href="#id1"/>
<filter href="#id2"/>
</qry1:query>
<soapenc:Array id="id1" soapenc:arrayType="xsd:string[4]">
<Item>id</Item>
<Item>Account_Name</Item>
<Item>Parent_Account_ID</Item>
<Item>Account_Number</Item>
<Item>Account_Type</Item>
<Item>Industry</Item>
</soapenc:Array>
<soapenc:Array id="id2" soapenc:arrayType="xsd:anyType[1]">
<Item href="#id3"/>
</soapenc:Array>
<soapenc:Array id="id3" soapenc:arrayType="tns:mapEntry[3]">
<Item href="#mentry1"/>
<Item href="#mentry2"/>
<Item href="#mentry3"/>
</soapenc:Array>
<tns:mapEntry id="mentry1" xsi:type="tns:mapEntry">
<key xsi:type="xsd:string">field</key>
<value xsi:type="xsd:string">Created_Date</value>
</tns:mapEntry>
<tns:mapEntry id="mentry2" xsi:type="tns:mapEntry">
<key xsi:type="xsd:string">value</key>
<value xsi:type="xsd:dateTime">2002-01-01T00:00:00.0000000-08:00</value>
</tns:mapEntry>
<tns:mapEntry id="mentry3" xsi:type="tns:mapEntry">
<key xsi:type="xsd:string">operator</key>
<value xsi:type="xsd:string">greater than</value>
</tns:mapEntry>
</soap:Body>
</soap:Envelope>
Response:
<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>1100</faultcode><faultstring>missing scope in query call</faultstring></soap:Fault></soap:Body></soap:Envelope>
Hi Jay,
You need to add a scope parameter of filter to the query call.
<qry1:query xmlns:qry1="sfconnector:SalesforceConnector" type="methodCall">
<scope xsi:type="xsd:string">filter</type>
<type xsi:type="xsd:string">account</type>
<maxRows xsi:type="xsd:int">20</maxRows>
<select href="#id1"/>
<filter href="#id2"/>
</qry1:query>
Also, it's better to not send a filter if you are requesting all records (Notice that the filter is empty - no href and the maxRows is -1):
<qry1:query xmlns:qry1="sfconnector:SalesforceConnector" type="methodCall">
<scope xsi:type="xsd:string">filter</type>
<type xsi:type="xsd:string">account</type>
<maxRows xsi:type="xsd:int">-1</maxRows>
<select href="#id1"/>
<filter />
</qry1:query>
In C# and java you can pass the filter param to the proxy as null and in vb.Net as nothing.
Thanx, Dave!
That solved my problem.