function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Daniel BallingerDaniel Ballinger 

WSDL-Based Asynchronous Callouts using Continuations can't be unit tested.

The example test case in Making an Asynchronous Callout from an Imported WSDL (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_continuation_callout_soap.htm) doesn't work in practice.

Attempting to run tests using the pattern defined under Testing WSDL-Based Asynchronous Callouts gives the error:

<span unselectable="on" "="" style="display: block; padding: 3px 4px; overflow: hidden; margin-left: 0px; color: rgb(34, 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; white-space: nowrap; background-color: rgb(218, 240, 249);">
Methods defined as TestMethod do not support Web service callouts, test skipped

Attempting to use Test.setMock(WebServiceMock.class, xyz); doesn't work as the respose Map<String, Object> parameter is null. Without populating the mock response you get a GACK:
 
Internal Salesforce Error: 104340792-768952 (-1841369010) (-1841369010)

There is a complete example using a basic WSDL in Asynchronous Callout from an Imported WSDL (http://salesforce.stackexchange.com/q/70259/102)
Best Answer chosen by Daniel Ballinger
ShashankShashank (Salesforce Developers) 
This has now been identified as a known issue and can be tracked here: https://success.salesforce.com/issues_view?id=a1p30000000sXyr 

All Answers

ShashankShashank (Salesforce Developers) 
Hi Daniel,

Could you please let me know if you are facing this issue on a Summer '15 org or a Spring '15 org?
Daniel BallingerDaniel Ballinger

Hi Shashank,

The org I used to test in on na5, which is currently on Spring 15. After this weekend it will be on Summer 15, so I can test it again then if required.

Thanks,
Daniel

ShashankShashank (Salesforce Developers) 
Yes, please test it after the summer 15 upgrade and let me know if you are still facing the issue.
Daniel BallingerDaniel Ballinger

Hi Shashank,

My developer edition org is now on Summer 15. I've confirmed that the problem with testing continuations using web services still exists when running the tests using v34.0 of the API. The getRequests() (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_System_Continuation.htm#apex_System_Continuation_getRequests) method returns an empty map rather than the expected request.

Attempting to use a WebServiceMock doesn't work as the response parameter is null with doInvoke is called.

Note that I didn't completely rebuild the affected Apex classes against v34.0. I could update the version metadata. However, that still would leave the problem with older Apex classes.

Thanks,
Daniel

ShashankShashank (Salesforce Developers) 
Hi Daniel,

Could you please email me at ssrivatsavaya@salesforce.com with the login access and detailed replication steps so that I can investigate on this?

Thanks,
Shashank
Enrico Maria BalattiEnrico Maria Balatti
HI Daniel and Shashank,

any news about this issue.
Also we have problem unit testing Continuation class that make a SOAP request (wsdl).
Do you have any positive feedback/fix/workaround?

BR
Enrico
Daniel BallingerDaniel Ballinger

Enrico, I supplied the details to Shashank via email as requested on the 23rd of June. Haven't heard any more about it. I've given him a nudge on twitter just in case the email got lost. 

Failing that, I'll see if I can raise a support case for it directly in a day or so.

Gulshan Middha 1 6Gulshan Middha 1 6
Facing the same issue, any one with a solution yet?
 
ShashankShashank (Salesforce Developers) 
This has now been identified as a known issue and can be tracked here: https://success.salesforce.com/issues_view?id=a1p30000000sXyr 
This was selected as the best answer