Ok, so when you created the class from WSDL did you change the class name from parks services to ParkService? I would advise you to create a new Playground and this time follow the instruction during Apex class creation using WSDL file. your code is correct because I used the same one and I passed the challange
https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000ChaoaSAB
では、WSDL からクラスを作成したときに、クラス名を park services から ParkService に変更しましたか?新しいプレイグラウンドを作成し、今回は WSDL ファイルを使用して Apex クラスを作成する際の指示に従うことをお勧めします。私も同じものを使用し、チャレンジに合格したため、あなたのコードは正しいです
ParkService:
//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;
}
}
}
ParkServiceMock
@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) {
// start - specify the response you want to send
parkService.byCountryResponse response_x =
new parkService.byCountryResponse();
response_x.return_x = new List<String>{'Glacier National Park','Grand Canyon','Yellowstone'};
// end
response.put('response_x', response_x);
}
}
トレイルヘッド
エラー
Ok, so when you created the class from WSDL did you change the class name from parks services to ParkService? I would advise you to create a new Playground and this time follow the instruction during Apex class creation using WSDL file. your code is correct because I used the same one and I passed the challange
https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000ChaoaSAB