我的Flex应用程序中有支持多种操作的WebService。我正在尝试为这些操作使用相同的webservice实例。但是,只要我使用不同的操作,我会从服务器返回故障。在网络监视器中检查时,我看到SoapAction HTTP标头从未更新到第二个操作所需的HTTP标头。根据adobe文档,这应该是可能的,但似乎并没有为我工作。我的代码如下。如果任何人都可以指出解决方案,这将是非常有帮助的。Adobe Flex 4.6具有相同WebService对象的多个操作
// 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");
}
有趣的问题消失,如果我申报的WebService作为一个组成部分,而不是使用新的WebService创造它的()。有谁知道为什么区别? –