+ Start a Discussion
SubbehSubbeh 

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

Hello all,

 

I'm trying to setup a webservice callout in SF. I generated the Apex classes from the WSDL file but when I run it, I get the error:

 

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


I've been trying to figure out where the problem is but I can't seem to find it.  I tested the WSDL file in soapUI which works perfectly.

 

This is the code I run in the IDE:

 

 

    registrationweb.RegistrationSoap stub = new registrationweb.RegistrationSoap();
    stub.RegisterUserWithAutoId_test(1234, 'abcd', 'abcd', 'test', 'test');

 

This is the Apex class generated  from the WSDL file:

 

 

//Generated by wsdl2apex

public class registrationweb {

    ...

    public class RegistrationSoap {
        public String endpoint_x = 'http://website.com/PartnerRegistrationWebservice/Registration.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://website.com/PartnerRegistrationWebservice/registration', 'registrationweb'};
        
        ...
        
        public registrationweb.RegisterUserWithAutoId_testResult_element RegisterUserWithAutoId_test(Integer partnerID,String partnerGuid,String partnerPassword,String clientName,String clientPassword) {
            registrationweb.RegisterUserWithAutoId_test_element request_x = new registrationweb.RegisterUserWithAutoId_test_element();
            registrationweb.RegisterUserWithAutoId_testResponse_element response_x;
            request_x.partnerID = partnerID;
            request_x.partnerGuid = partnerGuid;
            request_x.partnerPassword = partnerPassword;
            request_x.clientName = clientName;
            request_x.clientPassword = clientPassword;
            Map<String, registrationweb.RegisterUserWithAutoId_testResponse_element> response_map_x = new Map<String, registrationweb.RegisterUserWithAutoId_testResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://website.com/PartnerRegistrationWebservice/registration/RegisterUserWithAutoId_test',
              'http://website.com/PartnerRegistrationWebservice/registration',
              'RegisterUserWithAutoId_test',
              'http://website.com/PartnerRegistrationWebservice/registration',
              'RegisterUserWithAutoId_testResponse',
              'registrationweb.RegisterUserWithAutoId_testResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.RegisterUserWithAutoId_testResult;
        }
    }
    
    ...
    
    public class RegisterUserWithAutoId_test_element {
        public Integer partnerID;
        public String partnerGuid;
        public String partnerPassword;
        public String clientName;
        public String clientPassword;
        private String[] partnerID_type_info = new String[]{'partnerID','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
        private String[] partnerGuid_type_info = new String[]{'partnerGuid','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] partnerPassword_type_info = new String[]{'partnerPassword','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] clientName_type_info = new String[]{'clientName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] clientPassword_type_info = new String[]{'clientPassword','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://website.com/PartnerRegistrationWebservice/registration','true','false'};
        private String[] field_order_type_info = new String[]{'partnerID','partnerGuid','partnerPassword','clientName','clientPassword'};
    }
    public class RegisterUserWithAutoId_testResponse_element {
        public registrationweb.RegisterUserWithAutoId_testResult_element RegisterUserWithAutoId_testResult;
        private String[] RegisterUserWithAutoId_testResult_type_info = new String[]{'RegisterUserWithAutoId_testResult','http://website.com/PartnerRegistrationWebservice/registration','RegisterUserWithAutoId_testResult_element','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://website.com/PartnerRegistrationWebservice/registration','true','false'};
        private String[] field_order_type_info = new String[]{'RegisterUserWithAutoId_testResult'};
    }
    public class RegisterUserWithAutoId_testResult_element {
        private String[] apex_schema_type_info = new String[]{'http://website.com/PartnerRegistrationWebservice/registration','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
}

 

Please help!

 

 

SubbehSubbeh

It's quite urgent that I find a solution for this.

 

Any advice is appreciated!

ChermaduraiChermadurai

Here, change "true" to "false" and it must work.

 

 

In the line :

 

private String[] apex_schema_type_info = new String[]

{'http://website.com/PartnerRegistrationWebservice/registration','true','false'};


B
y
Dinesh Sengodan
Nihon Technology Pvt Ltd...
Chennai