function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
wsp63002wsp63002 

"Invalid element in com.sforce.soap.enterprise.sobject.Account - Active__c"

I'm seeing the following errors from trying to do an Account lookup...can someone help me to understand the issue of Invalid Element? Thanks. -abe

-------

[2005-10-19 07:53:44,527] INFO Connecting to Salesforce.com Web Services API using account xxxxxxxxxxx
[2005-10-19 07:53:54,621] INFO Session Obtained is xxxxxxxx
[2005-10-19 07:53:56,558] ERROR Exception:
org.xml.sax.SAXException: Invalid element in com.sforce.soap.enterprise.sobject.Account - Active__c
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:260)
at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:963)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
at org.apache.axis.client.Call.invoke(Call.java:2343)
at org.apache.axis.client.Call.invoke(Call.java:2240)
at org.apache.axis.client.Call.invoke(Call.java:1755)
at com.sforce.soap.enterprise.SoapBindingStub.search(SoapBindingStub.java:1814)
at com.rndc.AccountLoader.find(AccountLoader.java:40)
at com.rndc.AccountLoader.main(AccountLoader.java:101)
[2005-10-19 07:53:56,558] FATAL ; nested exception is:
org.xml.sax.SAXException: Invalid element in com.sforce.soap.enterprise.sobject.Account - Active__c
[2005-10-19 07:53:56,558] FATAL
SuperfellSuperfell
You've asked the service to return an element that didn't exist at the time your WSDL was generated, the client stub generated from that WSDL know's nothing about the Active__c element, and so complains when it sees one.

If you're using the enterprise WSDL, you need to use fixed sets of fields, not dynamicly from the describes, otherwise you'll continue to run into this problem.
Mr. Kirill YunussovMr. Kirill Yunussov

This error indicates that your Salesforce client cannot recognize the SObject type, so it's not able to interpret any of that SObject's fields other than ID. 
To resolve - not only do you need to import the new object's definition into your WSDL, you also need to update the qName section of your com.sforce.soap.enterprise.SoapBindingStub class to reference this new SObject type.  Looks something like this:
 
qName = new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "My_New_Object__c");
cachedSerQNames.add(qName);
cls = com.sforce.soap.enterprise.sobject.My_New_Object__c.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);

If you don't update SoapBindingStub class - you will still be able to query the new SObject, but no fields except the ID field.  For any other fields, you will get the following error:
org.xml.sax.SAXException: Invalid element in com.sforce.soap.enterprise.sobject.SObject - Custom_Field__c