I generated code using the webservice wizard, and then wrote a simple
mxml file to test the code. I get this error:
1061: Call to a possibly undefined method getClass through a reference
with static type Class.
It occurs in the following code:
/**
* Internal event handler to process a successful operation call from
the server
* The result is decoded using the schema and operation settings and
then the
* events get passed on to the actual facade that the user employs in
the application
* @private
*/
private function processResult(result:Object,wrappedData:Object):void
{
var token:AsyncToken = wrappedData.returnToken;
var currentOperation:WSDLOperation = wrappedData.operation;
var decoder:SOAPDecoder = new SOAPDecoder();
decoder.resultFormat="object";
decoder.ignoreWhitespace = true;
decoder.makeObjectsBindable=true;
decoder.wsdlOperation = currentOperation;
decoder.schemaManager = currentOperation.schemaManager;
var body:Object = result.message.body;
var stringResult:String = String(body);
if (stringResult == null || stringResult == "")
return;
var soapResult:SOAPResult =
decoder.decodeResponse(result.message.body);
if (soapResult.isFault)
{
var faults:Array = soapResult.result as Array;
for each (var soapFault:Fault in faults)
{
var soapFaultEvent:FaultEvent =
FaultEvent.createEvent(soapFault,token,null);
token.dispatchEvent(soapFaultEvent);
}
} else {
result = decoder.decodeResponse(result.message.body).result;
if (result is ArrayCollection)
{
//shoud upcast to specific type here
var arrayTypedClass:Class =
SchemaTypeRegistry.getClass(currentOperation.outputMessage.parts[0].type\
);
result = new arrayTypedClass(result.source);
}
var event:ResultEvent = ResultEvent.createEvent(result,token,null);
token.dispatchEvent(event);
}
}
The statement where the error occurs is highlighted above. The comment
says I should upcast to a specific type here, but I don't know what that
means. Which specific type? How do I determine what type to upcast to?
Any help would be appreciated.
TIA,
Randy