+ Start a Discussion

SoapException in Smart Lead Application


         I have a peculiar problem when i add a lead in the smart Lead Application.When i fill in the details and call the createAPI then a  SoapException is thrown sometimes and sometimes the system works fine (the Lead record is successfully inserted) but on failure it thows the following exception


System.Web.Services.Protocols.SoapException: java.lang.NumberFormatException: For input string: "" at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at SmartLead.SalesForcelib.SforceService.create(sObject[] sObjects) in C:\Inetpub\wwwroot\SmartLead\Web References\SalesForcelib\Reference.cs:line 143 at SmartLead.Connection.InsertRecordsToSFDC(Hashtable RecordTable, String entity, String SID, String URL, String& errmsg, String& recordID) in c:\inetpub\wwwroot\smartlead\connection.cs:line 4

Exception is thrown at the following line during the create call of Partner wsdl 

SaveResult[] saveResult=binding.create(new sObject[]{newaccount});

I would appreciate if someone is able to provide a solution for the above problem

                                                                                             Thanks And Regards





Change your code to the following and look at the error result to see why the error is occurring.

    SaveResult[] saveResult=binding.create(new sObject[]{newaccount});
catch(System.Web.Services.Protocols.SoapHeaderException ex)
    //This is typical error handling for fault detection and reporting, the .Net Proxy client actually throws an
    //error rather than return the fault SOAP Message.
    System.Diagnostics.Trace.WriteLine("The server returned the following fault information:");
    System.Diagnostics.Trace.WriteLine("Fault Code: " + ((System.Xml.XmlQualifiedName)((System.Web.Services.Protocols.SoapException)ex).Code).Name);
    System.Diagnostics.Trace.WriteLine("Fault string: " + ex.Message);
    return false;