+ Start a Discussion
GoForceGoGoForceGo 

web Service call out: unable to parse callout response.

I get the following message:

 

 

System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element dfRunId. 

 

The callout response is:

 

 

<?xml version="1.0" ?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <ns:uploadDataFlowResponse xmlns:ns="http://jobs.ws.test.com/types"> <dfRunId xmlns="">1613</dfRunId> <confName xmlns=""> ContractCommitmentRecordFromXml </confName> <dfRunName xmlns=""> ContractCommitmentRecordFromXml [JobWebService_Fri Aug 14 08:39:48 PDT 2009] - 2009/08/14 08:39:48 </dfRunName> <errorCount xmlns="">0</errorCount> <warningCount xmlns="">0</warningCount> <numEntriesProcessed xmlns="">0</numEntriesProcessed> <numEntriesProcessedSuccess xmlns=""> 0 </numEntriesProcessedSuccess> <numEntriesProcessedFailed xmlns=""> 0 </numEntriesProcessedFailed> <msgSummary xmlns=""> Name: ContractCommitmentRecordFromXml [JobWebService_Fri Aug 14 08:39:48 PDT 2009] - 2009/08/14 08:39:48 Error: 0 Warning: 0 </msgSummary> <startDate xmlns="">2009-08-14T15:39:48.204Z</startDate> <endDate xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"> </endDate> </ns:uploadDataFlowResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

 

 The relevent classes for the response are:

 

 

public class uploadDataFlowResponse_element { public testWebServicesClasses.wSDataFlowStatusResult result; private String[] result_type_info = new String[]{'result','http://jobs.ws.test.com/types','wSDataFlowStatusResult','1','1','false'}; private String[] apex_schema_type_info = new String[]{'http://jobs.ws.test.com/types','false','false'}; private String[] field_order_type_info = new String[]{'result'}; } public class wSDataFlowStatusResult { public Long dfRunId; public String confName; public String dfRunName; public Integer errorCount; public Integer warningCount; public Integer numEntriesProcessed; public Integer numEntriesProcessedSuccess; public Integer numEntriesProcessedFailed; public String msgSummary; public DateTime startDate; public DateTime endDate; private String[] dfRunId_type_info = new String[]{'dfRunId','','long','1','1','false'}; private String[] confName_type_info = new String[]{'confName','','string','1','1','false'}; private String[] dfRunName_type_info = new String[]{'dfRunName','','string','1','1','false'}; private String[] errorCount_type_info = new String[]{'errorCount','','integer','1','1','false'}; private String[] warningCount_type_info = new String[]{'warningCount','','integer','1','1','false'}; private String[] numEntriesProcessed_type_info = new String[]{'numEntriesProcessed','','integer','1','1','false'}; private String[] numEntriesProcessedSuccess_type_info = new String[]{'numEntriesProcessedSuccess','','integer','1','1','false'}; private String[] numEntriesProcessedFailed_type_info = new String[]{'numEntriesProcessedFailed','','integer','1','1','false'}; private String[] msgSummary_type_info = new String[]{'msgSummary','','string','1','1','false'}; private String[] startDate_type_info = new String[]{'startDate','','dateTime','1','1','true'}; private String[] endDate_type_info = new String[]{'endDate','http://www.w3.org/2001/XMLSchema','dateTime','1','1','true'}; private String[] apex_schema_type_info = new String[]{'http://jobs.ws.test.com/types','false','false'}; private String[] field_order_type_info = new String[]{'dfRunId','confName','dfRunName','errorCount','warningCount','numEntriesProcessed','numEntriesProcessedSuccess','numEntriesProcessedFailed','msgSummary','startDate','endDate'}; }

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
MarkitoMarkito

I'm very new to the Force.com, so I have spent about two days trying to figure it out until I actually did!

 

For ppl out there trying to fix the error : "System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element (name_of_xml_element for this example it is CustomerData)" try following.

 

 

  • You must have the public class defined for that element.(public class CustomerData).
  • You must call it from the *result class:

 

                 public class GetCustomerDataByAuthorSResult {

                 public clsCustomerService.CustomerData CustomerData;

  • Finally, when trying to execute Anonymous code, check if there is this in the CALLOUT_RESPONSE 
               <CustomerData xmlns="">
          (As far as I understood, this means that the element is not qualified and has to be defined as such -
  • SOLUTION: Change red marked true to false!
(Complete class of undefined element):
           public class GetCustomerDataByAuthorSResult {
                   public clsCustomerService.CustomerData CustomerData;
                    private String[] CustomerData_type_info = new String[]{'CustomerData',
                                                              'some external service'
                                                             'CustomerData',
                                                              '1','1','false'};
           private String[] apex_schema_type_info = new String[]{'some external service'
                                                               'true','false'};
            private String[] field_order_type_info = new String[]{'CustomerData'};

 

All Answers

Divya GoelDivya Goel

Hi,

 

If you get any solution. Please let me know.

 

Thanks,

GoForceGoGoForceGo

I did solve it but can't remember how.

 

I think it had something to do the name space.

 

 

MarkitoMarkito

I'm very new to the Force.com, so I have spent about two days trying to figure it out until I actually did!

 

For ppl out there trying to fix the error : "System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element (name_of_xml_element for this example it is CustomerData)" try following.

 

 

  • You must have the public class defined for that element.(public class CustomerData).
  • You must call it from the *result class:

 

                 public class GetCustomerDataByAuthorSResult {

                 public clsCustomerService.CustomerData CustomerData;

  • Finally, when trying to execute Anonymous code, check if there is this in the CALLOUT_RESPONSE 
               <CustomerData xmlns="">
          (As far as I understood, this means that the element is not qualified and has to be defined as such -
  • SOLUTION: Change red marked true to false!
(Complete class of undefined element):
           public class GetCustomerDataByAuthorSResult {
                   public clsCustomerService.CustomerData CustomerData;
                    private String[] CustomerData_type_info = new String[]{'CustomerData',
                                                              'some external service'
                                                             'CustomerData',
                                                              '1','1','false'};
           private String[] apex_schema_type_info = new String[]{'some external service'
                                                               'true','false'};
            private String[] field_order_type_info = new String[]{'CustomerData'};

 

This was selected as the best answer
GerhardNewman2GerhardNewman2

Thank you very much for posting your solution.  I doubt I would have worked that out by myself.  Well done!