function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Varun Sinha 17Varun Sinha 17 

Apex type not found for element

I was able to make a connection with the endpoint url.But now when I am trying to call method to create diagnostic key I am getting this error :

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

Can anyone help me with this?
Thanx
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi varun,

It's sounds like that there will be some problem with WSDL, can you please share complete log


--
Thanks,
Swayam
@salesforceguy
Varun Sinha 17Varun Sinha 17
I am not able to paste my logs here.Can you tell me your mail id so that I can send you the logs?
 
Swayam@SalesforceGuySwayam@SalesforceGuy
Yes Sure,

swayamsfdc@gmail.com

--
Thanks,
Swayam
@salesforceguy
 
Varun Sinha 17Varun Sinha 17
In soap ui I am able to get the diagnostic ID.But when I am trying to generate the ID from apex class, Its throwing me an error which I stated above.
Swayam@SalesforceGuySwayam@SalesforceGuy
I think you can check your WSDL where that class is specified or not which you supplies to external system.

--
Thanks
Swayam
@salesforceguy
Varun Sinha 17Varun Sinha 17
Actually I am not using diagnosticsessionstatus anywhere,its like when i am passing all the parameters to generate the id,I am getting diagnosticsessionstatus as a response.I have seen it in soapui.But in apex class its giving me this error.Could you just help me how to resolve this as I am not able to figure out?

I have mailed you the debug log.
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,

I got the same while working on API Call, you can try this :--

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'};
Varun Sinha 17Varun Sinha 17
I have done it like this
public class diagnosticSessionStatus {
        public DateTime creationDate;
        public String diagnosticSessionStatus;
        public String id;
        public DateTime lastUpdateDate;
        public wwwKaidaraComKaidaraservice.dsOwner owner;
        public String title;
        private String[] creationDate_type_info = new String[]{'creationDate','http://www.kaidara.com/KaidaraService',null,'0','1','false'};
        private String[] diagnosticSessionStatus_type_info = new String[]{'diagnosticSessionStatus','http://www.kaidara.com/KaidaraService',null,'1','1','false'};
        private String[] id_type_info = new String[]{'id','http://www.kaidara.com/KaidaraService',null,'0','1','false'};
        private String[] lastUpdateDate_type_info = new String[]{'lastUpdateDate','http://www.kaidara.com/KaidaraService',null,'0','1','false'};
        private String[] owner_type_info = new String[]{'owner','http://www.kaidara.com/KaidaraService',null,'0','1','false'};
        private String[] title_type_info = new String[]{'title','http://www.kaidara.com/KaidaraService',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.kaidara.com/KaidaraService','true','false'};
        private String[] field_order_type_info = new String[]{'creationDate','diagnosticSessionStatus','id','lastUpdateDate','owner','title'};
    }

But still I am getting error.
Rajkumar mahalingamRajkumar mahalingam
I am beginner of sales force intregration in ios. I did integration the salesforce sdk in xcode. I run the app salesforce sample app then i enter into my login after that getting error message like We can't authorize you because of an OAuth error. OAUTH_APPROVAL_ERROR_GENERIC : An unexcepted error has occured during authentication. Please let me know where i made the mistake.