You need to sign in to do that
Don't have an account?
How to add fields to sObject using partner wsdl / axis2
(2nd attempt; formatting got messed up last time)
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 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.
Hi,
I'm using Axis 1.4 with with V19 API. It has set_any and I've used it to add fields. Please use it and let me know if it works for you.