We are integrating Salesforce and Oracle through SAP PI and as part of this, daily records from Oracle will be fetched by SAP PI and will be upserted to Salesforce. The standard salesforce SOAP API is being used for this which is shared with SAP PI. On SAP PI side, new SOAP envelope was created(as the salesforce SOAP API wsdl cannot be used as it is) which is as below(sample) :
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://schemas.xmlsoap.org/soap/envelope/">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ens="urn:sobject.enterprise.soap.sforce.com" xmlns:p0="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="urn:enterprise.soap.sforce.com" elementFormDefault="qualified">
<xsd:element name="SessionHeader">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="p0:sessionId" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="sessionId">
<xsd:complexType />
</xsd:element>
<xsd:element name="upsert">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="externalIDFieldName" type="xsd:string" />
<xsd:element ref="p0:sObjects" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="sObjects">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="ens:sObject">
<xsd:sequence>
<xsd:element name="customfield1__c" type="xsd:integer" minOccurs="0" nillable="true" />
<xsd:element name="lookupfield__r" type="ens:CustObj1__c:snum__c" minOccurs="0" nillable="true" />
</xsd:sequence>
<xsd:attribute ref="xsi:type" use="required" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" elementFormDefault="qualified">
<xsd:element name="Envelope">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Header" />
<xsd:element ref="Body" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Header">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="urn:SessionHeader" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Body">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="urn:upsert" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:p0="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://www.w3.org/2001/XMLSchema-instance" elementFormDefault="qualified">
<xsd:attribute name="type" type="xsd:NCName" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="Header">
<wsdl:part xmlns:p5="http://schemas.xmlsoap.org/soap/envelope/" name="Header" element="p5:Header" />
</wsdl:message>
<wsdl:message name="Body">
<wsdl:part xmlns:p5="http://schemas.xmlsoap.org/soap/envelope/" name="Body" element="p5:Body" />
</wsdl:message>
<wsdl:message name="Envelope">
<wsdl:part xmlns:p5="http://schemas.xmlsoap.org/soap/envelope/" name="Envelope" element="p5:Envelope" />
</wsdl:message>
</wsdl:definitions>
As you see the above, there is one field called "customfield1__c" and a lookup field to other object(CustObj1__c) called "lookupfield__r". The Upsert was successful by including a single field "customfield1__c" and by removing the "lookupfield__r" in the mapping above. If we include the "lookupfield__r" in the above, the upsert was unsuccessful. For more clarity, "lookupfield__c" is lookup to the custom object "CustObj1__c".
Please help in resolving this. Thanks.