I am trying to invoke create method from SOAP API(Enterprise wsdl) from SOAPUI tool with the below request:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <urn:sObject xsi:type="CustomObject__c">           
         <urn:sObject xsi:type="CustomObject__c">           

and the response is:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <faultstring>'abc' is not valid for the type xsd:double</faultstring>

Open_Volume__c is a Number type field in CustomObject__c. I am trying to insert two CustomObject__c records, one with valid Open_Volume__c as 2222 and the other with invalid Open_Volume__c as abc. As AllOrNoneHeader header is set to false, I though first record whose Open_Volume__c is 2222 gets inserted successfully and it would give error for the second record but actually no record is inserted. Is there any possibility to make valid records to insert successfully in these type of situations?



As you can see, you're receiving a fault response:

<faultstring>'abc' is not valid for the type xsd:double</faultstring> 

That tells you that your multi-record soap call isn't fault tolerant and rejects a call where any of the data received generates a fault error, in this case a type error.

No one knows why that error occurred. It could be an issue with a packed failing or corruption, not just that the source data wasn't valid. That's the assumption that's being made by the SOAP API. For that reason, it's being assumed that all of the data received could be corrupt. Because of that, the SOAP API won't use the create() method to insert your records.

To work around this, you'd need to write your own service to allow partial success of incoming data when it's being validated, then return faults of record Ids (assuming they could be captured) that couldn't pass validation when they were received. Otherwise, you'd need to return Id's that were successfully receive to compare with what was sent.

The system on the other end would need to be able to recover from that and only resend the records which generated those errors or else weren't returned as having been received. More accurately, you'd need to have an admin fix and then resend them if the error wasn't caused by corruption during transmission.

  • N.B. where in this case, the "code that would try and insert the records` is in fact the SFDC SOAP API that does the create() operation. There's no apex involved here. The request is bombing because it fails XSD validation – cropredy Dec 21 '16 at 18:04
  • @cropredy, Thank you for adding the clarification. After rereading his question, I see exactly what you're saying. He's not using a custom API connector, he's using the pure SOAP API connector and is thus failing the validation. There's no way around that with that API. – crmprogdev Dec 21 '16 at 18:54
  • Thanks crmprogdev and cropredy for your responses. Please let me know if there is any possibility to have partial success of allowing valid records to get inserted successfully and giving error for invalid records without going for custom SOAP service? – Jaya Dec 22 '16 at 8:31
  • I am still wondering why the whole payload(request) is treated as invalid here, I was expecting that valid records will be created in salesforce successfully and will give the error to invalid records but instead because of a single invalid record, the whole list of records are getting rejected. Is there no solution/work around for this to allow valid records to be created in salesforce? – Jaya Dec 23 '16 at 6:34
  • You'll need to implement exception handling in your code to see if you can catch the exceptions and try to recover from them. See the examples in the SOAP API Developer Guide. Also read up on Core Data Types Used in API Calls and API Fault Elements. – crmprogdev Dec 23 '16 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.