+ Start a Discussion
ranveer singh 8ranveer singh 8 

Invalid api version:0.0

I am facing this error wile i am saving the class which implements webservicemock any help much appriciated
Ankit Gupta@ DeveloperAnkit Gupta@ Developer
Hi Ranveer,

Can you save your class with body and then add code method by method.
 
ranveer singh 8ranveer singh 8
@Ankit ,thanks for suggestion but it is not working for reference my code is attached below- 

@isTest
global class ParkServiceMock implements WebServiceMock{
               
    global void doinvoke(
         Object stub,
           Object request,
           Map<String, Object> response,
           String endpoint,
           String soapAction,
           String requestName,
           String responseNS,
           String responseName,
           String responseType) {
               
               string[] asa = new string[3];
                                asa[0]='Shiretoko National Park';
                                asa[1]='Oze National Park';
                                asa[2]='Hakusan National Park';
               
               ParkService.byCountryResponse response_x = new ParkService.byCountryResponse();
               response_x.return_x = asa;
                response.put('response_x', response_x);
            }
}
ranveer singh 8ranveer singh 8
+ing to above comments for reference of the paex class generated from wsdl is below- 

//Generated by wsdl2apex

public class ParkService{
    public class byCountryResponse {
        public String[] return_x;
        private String[] return_x_type_info = new String[]{'return','http://parks.services/',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://parks.services/','false','false'};
        private String[] field_order_type_info = new String[]{'return_x'};
    }
    public class byCountry {
        public String arg0;
        private String[] arg0_type_info = new String[]{'arg0','http://parks.services/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://parks.services/','false','false'};
        private String[] field_order_type_info = new String[]{'arg0'};
    }
    public class ParksImplPort {
        public String endpoint_x = 'https://th-apex-soap-service.herokuapp.com/service/parks';
        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://parks.services/', 'parkService'};
        public String[] byCountry(String arg0) {
            parkService.byCountry request_x = new parkService.byCountry();
            request_x.arg0 = arg0;
            parkService.byCountryResponse response_x;
            Map<String, parkService.byCountryResponse> response_map_x = new Map<String, parkService.byCountryResponse>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://parks.services/',
              'byCountry',
              'http://parks.services/',
              'byCountryResponse',
              'parkService.byCountryResponse'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.return_x;
        }
    }
}
Ankit Gupta@ DeveloperAnkit Gupta@ Developer
Hi Ranveer,

I tried in my dev environment and able to create both classes.
 
ranveer singh 8ranveer singh 8
Thanks ankit ...got it actually i did not mentioned the api version so i faced this error!!!! cheers
brunol11brunol11
 1. Copy your Class code to notepad
 2. Switch to a new workspace (if you only have the default, create another one)
 3. Switch Back to the workspece you were working on
 4. Copy your notepad saved code to the class
 5. Try to save your code again

Of course i assume you are working at developer console.
Anshul Goyal 15Anshul Goyal 15
Thanks @brunol11. It worked :)
Devesh LashkariDevesh Lashkari
Thanks @brunol11 . Worked for me as well 
Md MudassirMd Mudassir
Thanks buddy. 
Shahroz BeigShahroz Beig
Perform these steps:
  1. Select all
  2. Close the file without saving
  3. Open file again 
  4. Paste 
  5. Save
It will be saved without an error.
GANESH ALUGU 347GANESH ALUGU 347
Thanks 
@brunol11 and @Shahroz Beig

This works for me!

Perform these steps:
  1. Select all
  2. Close the file without saving
  3. Open file again 
  4. Paste 
  5. Save
It will be saved without an error.