+ Start a Discussion
System Integration 10System Integration 10 

Error using .create method

I using the Salesforce Enterprise API with VB.NET.

I am trying to create a new Account in Salesforce.  If I have to update an Account, that works.   I can't figure out what field needs to populated.   I also can't find any documentation or clarification what the error Id means.  I logged into the Salesforce GUI to review the fields available.   I reviewed the field definition screen.  I also reviewed the import wizard for "Account" to see if I was missing any fields.   

I get this error returned:

---> System.ServiceModel.FaultException: Unable to create instance of the deserializer shared.xml.soap.serialization.BeanDeserializer for type: class common.api.soap.wsdl.Address and element: null Error Id: 1463981581-15526 (1031368374)
 
I am populating all possible fields I could find in the Account object, but I still get an error.
 
Dim descSObjectResult As New SalesforceWS.DescribeSObjectResult
                    Dim packHeader As New SalesforceWS.PackageVersion()
                    packHeader.majorNumber = 32
                    packHeader.minorNumber = 0
                    packHeader.namespace = String.Empty

                    Dim localOptions As New SalesforceWS.LocaleOptions
                    localOptions.language = "en_US"
                    localOptions.localizeErrors = True
                    localOptions.localizeErrorsSpecified = True

                    wsClient.describeSObject(header, New SalesforceWS.PackageVersion() {packHeader}, localOptions, "Account", descSObjectResult)

                    Dim fields As SalesforceWS.Field() = descSObjectResult.fields()

                    Dim fieldList As String = "Id,Name,BillingAddress,OwnerId,owner.firstname, owner.lastname,"
                    Dim requiredFieldList As String = fieldList
                    For Each field As SalesforceWS.Field In fields
                        If field.permissionable AndAlso (field.updateable OrElse field.createable) Then
                            fieldList &= field.name & ","
                        End If
                        If Not field.nillable Then
                            requiredFieldList &= field.name & ","
                        End If
                    Next

                    fieldList = fieldList.TrimEnd(",")
                    requiredFieldList = requiredFieldList.TrimEnd(",")

                    wsClient.describeSObject(header, New SalesforceWS.PackageVersion() {packHeader}, localOptions, "User", descSObjectResult)

                    Dim userFieldList As String = String.Empty
                    For Each field As SalesforceWS.Field In fields
                        userFieldList &= field.name & ","
                    Next

                    Dim queryOptions As New SalesforceWS.QueryOptions
                    queryOptions.batchSize = 100
                    queryOptions.batchSizeSpecified = True

                    Dim mruHeader As New SalesforceWS.MruHeader
                    mruHeader.updateMru = False

                    Dim sObjects() As SalesforceWS.sObject = New SalesforceWS.sObject() {}
                    If companyData.ExternalID <> String.Empty Then
                        wsClient.retrieve(header, queryOptions, mruHeader, New SalesforceWS.PackageVersion() {packHeader}, fieldList, "Account", New String() {companyData.ExternalID}, sObjects)
                    Else
                        Dim qrResult As New SalesforceWS.QueryResult()
                        wsClient.query(header, queryOptions, mruHeader, New SalesforceWS.PackageVersion() {packHeader}, "SELECT ID FROM Account WHERE Name like '" & companyData.Name & "%' LIMIT 1", qrResult)
                        If qrResult.records IsNot Nothing AndAlso qrResult.records.Length > 0 Then
                            wsClient.retrieve(header, queryOptions, mruHeader, New SalesforceWS.PackageVersion() {packHeader}, fieldList, "Account", New String() {qrResult.records(0).Id}, sObjects)
                        End If
                    End If

                    Dim createRecord As Boolean = False
                    Dim accountID As String = String.Empty

                    Dim accountObject As SalesforceWS.Account = Nothing
                    If sObjects IsNot Nothing AndAlso sObjects.Length > 0 Then
                        accountObject = DirectCast(sObjects(0), SalesforceWS.Account)
                    End If

                    Dim userSObjects() As SalesforceWS.sObject = New SalesforceWS.sObject() {}
                    wsClient.retrieve(header, queryOptions, mruHeader, New SalesforceWS.PackageVersion() {packHeader}, "Id", "User", New String() {loginResp.userId}, userSObjects)
                    Dim userObject As SalesforceWS.User = Nothing
                    If userSObjects IsNot Nothing AndAlso userSObjects.Length > 0 Then
                        userObject = DirectCast(userSObjects(0), SalesforceWS.User)
                    End If

                    If accountObject Is Nothing Then
                        createRecord = True
                        accountObject = New SalesforceWS.Account
                        accountObject.BillingAddress = New SalesforceWS.address
                        accountObject.ShippingAddress = New SalesforceWS.address
                        accountObject.ShippingAddress.street = String.Empty
                        accountObject.ShippingAddress.city = String.Empty
                        accountObject.ShippingAddress.stateCode = String.Empty
                        accountObject.ShippingAddress.state = String.Empty
                        accountObject.ShippingAddress.postalCode = String.Empty
                        accountObject.ShippingAddress.countryCode = String.Empty
                        accountObject.ShippingAddress.country = String.Empty
                        accountObject.ShippingLatitudeSpecified = False
                        accountObject.ShippingLongitudeSpecified = False
                        accountObject.ShippingCity = String.Empty
                        accountObject.ShippingPostalCode = String.Empty
                        accountObject.ShippingState = String.Empty
                        accountObject.ShippingStreet = String.Empty
                        accountObject.ShippingCountry = String.Empty
                        accountObject.PersonMailingAddress = New SalesforceWS.address
                        accountObject.PersonMailingAddress.street = String.Empty
                        accountObject.PersonMailingAddress.city = String.Empty
                        accountObject.PersonMailingAddress.stateCode = String.Empty
                        accountObject.PersonMailingAddress.state = String.Empty
                        accountObject.PersonMailingAddress.postalCode = String.Empty
                        accountObject.PersonMailingAddress.countryCode = String.Empty
                        accountObject.PersonMailingAddress.country = String.Empty
                        accountObject.PersonHomePhone = String.Empty
                        accountObject.PersonMailingCity = String.Empty
                        accountObject.PersonMailingCountry = String.Empty
                        accountObject.PersonTitle = String.Empty
                        accountObject.PersonMailingState = String.Empty
                        accountObject.PersonMailingStreet = String.Empty
                        accountObject.PersonMailingPostalCode = String.Empty
                        accountObject.Owner = userObject
                        accountObject.Owner.Name = String.Empty
                        accountObject.OwnerId = loginResp.userId
                        accountObject.LastModifiedBy = userObject
                        accountObject.CreatedDate = Date.Now
                        accountObject.CreatedById = loginResp.userId
                        accountObject.ParentId = String.Empty
                        accountObject.IsDeleted = False
                        accountObject.IsDeletedSpecified = True
                        accountObject.PersonHasOptedOutOfEmail = False
                        accountObject.PersonHasOptedOutOfEmailSpecified = True
                        accountObject.LID__LinkedIn_Company_Id__c = String.Empty
                        accountObject.LID__LinkedIn_Company_Id__pc = String.Empty
                        accountObject.LID__LinkedIn_Member_Token__pc = String.Empty
                        accountObject.Account_Number_Limo__c = String.Empty
                        accountObject.Description = String.Empty
                        accountObject.Name_on_Card__c = String.Empty
                        accountObject.Commission_Payment__c = String.Empty
                        accountObject.Website = String.Empty
                        accountObject.Account_Owner_Limo__c = String.Empty
                        accountObject.Account_Manager__c = String.Empty
                        Dim recordType As New SalesforceWS.RecordType
                        recordType.Name = String.Empty
                        accountObject.RecordType = recordType
                        accountObject.PersonContactId = String.Empty
                        accountObject.PersonDepartment = String.Empty
                        accountObject.PersonEmail = String.Empty
                        accountObject.PersonTitle = String.Empty
                        accountObject.PersonHomePhone = String.Empty
                        accountObject.PersonMailingPostalCode = String.Empty
                        accountObject.PersonMailingState = String.Empty
                        accountObject.PersonMailingStreet = String.Empty
                        accountObject.PersonMobilePhone = String.Empty
                        accountObject.PersonEmailBouncedDateSpecified = False
                        accountObject.PersonDoNotCallSpecified = False
                        accountObject.PersonHasOptedOutOfEmailSpecified = False
                        accountObject.PersonLastCURequestDateSpecified = False
                        accountObject.PersonLastCUUpdateDateSpecified = False
                        accountObject.PersonMailingLatitudeSpecified = False
                        accountObject.PersonMailingLongitudeSpecified = False
                        accountObject.NumberOfEmployees = 0
                        accountObject.NumberOfEmployeesSpecified = True
                        accountObject.IsPersonAccount = False
                        accountObject.IsPersonAccountSpecified = False
                        accountObject.et4ae5__Mobile_Country_Code__pc = String.Empty
                        accountObject.TSD_Nickname__pc = companyData.ExternalID
                        accountObject.Type = String.Empty
                        accountObject.Industry = String.Empty
                        accountObject.AccountSource = String.Empty
                        accountObject.Commission_Percent_Limo_ROW__cSpecified = False
                        accountObject.Commission_Percent_Limo_LA__cSpecified = False
                        accountObject.Commission_Dollars_Limo_ROW__cSpecified = False
                        accountObject.Commission_Dollars_Limo_LA__cSpecified = False
                        accountObject.FirstName = String.Empty
                        accountObject.LastName = String.Empty
                        accountObject.Account_Source_Map__c = String.Empty
                        accountObject.Source_Existing_Account__c = String.Empty
                        accountObject.Source_Existing_Contact__c = String.Empty
                        accountObject.Source_Existing_Customer__c = String.Empty
                        accountObject.Source_Internal_Employee__c = String.Empty
                        accountObject.Source_Detail__c = String.Empty
                        accountObject.Source_Other__c = String.Empty
                        accountObject.Affiliation__c = String.Empty
                        accountObject.BillingLatitudeSpecified = False
                        accountObject.BillingLongitudeSpecified = False
                        accountObject.Contact_Code__pc = String.Empty
                        accountObject.Contact_Notes__pc = String.Empty
                        accountObject.PhotoUrl = String.Empty
                        accountObject.SystemModstampSpecified = False
                        accountObject.UniqueEntry__Account_Dupes_Ignored__cSpecified = False
                        accountObject.UniqueEntry__Contact_Dupes_Ignored__pcSpecified = False
                        accountObject.UniqueEntry__Lead_Dupes_Ignored__pcSpecified = False
                        accountObject.et4ae5__HasOptedOutOfMobile__pcSpecified = False
                        accountObject.et4ae5__Mobile_Country_Code__pc = String.Empty
                    End If

                    accountObject.Id = companyData.ExternalID
                    accountObject.Account_Number_Rental__c = companyData.Number
                    accountObject.Name = companyData.Name
                    accountObject.Category__c = companyData.CmpType
                    accountObject.BillingAddress.street = companyData.Street1 & If(companyData.Street2 <> String.Empty, vbCrLf & companyData.Street2, String.Empty) & If(companyData.Street3 <> String.Empty, vbCrLf & companyData.Street3, String.Empty)
                    accountObject.BillingAddress.city = companyData.City
                    accountObject.BillingAddress.stateCode = companyData.State
                    accountObject.BillingAddress.state = companyData.State
                    accountObject.BillingAddress.postalCode = companyData.Zip
                    accountObject.BillingAddress.countryCode = companyData.Country
                    accountObject.BillingAddress.country = companyData.Country
                    accountObject.BillingCity = accountObject.BillingAddress.city
                    accountObject.BillingCountry = accountObject.BillingAddress.country
                    accountObject.BillingPostalCode = accountObject.BillingAddress.postalCode
                    accountObject.BillingState = accountObject.BillingAddress.state
                    accountObject.BillingStreet = accountObject.BillingAddress.street
                    accountObject.Phone = companyData.Phone
                    accountObject.Fax = companyData.Fax
                    accountObject.Company_Email__c = companyData.Emails
                    accountObject.Direct_Bill_Company__c = companyData.DirectBillCompany
                    accountObject.Direct_Bill_Company__cSpecified = True

                    accountObject.Card_Type__c = companyData.CCType
                    accountObject.Credit_Card__c = companyData.CCNumber
                    accountObject.Credit_Card_Expiration_Date__c = companyData.CCExp
                    accountObject.Category__c = companyData.Source
                    accountObject.IATA__c = companyData.IATANumber
                    accountObject.Notes__c = companyData.Notes
                    accountObject.Commission_Rental_Dollars_Staff__c = companyData.ReferralCommissionFlat
                    accountObject.Commission_Rental_Dollars_Staff__cSpecified = True
                    accountObject.Commission_Rental_Percent_Staff__c = companyData.ReferralCommissionPercent
                    accountObject.Commission_Rental_Percent_Staff__cSpecified = True
                    accountObject.Rental_net_User_ID__pc = companyData.SalespersonID
                    accountObject.Owner.FirstName = companyData.SalespersonFirst
                    accountObject.Owner.LastName = companyData.SalespersonLast
                    accountObject.LastModifiedBy = userObject
                    accountObject.LastModifiedDate = Date.Now
                    accountObject.LastModifiedById = loginResp.userId

                    Dim asHeader As New SalesforceWS.AssignmentRuleHeader()
                    asHeader.useDefaultRule = True
                    asHeader.assignmentRuleId = String.Empty

                    Dim aftHeader As New SalesforceWS.AllowFieldTruncationHeader()
                    aftHeader.allowFieldTruncation = True

                    Dim dftHeader As New SalesforceWS.DisableFeedTrackingHeader()
                    dftHeader.disableFeedTracking = True

                    Dim seHeader As New SalesforceWS.StreamingEnabledHeader()
                    seHeader.streamingEnabled = True

                    Dim anHeader As New SalesforceWS.AllOrNoneHeader()
                    anHeader.allOrNone = True

                    Dim dbHeader As New SalesforceWS.DebuggingHeader()
                    If basicParams.WSPerformLogging Then
                        dbHeader.debugLevel = SalesforceWS.DebugLevel.DebugOnly
                    Else
                        dbHeader.debugLevel = SalesforceWS.DebugLevel.None
                    End If

                    Dim eHeader As New SalesforceWS.EmailHeader()
                    eHeader.triggerAutoResponseEmail = False
                    eHeader.triggerOtherEmail = False
                    eHeader.triggerUserEmail = False

                    Dim ownerChangeOptions As New SalesforceWS.OwnerChangeOptions()
                    ownerChangeOptions.transferAttachments = False
                    ownerChangeOptions.transferOpenActivities = False

                    Dim liHeader As New SalesforceWS.LimitInfo()
                    liHeader.limit = 5

                    Dim srResult As New SalesforceWS.SaveResult()

                    If createRecord Then
                        wsClient.create(header, asHeader, mruHeader, aftHeader, dftHeader, seHeader, anHeader, localOptions, dbHeader, New SalesforceWS.PackageVersion() {packHeader}, eHeader, New SalesforceWS.sObject() {accountObject}, New SalesforceWS.LimitInfo() {liHeader}, New SalesforceWS.SaveResult() {srResult})
                    Else
                        wsClient.update(header, asHeader, mruHeader, aftHeader, dftHeader, seHeader, anHeader, localOptions, dbHeader, New SalesforceWS.PackageVersion() {packHeader}, eHeader, ownerChangeOptions, New SalesforceWS.sObject() {accountObject}, New SalesforceWS.LimitInfo() {liHeader}, New SalesforceWS.SaveResult() {srResult})
                    End If

 
Scott GillisScott Gillis
I am receiving a similar error message when trying to create a new lead which includes an Address object. I'm using C# and my code is:
//Where serviceBinding is a SforceService.SforceService (the WSDL object)
            List<sObject> newLeads= new List<sObject>();
            newLeads.Add(new Lead { FirstName = "TestLead2", LastName = "Smith", Email = "testlead2@email.com", Company="testing corp" , Address = new address {street="123 rocky road", city="chocolate", state="OH" } });
            newLeads.Add(new Lead { FirstName = "TestLead3", LastName = "Smith", Email = "testlead3@email.com", Company = "testing corp", Address = new address { street = "123 rocky road", city = "chocolate", state = "OH" } });

            return serviceBinding.create(newLeads.ToArray()).ToList();

My error message is:
System.Web.Services.Protocols.SoapHeaderException: Unable to create instance of the deserializer shared.xml.soap.serialization.BeanDeserializer for type: class common.api.soap.wsdl.Address and element: null Error Id: 1475058262-301983 (1031368374)

I am able to successfully create leads when no address object is included, so I'm inclined to think this issue stems from the nested objects.