I have consumed a wsdl in Salesforce.Below is the class which needs to be send as a request

public class MEContacts_Request {
        public Long Contact_Type_Association;
        public String Role_Description;
        public String Last_Name;
        public String SF_Ref_Contact_Id;
        public String xxx_Contact_Code;
        public Boolean Is_Primary;
        public String First_Name;
        public DateTime Contact_Date;
        public Boolean Contact;

Below is the request I tried:

wsdltoApexClass.MEContacts_Request objContact;
objContact.xxx_Contact_Code = c.MAFLS_xxx_Ext_Ref_Contact_Id__c;
objContact.contact = true;


wsdltoApexClass.MEContacts_Request objContact;
objContact.xxx_Contact_Code = c.MAFLS_xxx_Ext_Ref_Contact_Id__c;
objContact.contact = true;
objContact.Contact_Type_Association = null;
objContact.Contact_Date = null;

I am able to call this web service successfully if i set all the parameters. But as soon as I want to skip some parameters mainly Date, boolean and Long type, I get the below error in the callout

FATAL_ERROR|System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Server was unable to read request. ---> There is an error in XML document (1, 592). ---> Input string was not in a correct format. faultcode=soap:Client faultactor=

I am able to skip tags with String return type but gets an error as soon as I skip any tag whose return type is not String.

I tried assigning null values to tags I want to skip, but didn't got any success

I am able to call the web service with SOAP UI after skipping any tags. I believe this seems to a problem when WSDL is consumed. Is there any way to call the service successfully without assigning the date, long and Boolean fields?

  • can you supply the request payload that you're sending ? – Ronnie Jun 30 '18 at 15:49
  • @Ronnie - I have added the request payload – Samir Jun 30 '18 at 16:22
  • could you supply a default value on the non-string params? Boolean should never be null should be either true of false. whatever work is being done is probably trying to assign a value and cannot – Ronnie Jun 30 '18 at 16:51
  • Third party demands thats the tags should be null and can not be defaulted. Do you think the only work around would be to make those String and ask for a new wsdl? – Samir Jun 30 '18 at 16:56
  • no it is very likely that the wsdl is fine - have you tried reformatting the request - from the error - it seems the service doesn't know how to interpret it. again - could be the need for default values on certain types.. for example - converting null to boolean - will fail all the time... it seems to be looking for a false / true string to convert – Ronnie Jun 30 '18 at 17:15

Your Answer

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

Browse other questions tagged or ask your own question.