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
ManishFromCiscoManishFromCisco 

How to add fields to sObject using partner wsdl / axis2

Hi All, I'm accessing salesforce using the partner wsdl version 19.0. I would like to create a new 'EmailMessage' object. I understand this means I have to create a new 'SObject' with type 'EmailMessage'. However, how do I set fields? I'm using Axis2 version 1.5.1. code snippet: SObject email = new SObject(); email.setId(null); // new object email.setType("EmailMessage"); // How to set fields???!!!??? binding.create(new SObject[]{email} ...); The SObject class has only the following add/set methods: addFieldsToNull(String) addExtraElement(OMElement) setId(ID) setType(String) setExtraElement(OMElement[]) setFieldsToNull(String[]) I'm assuming the addExtraElement() (or the setExtraElement) is the most appropriate. However, with Axis2, I don't can't figure out how to create an OMElement. OMElement is an interface that is implemented by the following classes: ElementImpl, OMElementImpl, OMSourcedElementImpl, SOAP11BodyImpl, SOAP11BodyImpl, SOAP11FaultCodeImpl, SOAP11FaultCodeImpl, SOAP11FaultDetailImpl, SOAP11FaultDetailImpl, SOAP11FaultImpl, SOAP11FaultImpl, SOAP11FaultReasonImpl, SOAP11FaultReasonImpl, SOAP11FaultRoleImpl, SOAP11FaultRoleImpl, SOAP11FaultSubCodeImpl, SOAP11FaultSubCodeImpl, SOAP11FaultTextImpl, SOAP11FaultTextImpl, SOAP11FaultValueImpl, SOAP11FaultValueImpl, SOAP11HeaderBlockImpl, SOAP11HeaderBlockImpl, SOAP11HeaderImpl, SOAP11HeaderImpl, SOAP12BodyImpl, SOAP12BodyImpl, SOAP12FaultCodeImpl, SOAP12FaultCodeImpl, SOAP12FaultDetailImpl, SOAP12FaultDetailImpl, SOAP12FaultImpl, SOAP12FaultImpl, SOAP12FaultNodeImpl, SOAP12FaultNodeImpl, SOAP12FaultReasonImpl, SOAP12FaultReasonImpl, SOAP12FaultRoleImpl, SOAP12FaultRoleImpl, SOAP12FaultSubCodeImpl, SOAP12FaultSubCodeImpl, SOAP12FaultTextImpl, SOAP12FaultTextImpl, SOAP12FaultValueImpl, SOAP12FaultValueImpl, SOAP12HeaderBlockImpl, SOAP12HeaderBlockImpl, SOAP12HeaderImpl, SOAP12HeaderImpl, SOAPBodyImpl, SOAPBodyImpl, SOAPElement, SOAPElement, SOAPEnvelopeImpl, SOAPEnvelopeImpl, SOAPFaultCodeImpl, SOAPFaultCodeImpl, SOAPFaultDetailImpl, SOAPFaultDetailImpl, SOAPFaultImpl, SOAPFaultImpl, SOAPFaultNodeImpl, SOAPFaultNodeImpl, SOAPFaultReasonImpl, SOAPFaultReasonImpl, SOAPFaultRoleImpl, SOAPFaultRoleImpl, SOAPFaultSubCodeImpl, SOAPFaultSubCodeImpl, SOAPFaultTextImpl, SOAPFaultTextImpl, SOAPFaultValueImpl, SOAPFaultValueImpl, SOAPHeaderBlockImpl, SOAPHeaderBlockImpl, SOAPHeaderImpl, SOAPHeaderImpl, SOAPTextImpl, SOAPTextImpl The sample given here: http://wiki.developerforce.com/index.php/Java_Partner_WSDL_Samples_10.0 uses the SObject.set_any(MessageElement[]) call to set the sub-fields. I don't see that method in SObject, or the MessageElement class in axis. However, the sample uses axis version 1.4 with partner wsdl version 10. Is this due to the difference in axis versions? (axis v 1.4 verses axis2 v 1.5.1?) or due to the difference in partner wsdl versions? (v 10.0 verses v 19.0)? Anyone got this working with axis2 and a newer partner wsdl? Any pointers appreciated. Thanks.
GGJ2GGJ2

I have the same problem.  Using Java, partner wsdl and Axis2 with xmlbeans.  SObject.set_any(MessageElement[]) is not available.  I believe MessageElement is a Axis 1.x class. 

 

How do I set the fields in my SObject using Axis2?  Anyone have an example?

SuperfellSuperfell

Well, i wouldn't recommend using Axis2, but if you're sticking with it, have you see the xmlbeans tutorials ? http://xmlbeans.apache.org/samples/Any.html