...

generated webservices give null result in Flex 3

Stooshie
10-28-2009, 05:47 PM
Hi there,

I have a web service on my localhost. Calling this from a PHP page works fine and it returns the expected results. (I pass 2 values and it returns a different string depending on the values passed).

However, in Flex 3, I have generated the webservice proxy classes using the "Data" | "Manage Web Services" dialog.

I am consuming these services using the following code:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Button click="clickHandler(event)"/>
<mx:Script>
<![CDATA[
import generated.webservices.*;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;

public var _ws:SalesService = new SalesService();

private function clickHandler(_e:MouseEvent):void
{
_ws.addonsaleEventListener(resultHandler);
_ws.addSalesServiceFaultEventListener(faultHandler);
_ws.onsale(10,90);
}

public function resultHandler(_e:OnsaleResultEvent):void
{
if(_e.result == null)
{
Alert.show("result is: null");
}
else
{
Alert.show("result is: "+_e.result);
}
}

public function faultHandler(_e:FaultEvent):void
{
Alert.show(_e.message.toString());
}
]]>
</mx:Script>
</mx:Application>


The "resultHandler" method is called and the "faultHandler" method is not called, which suggests a result is returned, but _e.result is null in the "resultHandler" method.

Can anyone see if I am missing something in the actionscript?

Andrew.

p.s.
I can post the generated proxy classes, or even the wsdl for the webservice if it helps.
A.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum