• Richard Vanhook
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I'm trying to call an external web service from Apex.

The web service call returns an array of objects. So the generated Apex definition for the call is something like:

public class testWsdl {

    public class CalculationPort {

        public testWsdl.ComputedType[] calculate(DateTime start,DateTime end_x,DateTime now)
        ...

When I invoke it, I use the following code (declarations omitted for clarity):

  testWsdl.CalculationPort stub = new testWsdl.CalculationPort();
  testWsdl.ComputedType[] results = stub.calculate( start, end_x, now);

I get the following error on the second line:
  Non-void method might not return a value

I have no idea what this means. I've also tried the following code:
  testWsdl.ComputedType[] results = testWsdl.ComputedType[0];
  results = stub.calculate( start, end_x, now);

And I get exactly the same error.

I think I understand what the error means, that the variable results may be null after the call has completed.

My question is, how do I get rid of the error?