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
ajitvermaajitverma 

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

 

Hi All,
I am consuming a WSDL in SFDC and while invoking its operations getting System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://serviceProvider.com/star/=output. When I generate proxy class using wsdl2Apex, I can see separte inner classes generated for output.
I have given the reponse message and generate apex class below. Any help is appreciated.

 

 

//Generated by wsdl2apex

public class wk_biztalk_Star {
    public class TicketNewResponse_element {
        public wk_biztalk_Star.output_type TicketNewResult;
        private String[] TicketNewResult_type_info = new String[]{'TicketNewResult','http://serviceProvider.com/star/','output_type','0','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://serviceProvider.com/star/','true','false'};
        private String[] field_order_type_info = new String[]{'TicketNewResult'};
    }
    public class TicketNew_type {
        public String ApplicationID;
        public String UserEmailAddress;
        public String UserFirstName;
        public String UserLastName;
        public String TicketDataXML;
        private String[] ApplicationID_type_info = new String[]{'ApplicationID','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] UserEmailAddress_type_info = new String[]{'UserEmailAddress','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] UserFirstName_type_info = new String[]{'UserFirstName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] UserLastName_type_info = new String[]{'UserLastName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] TicketDataXML_type_info = new String[]{'TicketDataXML','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://serviceProvider.com/star/','true','false'};
        private String[] field_order_type_info = new String[]{'ApplicationID','UserEmailAddress','UserFirstName','UserLastName','TicketDataXML'};
    }
    public class TicketNew_element {
        public wk_biztalk_Star.input_type input;
        private String[] input_type_info = new String[]{'input','http://serviceProvider.com/star/','input_type','0','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://serviceProvider.com/star/','true','false'};
        private String[] field_order_type_info = new String[]{'input'};
    }
    public abstract class input_type {} 
    
    public class input_type_TicketNew extends input_type {
        public wk_keith_Star.TicketNew_type TicketNew;
        private String[] TicketNew_type_info = new String[]{'TicketNew','http://serviceProvider.com/star/','TicketNew_type','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://serviceProvider.com/star/','true','false'};
        private String[] field_order_type_info = new String[]{'TicketNew'};
    }
    
    public class BasicHttpBinding_ISTARSoap {
        public String endpoint_x = 'http://sfdc.wkestoreservicesdev.com/WKUS.SFDC.WCF.STAR/STARSoap.svc';
        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://schemas.microsoft.com/2003/10/Serialization/', 'wk_biztalk_Star_Serialization', 'http://serviceProvider.com/star/', 'wk_biztalk_Star'};
        public wk_biztalk_Star.output_type TicketNew(wk_biztalk_Star.input_type input) {
            wk_biztalk_Star.TicketNew_element request_x = new wk_biztalk_Star.TicketNew_element();
            wk_biztalk_Star.TicketNewResponse_element response_x;
            request_x.input = input;
            Map<String, wk_biztalk_Star.TicketNewResponse_element> response_map_x = new Map<String, wk_biztalk_Star.TicketNewResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://serviceProvider.com/star/ISTARSoap/TicketNew',
              'http://serviceProvider.com/star/',
              'TicketNew',
              'http://serviceProvider.com/star/',
              'TicketNewResponse',
              'wk_biztalk_Star.TicketNewResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.TicketNewResult;
        }
    }
    public class output_type {
        public String Output;
        private String[] Output_type_info = new String[]{'Output','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://serviceProvider.com/star/','true','false'};
        private String[] field_order_type_info = new String[]{'Output'};
    }
}

 

 

16:51:16.836|CALLOUT_RESPONSE|[602]|
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
	<TicketNewResponse xmlns="http://serviceProvider.com/star/">
		<TicketNewResult>
			<output>&lt;operation success="true" ticket_id="2050334" message=""/&gt;</output>
		</TicketNewResult>
	</TicketNewResponse>
</s:Body>
</s:Envelope>
16:51:16.837|EXCEPTION_THROWN|[602]|System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://serviceProvider.com/star/=output
16:51:16.837|METHOD_EXIT|[602]|WebServiceCallout.invoke(APEX_OBJECT, APEX_OBJECT, MAP, LIST)
16:51:16.838|METHOD_EXIT|[149]|wk_biztalk_Star.BasicHttpBinding_ISTARSoap.TicketNew(wk_biztalk_Star.input_type)
16:51:16.838|METHOD_ENTRY|[152]|System.debug(ANY)
16:51:16.838|USER_DEBUG|[152]|DEBUG|##Exception:[System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://serviceProvider.com/star/=output]
CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found

 

 

Thanks,

Ajit

 

SF User.ax1137SF User.ax1137

In the line :

 

private String[] apex_schema_type_info = new String[]{'http://serviceProvider.com/star/','true','false'}; 

 

 

 

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

 

Thanks, 

MK

Mayank_JoshiMayank_Joshi

The reason might be becoz " WSDL Schema Type is not supported for Apex callouts "  :

 

For callouts, Apex only supports the document literal wrapped WSDL style, along with primitive and built-in data types. We recommend that you validate the WSDL document and ensure that it contains supported schema types. If a type is not supported by Apex, a callout to a Web service operation may result in an error returned in the callout response , such as “Unable to parse callout response. Apex type not found for element item”.

 

You can find more info here : 

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_callouts_wsdl2apex.htm