I've tried pretty much every sample I can find out there on the
interweb and just can't seem to get things to play nice with my web
service to allow me to get at individual nodes / elements using E4X.
If anyone can suggest something, it would be REALLY appreciated.
I've got:
-an event broadcasting to the controller (not shown) working fine.
-execute the search command (not shown) working fine.
-executing the webservice request (shown) working fine.
-receiving the webservice response (shown) working fine.
-Accessing specific nodes / attributes in the response not working!
-If I use a HTTPService to a direct XML file, e4x is ok.
[SERVICE DEFINITION MXML]
<mx:WebService id="addressWSService" wsdl="[RemovedPath]?WSDL"
makeObjectsBindable="false" showBusyCursor="true" useProxy="false">
<mx:operation name="PostalCodeLookup" resultFormat="e4x">
<mx:request>
<PostalCode>
K7M6B2
</PostalCode>
</mx:request>
</mx:operation>
</mx:WebService>
[DELEGATE DEFINITION ACTIONSCRIPT]
service = ServiceLocator.getInstance().getService("addressWSService")
as WebService;
public function LocateAddress(p_PostalCode:String):void
{
service.addEventListener(ResultEvent.RESULT, LocateAddress_onResult);
service.addEventListener(FaultEvent.FAULT, LocateAddress_onFault);
var o:AbstractOperation = service.getOperation("PostalCodeLookup");
o.arguments.PostalCode = p_PostalCode;
service.PostalCodeLookup();
}
protected function LocateAddress_onResult(event:ResultEvent):void
{
trace("AddressWSDelegate::LocateAddress_onResult");
responder.onResult(new ResultEvent(ResultEvent.RESULT, false, true,
event.result));
}
[SEARCH COMMAND ACTIONSCRIPT]
protected function searchPostalCode(p_postalcode:String):void
{
getDelegate().LocateAddress(p_postalcode);
}
protected function getDelegate():AddressWSDelegate
{
return new AddressWSDelegate(this);
}
public function onResult(event:*=null):void
{
trace("SearchCommand::onResult");
var postcodeXML:XML = new XML(event.result);
Alert.show(postcodeXML);
}
Overall the structure of this app is pretty close to Jesse Wardens
Amazon sample but that one goes to an array rather than working with
e4x which I would like to.
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/