I have implemented Continuation concept with the Asynchronous WSDL class, in a controller of page. So, I facing difficulties while writing test classes for the same.

For my requirement I have generated(from WSDL file) WSDL classes(one for Synchronous and other class for Async) and I am using generated AsyncWSDL class in my implementation. My webservice method will return an instance of a class generated inside the WSDL class. And there is some code inside generated WSDL classes to parse the response.

For the synchronous webservice callout test classes, we have to use Test.setMock() and we can return the desired object as response.

For Async with Continuation, I know that we have to set the test response with Test.setContinuationResponse() and use Test.invokeContinuationMethod() to call the callback method. Here the setContinuationResponse() method signature is setContinuationResponse(String requestLabel, System.HttpResponse mockResponse), and HttpResponse.SetBody() will accept String as parameter. But I want to return an object(instance of a inner class of WSDL class) as response, which will be actually returned by WebServiceCalloutFuture.getValue() method of Future instance in Async WSDL classes. If I generate desired class instance and pass the classInstance.toString() to setBody(), then I am getting error at the WebServiceCalloutFuture.getValue() method inside Async WSDL class.

Is there any way to set the desired Class instance as response to my continuation call response? Please assist on this.

1 Answer 1


I cannot find the exact answer for my question, I have achieved what I wanted to do with a small workaround. My goal is to test the Asynchronous WSDL Callout made with Continuation. As I have explained in the question, generally my generated asynchronous WSDL class method returns an object as the callout response.

So, I have amended AsyncWSDL class getValue() method to return the object with dummy values, if running in the test context. This is working fine, and able to cover the code.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .