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
hylim1215hylim1215 

How do i call out to this web service in APEX?

Hi i have this wsdl from my webservice provided and i converted in to apex class and this is what i get.
 
//Generated by wsdl2apex

public class mttest {
    public class Rows_element {
        public String Valor;
        private String[] Valor_type_info = new String[]{'Valor','http://mtbr/test',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://mtbr/test','false','false'};
        private String[] field_order_type_info = new String[]{'Valor'};
    }
    public class DT_Test_Req {
        public String Operacao;
        public mttest.Rows_element[] Rows;
        private String[] Operacao_type_info = new String[]{'Operacao','http://mtbr/test',null,'0','1','false'};
        private String[] Rows_type_info = new String[]{'Rows','http://mtbr/test',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://mtbr/test','false','false'};
        private String[] field_order_type_info = new String[]{'Operacao','Rows'};
    }
    public class DT_Test_Resp {
        public String Resultado;
        private String[] Resultado_type_info = new String[]{'Resultado','http://mtbr/test',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://mtbr/test','false','false'};
        private String[] field_order_type_info = new String[]{'Resultado'};
    }
    public class HTTPS_Port {
        public String endpoint_x = 'http://service/service';
        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://mtbr/test', 'mttest'};
        public String SI_Test_Out_Sync(String Operacao,mttest.Rows_element[] Rows) {
            mttest.DT_Test_Req request_x = new mttest.DT_Test_Req();
            request_x.Operacao = Operacao;
            request_x.Rows = Rows;
            mttest.DT_Test_Resp response_x;
            Map<String, mttest.DT_Test_Resp> response_map_x = new Map<String, mttest.DT_Test_Resp>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://sap.com/xi/WebService/soap1.1',
              'http://mtbr/test',
              'MT_Test_Req',
              'http://mtbr/test',
              'MT_Test_Resp',
              'mttest.DT_Test_Resp'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.Resultado;
        }
        public String rettt(String vla){
            return vla;
        }
    }
}
Then i tried to calll the webservice using:-
mttest.HTTPS_Port si_test = new mttest.HTTPS_Port();
List<String> fillers = new String[]{'2','5'};
String opera = '+';
String output = si_test.SI_Test_Out_Sync(opera,fillers);
But it give me error:-
Method does not exist or incorrect signature: [mttest.HTTPS_Port].SI_Test_Out_Sync(String, List<String>)

What parameter should i input for the method
SI_Test_Out_Sync(String Operacao,mttest.Rows_element[] Rows)
?

Thanks


 
Tejpal KumawatTejpal Kumawat
Hello Friend,

You need to pass mttest.Rows_element[] Rows parameter rather than list of string in the method.

Regards
Tej Pal Kumawat
Skype : tejpalkumawat1991

If this answers your question mark Best Answer it as solution and then hit Like!
Tejpal KumawatTejpal Kumawat
Hello friend,

Try this with your parameter.
mttest.HTTPS_Port si_test = new mttest.HTTPS_Port();
List<String> fillers = new String[]{'2','5'};
String opera = '+';


list<mttest.Rows_element> Rows = new list<mttest.Rows_element>();

mttest.Rows_element m = new mttest.Rows_element();
//Assign values of m
Rows.add(m);

String output = si_test.SI_Test_Out_Sync(opera,Rows);
Regards
Tej Pal Kumawat
Skype : tejpalkumawat1991

If this answers your question mark Best Answer it as solution and then hit Like!
 
hylim1215hylim1215
Hi Tej Pal Kumawat,

How can i modify the row element? Because this webservice is like a simple calculation, you provide 2 numbers and an operator and will return the result.  This is the sample request from SoapUI

User-added image