+ Start a Discussion
Chirag MehtaChirag Mehta 

java.lang.IllegalArgumentException: array element type mismatch

Hello frnds i want to retrieve data from SFDC on basis of list of ID's
 
I tried two ways but both are not working
 
1)using retrieve method
String fieldList="Id,Website_Unique_ID__c,ConvertedContactID,IsConverted";

sObjects=sfdc.retrieve(fieldList,"Lead",idArray);

An unexpected error has occurred.; nested exception is:

java.lang.IllegalArgumentException: array element type mismatch

2)using Query method

String fieldList="Id,Website_Unique_ID__c,ConvertedContactID,IsConverted";

String query1 = "Select "+fieldList+" from Lead where "+idList;

System.out.println(query1);

QueryResult qr=sfdc.query(query1);

Output:-

Select IsConverted from Lead where Id='00Q3000000E47VJEAZ' OR Id='00Q3000000E47V9EAJ' OR Id='00Q3000000E47VBEAZ' OR Id='00Q3000000E2Vs1EAF' OR Id='00Q3000000E47VZEAZ'

- Exception:

org.xml.sax.SAXException: Invalid element in com.sforce.soap.enterprise.sobject.SObject - type

at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)

at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)

at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)

at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)

at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)

at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)

at org.apache.axis.client.Call.invoke(Call.java:2467)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at com.sforce.soap.enterprise.SoapBindingStub.query(SoapBindingStub.java:1656)

at brsfdc.BRSFDCDatabase.retrieveFromSFDC(BRSFDCDatabase.java:107)

at brsfdc.BRSFDCIntegrationProcess.main(BRSFDCIntegrationProcess.java:77)

An unexpected error has occurred.; nested exception is:

org.xml.sax.SAXException: Invalid element in com.sforce.soap.enterprise.sobject.SObject - type

 
 
Sunil NandipatiSunil Nandipati
Quite strange ... bcoz it worked fine when I tried the same using SForce explorer.
Just try to find out on which parameter you are getting the error.  Try passing each parameter one at a time to check the same.
 
All the best and keep us posted about your find.
 
 
SuperfellSuperfell
You're mixing API endpoints, looks like you're using the enterprise API, but sending the request to the Partner API URL.
Chirag MehtaChirag Mehta

Can u tell me how to verify the same

Following is the snippet which is used by me for setting Endpoint URL

BRSFDCConfiguration.C_SFDC_SERVERURL is https://www.salesforce.com/services/Soap/u/7.0

URL serverUrl = new URL(BRSFDCConfiguration.C_SFDC_SERVERURL);

sfdc = (SoapBindingStub) new SforceServiceCompressed().getSoap(serverUrl);

loginResult = sfdc.login(BRSFDCConfiguration.C_SFDC_USERNAME,BRSFDCConfiguration.C_SFDC_PASSWORD);

sfdc._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,loginResult.getServerUrl());

 

I dont find anything wrong with the same pls suggest if i m wrong in abv snippet

SuperfellSuperfell
You'll find that the .../u/7.0 doesn't match the URL in the enterprise WSDL, it should be .../c/7.0
Chirag MehtaChirag Mehta

The abv thing helped me and its working fine now

No the code reads as follows

 

URL serverUrl = new URL("https://www.salesforce.com/services/Soap/c/7.0");

this.sfdc = (SoapBindingStub) new SforceServiceCompressed().getSoap(serverUrl);

logMsgs.info("Attempting to connect "+serverUrl+".......");

this.loginResult = sfdc.login(

BRSFDCConfiguration.C_SFDC_USERNAME_STR,

BRSFDCConfiguration.C_SFDC_PASSWORD_STR);

Calendar cal = Calendar.getInstance();

this.loginTime_int=cal.get(Calendar.MILLISECOND );

this.sfdc._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,this.loginResult.getServerUrl());