You need to sign in to do that
Don't have an account?
chris_visokio
Bulk API bug
Hi,
We use the Bulk API to query data from Salesforce. We have encountered a problem. If we execute the following code:
// Login
SforceServiceLocator locator = new SforceServiceLocator();
SoapBindingStub binding = (SoapBindingStub) locator.getSoap();
LoginResult result = binding.login(USERNAME, PASSWORD+SECURITY_TOKEN);
binding._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, result.getServerUrl());
binding.setHeader(locator.getServiceName().getNamespaceURI(), "SessionHeader",
new SessionHeader(result.getSessionId()));
// Create bulk connection
ConnectorConfig config = new ConnectorConfig();
config.setSessionId(result.getSessionId());
String serverUrl = result.getServerUrl();
String apiVersion = "22.0";
String restEndpoint = serverUrl.substring(0, serverUrl.indexOf("Soap/")) + "async/" + apiVersion;
config.setRestEndpoint(restEndpoint);
config.setCompression(true);
config.setTraceMessage(false);
BulkConnection connection = new BulkConnection(config);
// Create new job
System.out.println("Creating job");
JobInfo job = new JobInfo();
job.setObject("Campaign");
job.setOperation(OperationEnum.query);
job.setContentType(ContentType.CSV);
job.setConcurrencyMode(ConcurrencyMode.Serial);
job = connection.createJob(job);
We get the following error:
Creating job
[AsyncApiException exceptionCode='Unknown'
exceptionMessage='Unknown exception in Async API. Please contact support with ID: 858593402-23999 (-862000079)'
]
at com.sforce.async.BulkConnection.parseAndThrowException(BulkConnection.java:108)
at com.sforce.async.BulkConnection.createOrUpdateJob(BulkConnection.java:92)
at com.sforce.async.BulkConnection.createJob(BulkConnection.java:72)
at salesforce.SalesforceBulkApiTest.main(SalesforceBulkApiTest.java:68)
This seems to be related to the object selection. For example if we change it to:
job.setObject("Contact")
We do not get this error. We get similar errors for other tables. If its the case that these tables cannot be queried, can we determine this before we execute the query?
Thanks!
Chris
Hi Chris,
Very similar code works for me - I can't reproduce your error at all.
I copied your code and changed the login portion a little to match the wsc-22.jar I'm using (from http://code.google.com/p/sfdc-wsc/downloads/detail?name=wsc-22.jar):
This runs without error for me:
Hi,
We are also getting this error on Account, Contact and Lead object but it is working fine on Users and Task.
Is is something to do with the setting on Object levels/ permission? It seems somewhere permission is missing as process is working for one object than ofcourse it should work for other objects as well.
I am able to fetch records for all objects using SOAP, facing problem only on Bulk API.
Thanks in advance!!
BC
Yes we get the error on these objects too. It must be a permission setting, so is there any way to deterimine up front whether we can query these tables. These tables are being returned when we request a list of all available objects.
You mentioned that "These tables are being returned when we request a list of all available objects.".
Is there a way to get a list of all available objects via Bulk API ie using HTTP get /post?
Please do send me.If i can get some clue.
-Thanks!!
No, as far as I'm aware you can only get a list of available objects using the Web service. The bulk API is used for executing bulk queries on a named object. To obtain a list of objects we use the following code:
SforceServiceLocator locator = new SforceServiceLocator();
SoapBindingStub stub = (SoapBindingStub) locator.getSoap();
...
ArrayList<String> tableNames = new ArrayList<String>();
for (DescribeGlobalSObjectResult sObjectResult : stub.describeGlobal().getSobjects()) {
tableNames.add(sObjectResult.getName());
}
So if the crash described above IS a permissions problem, then this method is retruning me a list of tables i shouldn't be able to see. So is there a check I need to make beforehand before I add it to the list of tables that can be queried?
Chris,
I'm trying to reproduce this error to figure out why I can do a Bulk API query on Campaign, but you can't. What are your CRUD settings on Campaign in the user's profile?
Cheers,
Pat
Hi, I did checked the response from DescribeGlobal and found that the Object which is working[Task] is having more permissions than the Object [Account]. In our case Task is working and account is causing problem in case of Bulk API.
Though both are having permissions as queryable, retrieveable and searchable true.
Could you please also check and compare two different objects one which is working and other which is not working.
@BC_IA - What are the differences in the permissions between Task and Account? I'd like to try to reproduce this and pin it down as much as possible.
Sorry for the late reply Pat.
As I mentioned both are having permissions as queryable, retrieveable and searchable to true and infact that is what we require for quering/retrieving from BulkAPI.
I am just fetching data in both the cases, but Task is having more permissions as Creatable, insertable and etc. So my assumption is that there could be bug in there system which is checking some other persmission as well.
If anyone else can verify than we can reach to the final conclusion.
Hi,
Appologies for the delay in replying.
Ok, so I iterated through the objects using:
for (DescribeGlobalSObjectResult sObjectResult : stub.describeGlobal().getSobjects()) {
I then printed out a list of permissions for "Campaign" (which shows an error when I try and query) and "Task", which I am able to query. The permissions are as follows:
Campaign:
isActivateable=false
isCreateable=false
isCustom=false
isCustomSetting=false
isDeletable=false
isDeprecatedAndHidden=false
isFeedEnabled=false
isLayoutable=true
isMergeable=false
isQueryable=true
isReplicateable=true
isRetrieveable=true
isSearchable=true
isTriggerable=true
isUndeletable=false
isUpdateable=false
Task:
isActivateable=false
isCreateable=true
isCustom=false
isCustomSetting=false
isDeletable=true
isDeprecatedAndHidden=false
isFeedEnabled=false
isLayoutable=true
isMergeable=false
isQueryable=true
isReplicateable=true
isRetrieveable=true
isSearchable=true
isTriggerable=true
isUndeletable=true
isUpdateable=true
So in both cases isQueryable=true.
Hi,
Is there any update on this?
I'm also trying to figure this one out. Any update?
Chris - apologies for the delay in replying. Please log a case on this, if you have not already done so.