You need to sign in to do that
Don't have an account?
Jim Zhan
How to Create/Update SObject via ZSI?
I'm using ZSI ver2.0 to access Salesforce with partner.wsdl.xml, I can now use login/query/describe methods, but how can I create a Sobject to construct the creation request? I really have no idea about it. Here's the definition of Sobject & Create from the file I generated by using wsdl2py (with params: wsdl2py -ebf partner.wsdl.xml)
Code:
Code:
Code:
class sObject_Def(ZSI.TCcompound.ComplexType, TypeDefinition): schema = "urn:sobject.partner.soap.sforce.com" type = (schema, "sObject") def __init__(self, pname, ofwhat=(), attributes=None, extend=False, restrict=False, **kw): ns = ns0.sObject_Def.schema TClist = [ZSI.TC.String(pname=(ns,"type"), aname="_type", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.String(pname=(ns,"fieldsToNull"), aname="_fieldsToNull", minOccurs=0, maxOccurs="unbounded", nillable=True, typed=False, encoded=kw.get("encoded")), GTD("urn:partner.soap.sforce.com","ID",lazy=False)(pname=(ns,"Id"), aname="_Id", minOccurs=1, maxOccurs=1, nillable=True, typed=False, encoded=kw.get("encoded")), ZSI.TC.AnyElement(aname="_any", minOccurs=0, maxOccurs="unbounded", nillable=False, processContents="lax")] self.attribute_typecode_dict = attributes or {} if extend: TClist += ofwhat if restrict: TClist = ofwhat ZSI.TCcompound.ComplexType.__init__(self, None, TClist, pname=pname, inorder=0, **kw) class Holder: __metaclass__ = pyclass_type typecode = self def __init__(self): # pyclass self._type = None self._fieldsToNull = [] self._Id = None self._any = [] return Holder.__name__ = "sObject_Holder" self.pyclass = Holder
Code:
class create_Dec(ZSI.TCcompound.ComplexType, ElementDeclaration): literal = "create" schema = "urn:partner.soap.sforce.com" def __init__(self, **kw): ns = ns1.create_Dec.schema TClist = [GTD("urn:sobject.partner.soap.sforce.com","sObject",lazy=False)(pname=(ns,"sObjects"), aname="_sObjects", minOccurs=0, maxOccurs="unbounded", nillable=False, typed=False, encoded=kw.get("encoded"))] kw["pname"] = ("urn:partner.soap.sforce.com","create") kw["aname"] = "_create" self.attribute_typecode_dict = {} ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw) class Holder: __metaclass__ = pyclass_type typecode = self def __init__(self): # pyclass self._sObjects = [] return Holder.__name__ = "create_Holder" self.pyclass = Holder class createResponse_Dec(ZSI.TCcompound.ComplexType, ElementDeclaration): literal = "createResponse" schema = "urn:partner.soap.sforce.com" def __init__(self, **kw): ns = ns1.createResponse_Dec.schema TClist = [GTD("urn:partner.soap.sforce.com","SaveResult",lazy=False)(pname=(ns,"result"), aname="_result", minOccurs=0, maxOccurs="unbounded", nillable=False, typed=False, encoded=kw.get("encoded"))] kw["pname"] = ("urn:partner.soap.sforce.com","createResponse") kw["aname"] = "_createResponse" self.attribute_typecode_dict = {} ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw) class Holder: __metaclass__ = pyclass_type typecode = self def __init__(self): # pyclass self._result = [] return Holder.__name__ = "createResponse_Holder" self.pyclass = Holderany help will be appreciated.
Code:
SOAP message
Code:
Error
Code:
Message Edited by Jim Zhan on 04-12-2007 09:18 PM