You need to sign in to do that
Don't have an account?
Julio Cesar Boll
Create Contacts by Java SOAP API
Hi guys,
I'm trying to create one or more contacts by Java SOAP Enterprise API but I'm getting error.
This is the code:
for (int i=0;i<5;i++) { Contact c = new Contact(); c.setFirstName("aaaa"); c.setLastName("bbbb"); c.setTitle(""+i); c.setDepartment(""+i); c.setBirthdate(null); c.setReportsToId(null); c.setLeadSource(""+i); c.setMailingAddress(null); c.setDescription(""+i); c.setHomePhone(""+i); c.setMobilePhone(""+i); c.setFax(""+i); c.setEmail("aaa"+i+"@bbb.com"); contacts[i] = c; }And this is the StackTrace of the error:
[InvalidSObjectFault [ApiQueryFault [ApiFault exceptionCode='INVALID_TYPE' exceptionMessage='Must send a concrete entity type.' extendedErrorDetails='{[0]}' ] row='-1' column='-1' ] ]Thanks in advance.
Please refer below link which has the example that creates a contact record with several fields. It iterates through the results of the create call and checks whether the operation was successful or not. If the create operation was successful, it writes the ID of the contact created to the console. Otherwise, it iterates through the errors and writes details of each error to the console. In this case, the output of the example is the ID of the new contact.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sample_create_call.htm
Hope this helps you!
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards
Sandhya
Hi Sandhya,
Thanks for your reply. But this is for PARTNER API, and I'm using ENTERPRISE API.
Do you have a Sample for Enterprise?
Thanks in advance.
Just see below links if you are looking for the same.
https://developer.salesforce.com/page/Introduction_to_the_Force.com_Web_Services_Connector
http://wpcertification.blogspot.sg/2013/11/using-salesforce-soap-api-from-java-code.html
Hope this helps you!
Thanks and Regards
Sandhya
Hi Sandhya,
I used the first link as a model to Create records in Salesforce but I changed the `Account` for `Contact` class and now I'm getting the error I said.
The second link is just a `Query` to `GET` the records.
Thanks in advance.