我的 flex 应用程序中有支持多种操作的 WebService。我正在尝试对这些操作使用相同的 web 服务实例。但是,一旦我使用不同的操作,我就会从服务器返回失败。在网络监视器中进行检查时,我看到 SoapAction HTTP 标头从未更新为第二个操作所需的标头。根据 adobe docs,这应该是可能的,但似乎对我不起作用。我的代码如下。如果有人能指出解决方案,那将非常有帮助。
// main.mxml
public var ws:WebService;
public var op1:CallResponder = new CallResonder();
public var op2:CallResponder = new CallResonder();
// triggered on creationComplete Event
public function initWebsvc()
{
ws = new WebService();
ws.loadWsdl("http://www.examplesvc.com/test.asmx?wsdl");
}
protected function submit_ClickEventHandler(event:MouseEvent):void
{
op1.addEventListener(ResultEvent.RESULT, op1_resultHandler);
op1.token = ws.operation1();
}
protected function op1_resultHandler(event:ResultEvent):void
{
op2.addEventListener(ResultEvent.RESULT, op2_resultHandler);
op2.token = ws.operation2(); // This fails
}
protected function op2_resultHandler(event:ResultEvent):void
{
Alert.show("SUCCESS");
}