• rajasekhar tandasa
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
My error message on this challenge is; "Challenge Not yet complete... here's what's wrong: 
Could not find at least 500 Account records with the Name like 'Bulk Company'."

My steps are;
1. Import the account records and save in csv format
2. Logged into workbench and linked to my dev org
3. In REST explorer I uploaded the job
     HTTP method POST
    URI textbox:  /services/data/v41.0/jobs/ingest  (also tried API version 42)
    Request header text;
Content-Type: application/json; charset=UTF-8
Accept: application/json
    Request body text; 
{
"operation" : "insert",
"object" : "Account",
"contentType" : "CSV",
"lineEnding" : "CRLF"
}
4. Execute
5. Note the job ID
6. Add the data to the job;
 HTTP method PUT
    URI textbox:  /services/data/v41.0/jobs/ingest/7500O00000Bo5AUQAZ/batches
    Request header text;
Content-Type: text/csv
Accept: application/json
    Request body text; 
"Name" "Sample Bulk API Account 1"
"Sample Bulk API Account 2"
"Sample Bulk API Account 3"
"Sample Bulk API Account 4"
    etc until 500
7. Execute
8. Close the job
 HTTP method PATCH
    URI textbox:  /services/data/v41.0/jobs/ingest/7500O00000Bo5AUQAZ
    Request header text;
Content-Type: application/json; charset=UTF-8
Accept: application/json
Body text;
{
"state" : "UploadComplete"
}
9. Execute

Check the challenge
 



 
Please help me resolve this challenge:

https://trailhead.salesforce.com/modules/apex_integration_services/units/apex_integration_soap_callouts

The Challenge is as follows:

Generate an Apex class using WSDL2Apex and write a test class.
Generate an Apex class using WSDL2Apex for a SOAP web service, write unit tests that achieve 100% code coverage for the class using a mock response, and run your Apex tests.

Use WSDL2Apex to generate a class called 'ParkService' in public scope using this WSDL file. After you click the 'Parse WSDL' button don't forget to change the name of the Apex Class Name from 'parksServices' to 'ParkService'.
Create a class called 'ParkLocator' that has a 'country' method that uses the 'ParkService' class and returns an array of available park names for a particular country passed to the web service. Possible country names that can be passed to the web service include Germany, India, Japan and United States.
Create a test class named ParkLocatorTest that uses a mock class called ParkServiceMock to mock the callout response.
The unit tests must cover all lines of code included in the ParkLocator class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.

The error I receive when checking the challencge is:

Challenge Not yet complete... here's what's wrong:
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.

Here is the code I am using:
public class ParkLocator {
    public static String[] country(String ctry) {
        ParkService.ParksImplPort prk = 
            new ParkService.ParksImplPort();
        return prk.byCountry(ctry);
    }
}

and
 
@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();
            
        List<String> myStrings = new List<String> {'Park1','Park2','Park3'};
    
        response_x.return_x = myStrings;
        // end
        response.put('response_x', response_x); 
   }
}

and
 
@isTest
private class ParkLocatorTest  {
    @isTest static void testCallout() {              
        // This causes a fake response to be generated
        Test.setMock(WebServiceMock.class, new ParkServiceMock());
        // Call the method that invokes a callout
        List<String> result = new List<String>();
        List<String> expectedvalue = new List<String>{'Park1','Park2','Park3'};
        
        result = ParkLocator.country('India');
        // Verify that a fake result is returned
        System.assertEquals(expectedvalue, result); 
    }
}

Any help which can be provided is greatly appreciated.  If you could advise me at raadams173@gmail.com if you reply with a solution, I can log in to check it.

Thanks.

Ryan