+ Start a Discussion
wrexwrex 

Problems with retrieve

I'm trying to use ruby (soap4r) with the sforce API. I'm having no problems with SOQL queries, but I'm unable to get Retrieve working.

The wiretrace from my last attempt looked like:


= Request

POST /services/Soap/c/6.0 HTTP/1.1
SOAPAction: ""
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.5.4 (/114, ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0])
Date: Wed Sep 21 11:55:27 PDT 2005
Content-Length: 877
Host: na1-api.salesforce.com


xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

xmlns="urn:partner.soap.sforce.com">
O3kaG59yadahyadah.lRHax_wILyadahyadahzi4=

xmlns="urn:partner.soap.sforce.com">
client




Asset
02i300000002tQIAAY
Name




= Response

HTTP/1.1 500 Internal Server Error
Server: sfdc
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Connection: close
Transfer-Encoding: chunked
Date: Wed, 21 Sep 2005 18:55:23 GMT

0496




soapenv:Server
INVALID_TYPE: sObject type '02i300000002tQIAAY' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.


INVALID_TYPE
sObject type '02i300000002tQIAAY' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
-1
-1







This request looks correct to me. Why is sforce trying to interpret the Id as an SObject?
This Id was returned from a previous SOQL query.

What's wrong with this request?
wrexwrex
Grr...

Preview messed up my careful replace of html entities....

Here's the wiretrace again:


= Request

POST /services/Soap/c/6.0 HTTP/1.1
SOAPAction: ""
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.5.4 (/114, ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0])
Date: Wed Sep 21 11:55:27 PDT 2005
Content-Length: 877
Host: na1-api.salesforce.com

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Header>
<SessionHeader env:mustUnderstand="0"
xmlns="urn:partner.soap.sforce.com">
<sessionId>O3kaG59afoobarbazblat.tXFefdXOzpaj_JcHq3Q9.lRfoobarbazblat=</sessionId>
</SessionHeader>
<CallOptions env:mustUnderstand="0"
xmlns="urn:partner.soap.sforce.com">
<client>client</client>
</CallOptions>
</env:Header>
<env:Body>
<retrieve xmlns="urn:partner.soap.sforce.com">
<sObjectType>Asset</sObjectType>
<ids>02i300000002tQIAAY</ids>
<fieldList>Name</fieldList>
</retrieve>
</env:Body>
</env:Envelope>

= Response

HTTP/1.1 500 Internal Server Error
Server: sfdc
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Connection: close
Transfer-Encoding: chunked
Date: Wed, 21 Sep 2005 18:55:23 GMT

0496
<?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:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>INVALID_TYPE: sObject type '02i300000002tQIAAY' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.</faultstring>
<detail>
<sf:fault xsi:type="sf:InvalidSObjectFault" xmlns:sf="urn:fault.enterprise.soap.sforce.com">
<sf:exceptionCode>INVALID_TYPE</sf:exceptionCode>
<sf:exceptionMessage>sObject type '02i300000002tQIAAY' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.</sf:exceptionMessage>
<sf:row>-1</sf:row>
<sf:column>-1</sf:column>
</sf:fault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
SuperfellSuperfell
The request elememts are not in the correct order, it should be the
fieldList, sObjectType, then the Id, whereas you have sObject, Id, FieldList.

The order of the elements is important (this is what the sequence element in the schema means)

Message Edited by SimonF on 09-21-2005 12:32 PM

wrexwrex
Excellent. Thanks!

After applying a couple fixes 1629 and 1631 on top of soap4r-1_5_5, I'm now submitting the request elements in the right order and retrieve is working fine.

Thanks for the help!
RupRup
Wrex,
I'm now using soap4r way past 1631. I have regenerated default.rf etc. from SFORCE API 6.0 (partner.wsdl.xml), and am still having ordering the request fields :

I write

...retrieve( { :fieldList => "Name, Phone", :sObjectType => "Account", :ids => ["001300000021QoG"] }

and soap4r sends



001300000021QoG
Name, Phone
Account



Any ideas why ?