Imported a WSDL in flex 3 beta 2. I would like to use the
same "session" for several sequential calls into a web service.
Is the clientID the property to pass to the subsequent call?
When I assign a variable to what I believe is the clientID I
get "DirectHTTPChannel0". I was expecting something like a GUID.
Any ideas on the correct action script code would be appreciated.
The following is the function that processes the result (sorry about
the formatting):
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 msgstr:WSDLMessage = currentOperation.outputMessage;
var body:Object = result.message.body;
var stringResult:String = String(body);
var msgId:String = result.message.clientId;
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);
}
//added by GF 1-11-08 to ensure data is
returned. Test showed
//that result was null but body and
stringResult had data.
if (result == null || result == "")
{
result = body;
}
var event:ResultEvent =
ResultEvent.createEvent(result,token,null)
token.dispatchEvent(event);
}
}