The clientId value identifies a Producer or Consumer instance on the client 
that is either sending or receiving messages. RPC-related components such as 
WebService use the core messaging layer under the hood. I'd recommend against 
using clientId in your scenario.

Most session-based web service APIs define an initial call to initiate a 
session that returns you a session token. You'd then add that as a header to 
subsequent calls, or pass it directly in subsequent calls depending on the API.

If you need to fabricate a session token on the client and use that for a 
sequence of calls, use the following method to generate your unique token: 
http://livedocs.adobe.com/flex/2/langref/mx/utils/UIDUtil.html#createUID()

Hope that helps,
Seth
________________________________________
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
gregariousgregmi
Sent: Wednesday, January 23, 2008 7:21 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Use message.clientID to access same session?

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);
}
}
 

Reply via email to