Apex SOAP Callouts

[APIのまとめに戻る](https://qiita.com/Keiji_otsubo/items/f44e752b618c8524885b)

+ [Executing the 'country' method on 'ParkLocator' failed. Make sure the method exists with the name 'country', is public and static, accepts a String, and returns an array of Strings from the web service.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000JfWhe)

:::note
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 クラスを作成する際の指示に従うことをお勧めします。私も同じものを使用し、チャレンジに合格したため、あなたのコードは正しいです
:::

+ [Executing the 'country' method on 'ParkLocator' failed. Make sure the method exists with the name 'country', is public and static, accepts a String, and returns an array of Strings from the web service.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000PkDZd)

**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);
   }
}
```

+ [コード有](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000PlK6p)

# トレイルヘッド

+ [Platform API Basics](https://qiita.com/Keiji_otsubo/items/4cf6a7396ba545efc4be)

# エラー

+ [xecuting the 'country' method on 'ParkLocator' failed. Make sure the method exists with the name 'country', is public and static, accepts a String, and returns an array of Strings from the web service.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007UsPis)

:::note
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
:::

+ [Generate Enterprise WSDL' it's showing error.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007Ut9Iy)

:::note
Please check this article. 

https://issues.salesforce.com/issue/a028c00000gAwYrAAK/timeout-error-while-generating-enterprise-wsdl-in-chrome
:::

# Executing the 'country' method on 'ParkLocator' failed. Make sure the method exists with the name 'country', is public and static, accepts a String, and returns an array of Strings from the web service.

+ [Executing the 'country' method on 'ParkLocator' failed. Make sure the method exists with the name 'country', is public and static, accepts a String, and returns an array of Strings from the web service.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000JfWheSAF)


:::note
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
:::

# Falló la ejecución del método 'country' en 'ParkLocator'. Asegúrese de que el método exista con el nombre 'country', sea public y static, acepte un String y devuelva una matriz de Strings desde el servicio web. 

+ [No puedo pasar este reto](https://trailhead.salesforce.com/trailblazer-community/feed/0D5KX00000TkMpX)

:::note
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
:::