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
AljebouriAljebouri 

Handle multiple return Data Type from Webservice called from SalesForce

Hi All,

We have developed a web service to be called from SalesFroce, it returns different Data Type, how i can handle multiple data type retruned fom the web service, below webserivce imported into SF

to rephrase my question when i write a class to call the webservice what shall be the defined return type please see below example of a web service return a string

IBPortalWS_LinkMT4Account.Link_MT4AccountPort stub= new  IBPortalWS_LinkMT4Account.Link_MT4AccountPort();
String output = stub.Link_Account(String.valueof(ac.IBPortalID__c),ld.Name,ids);


so in th emulti return type web service what i shall replace the String output with? shall i replace it with ComAdssClientPortalSF.ApprovalResponse_element if so, how i can determine what was exactly returned?

//Generated by wsdl2apex

public class ComAdssClientPortalSF {
    public class ApprovalResponse_element {
        public Boolean success;
        public String errorCode;
        private String[] success_type_info = new String[]{'success','http://com/adss/clientportal/sfapi',null,'1','1','false'};
        private String[] errorCode_type_info = new String[]{'errorCode','http://com/adss/clientportal/sfapi',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://com/adss/clientportal/sfapi','true','false'};
        private String[] field_order_type_info = new String[]{'success','errorCode'};
    }
    public class ApprovalRequest_element {
        public String emailAddress;
        private String[] emailAddress_type_info = new String[]{'emailAddress','http://com/adss/clientportal/sfapi',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://com/adss/clientportal/sfapi','true','false'};
        private String[] field_order_type_info = new String[]{'emailAddress'};
    }
    public class ClientServiceSoap11 {
        public String endpoint_x = 'http://192.168.6.65:8080/client-portal-web/endpoints';
        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://com/adss/clientportal/sfapi', 'ComAdssClientPortalSF'};
        public ComAdssClientPortalSF.ApprovalResponse_element Approval(String emailAddress) {
            ComAdssClientPortalSF.ApprovalRequest_element request_x = new ComAdssClientPortalSF.ApprovalRequest_element();
            request_x.emailAddress = emailAddress;
            ComAdssClientPortalSF.ApprovalResponse_element response_x;
            Map<String, ComAdssClientPortalSF.ApprovalResponse_element> response_map_x = new Map<String, ComAdssClientPortalSF.ApprovalResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://com/adss/clientportal/sfapi',
              'ApprovalRequest',
              'http://com/adss/clientportal/sfapi',
              'ApprovalResponse',
              'ComAdssClientPortalSF.ApprovalResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x;
        }
    }
}