I have one command in my application in which the result and fault
handlers are not called. All other work fine. The webservice that
is tied to it gets executed and data is returned, as I can see it in
the flex log file. Does anyone know what might cause this???
Command File:
package com.bmc.rem.command.learning
{
import com.adobe.cairngorm.business.Responder;
import com.adobe.cairngorm.commands.Command;
import com.adobe.cairngorm.control.CairngormEvent;
import com.bmc.rem.common.eventBroadcaster.REMEventBroadcaster;
import com.bmc.rem.controller.REMControl;
import com.bmc.rem.delegate.probe.ProbeServicesDelegate;
import com.bmc.rem.vo.learning.*;
import mx.utils.ObjectUtil;
import mx.collections.ArrayCollection;
public class GetLearningResultsCommand implements Command, Responder
{
public function execute( event:CairngormEvent ) : void
{
trace("******* executing get learning results *******");
var delegate: ProbeServicesDelegate = new
ProbeServicesDelegate( this );
delegate.getLearningResults(event.data);
trace("****** after delegate.getLearningResults *****");
}
/**
* The onResult method is called when the server side method
completes successfully.
* @param event The event containing the information returned by
the server.
*
*/
public function onResult( event : *=null ) : void
{
trace("*******************learning data format =
**************" + ObjectUtil.toString(event.result));
REMEventBroadcaster.getInstance().dispatchEvent
(REMControl.EVENT_GET_LEARNING_RESULTS_SUCCESSFUL, null);
}
/**
* The onFault method is called when the server side method call
returns an exception.
* @param event The event containing the exception returned by the
server.
*
*/
public function onFault( event : *=null ) : void
{
trace("****** on fault learning restults");
REMEventBroadcaster.getInstance().dispatchEvent
(REMControl.EVENT_SHOW_SERVER_ERROR, event.fault.message);
REMEventBroadcaster.getInstance().dispatchEvent(
REMControl.EVENT_GET_LEARNING_RESULTS_FAILURE );
}
}
}
Delegate:
package com.bmc.rem.delegate.probe
{
import com.adobe.cairngorm.business.Responder;
import com.adobe.cairngorm.business.ServiceLocator;
import com.bmc.rem.model.ModelLocator;
import com.bmc.rem.vo.probe.LearningCriteriaVO;
import mx.rpc.AsyncToken;
import mx.rpc.soap.mxml.WebService;
public class ProbeServicesDelegate
{
/**
* The responder to the server side service calls
*/
private var responder:Responder;
private var service:Object;
private var probeServicesFacade:Object;
public function ProbeServicesDelegate( responder : Responder )
{
this.probeServicesFacade = ServiceLocator.getInstance
().getService("probeServicesFacade") as WebService;
if( !ModelLocator.getInstance().isProbeWSDLLoaded)
{
ModelLocator.getInstance().isProbeWSDLLoaded =
true;
this.probeServicesFacade.loadWSDL();
}
this.responder = responder;
}
public function startLearning
(learningSession:LearningCriteriaVO):void
{
var startLearningString:String =
"<q1:SetLearningSetting
xmlns:q0=\"http://tmremprobe.bmc.com/datamodel/common\"
xmlns:q1=\"http://tmremprobe.bmc.com/ws/ProbeService\">" +
"<q0:Learning>Active</q0:
Learning>" +
"<q0:UserId />" +
"<q0:IPRange>" +
"<q0:StartingIP>" +
learningSession.fromIpAddress +
"</q0:StartingIP>" +
"<q0:EndingIP>" +
learningSession.toIpAddress +
"</q0:EndingIP>"
+
"</q0:IPRange>" +
"<q0:URLPattern>" +
learningSession.urlPatternFilter +
"</q0:URLPattern>" +
"<q0:CapturePeriod>" +
learningSession.learningDuration +
"</q0:CapturePeriod>" +
"<q0:ResultLimit>" +
learningSession.learningCount +
"</q0:ResultLimit>" +
"</q1:SetLearningSetting>
";
trace("startLearningString = " +
startLearningString);
var startLearningXML:XML = new XML
(startLearningString);
trace("startLearningXML = " + startLearningXML);
var endpointURI:String = "http://" +
learningSession.probe.probeHost + ":" +
learningSession.probe.probeConnectionPort
+ "/axis2/services/ProbeService/SetLearningSetting";
this.probeServicesFacade.endpointURI =
endpointURI;
trace("endpointURI " + endpointURI);
var call:AsyncToken =
probeServicesFacade.SetLearningSetting(startLearningXML);
trace("after invoking webservice");
call.resultHandler = responder.onResult;
call.faultHandler = responder.onFault;
}
public function stopLearning
(learningSession:LearningCriteriaVO):void
{
var stopLearningString:String =
"<q1:SetLearningSetting
xmlns:q0=\"http://tmremprobe.bmc.com/datamodel/common\"
xmlns:q1=\"http://tmremprobe.bmc.com/ws/ProbeService\">" +
"<q0:Learning>Inactive</q
0:Learning>" +
"<q0:UserId />" +
"<q0:IPRange>" +
"<q0:StartingIP>" +
learningSession.fromIpAddress +
"</q0:StartingIP>" +
"<q0:EndingIP>" +
learningSession.toIpAddress +
"</q0:EndingIP>"
+
"</q0:IPRange>" +
"<q0:URLPattern>" +
learningSession.urlPatternFilter +
"</q0:URLPattern>" +
"<q0:CapturePeriod>" +
learningSession.learningDuration +
"</q0:CapturePeriod>" +
"<q0:ResultLimit>" +
learningSession.learningCount +
"</q0:ResultLimit>" +
"</q1:SetLearningSetting>
";
var endpointURI:String = "http://" +
learningSession.probe.probeHost + ":" +
learningSession.probe.probeConnectionPort
+ "/axis2/services/ProbeService/SetLearningSetting";
this.probeServicesFacade.endpointURI =
endpointURI;
var stopLearningXML:XML = new XML
(stopLearningString);
trace("stopLearningXML = " + stopLearningXML);
var call:AsyncToken =
probeServicesFacade.SetLearningSetting(stopLearningXML);
call.resultHandler = responder.onResult;
call.faultHandler = responder.onFault;
}
public function getLearningResults
(learningCriteria:LearningCriteriaVO):void
{
var getLearningResultsString:String
= "<q0:GetLearningResult " +
"xmlns:q0=\"http://
tmremprobe.bmc.com/ws/ProbeService\"/>";
/*"<soapenv:Envelope
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
"xmlns:q0=\"http://tmremp
robe.bmc.com/datamodel/common\"
xmlns:q1=\"http://tmremprobe.bmc.com/ws/ProbeService\" " +
"xmlns:xsd=\"http://www.w
3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-
instance\">" +
"<soapenv:Body>"
+
"<q0:GetLearningResult "
+
"xmlns:q0=\"http://tmremp
robe.bmc.com/datamodel/common\">" +
"</q0:GetLearningResult>"
+
"</soapenv:Body>" +
"</soapenv:Envelope>";*/
var endpointURI:String = "http://" +
learningCriteria.probe.probeHost + ":" +
learningCriteria.probe.probeConnectionPort
+ "/axis2/services/ProbeService/GetLearningResult";
this.probeServicesFacade.endpointURI =
endpointURI;
trace("getLearningResultsSTring = " +
getLearningResultsString);
var getLearningResultsXML:XML = new XML
(getLearningResultsString);
trace("getLearningResultsXML = " +
getLearningResultsXML);
var call:AsyncToken =
probeServicesFacade.GetLearningResult(getLearningResultsXML);
call.resultHandler = responder.onResult;
call.faultHandler = responder.onFault;
trace("after get learning results");
}
}
}