[flexcoders] Re: WebService using a bindable hostname

2008-12-04 Thread fishburn_david
I managed to get this working finally.

I couldn't manage to change it with any of the options I listed.

But what did work was using the FlexBuilder 3 interface and importing
the WebService.  Then using the code it called.

Fairly significant work around, but it did work.






[flexcoders] WebService using a bindable hostname

2008-12-01 Thread fishburn_david
I have the following code:

[Bindable]
private var myServerHostPort:String = af arf;

!--wsdl={myServerHostPort}/channel.asmx?wsdl--
!--wsdl=http://localhost/mmo/channel.asmx?wsdl--
!--wsdl=@ContextRoot()/mmo/channel.asmx?wsdl--
 
  
mx:WebService 
id=channelList
concurrency=single
rootURL={afariaServerHostPort}
wsdl={myServerHostPort}/mmo/channel.asmx?wsdl
fault=faultHandler(event)
makeObjectsBindable=true
mx:operation 
name=GetChannelList 
makeObjectsBindable=true
concurrency=single
result=resultChannelListHandler(event)
mx:request xmlns=

transmitterAddress{wsTransmitterAddress}/transmitterAddress
channelFolder{wsChannelFolder}/channelFolder
/mx:request
/mx:operation
/mx:WebService

My application is defined as:
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
layout=absolute
creationComplete=initializeApplication()
width=1100 height=800



In the debugger, I can see the initialApplication() function being called.

private function initializeApplication():void
{
trace('initializeApplication: myServerHostPort:'+myServerHostPort);
myServerHostPort = NetworkUtil.getServerURL();

trace('initializeApplication: myServerHostPort:'+myServerHostPort);
 
  
} 


In the debugger, I see the myServerHostPort = 'af arf', then it is
changed to something correct: http://localhost

After I hit F8, I get this fault reported:

faultDetail=Unable to load WSDL. If currently online, please verify
the URI and/or format of the WSDL (af arf/mmo/afaria/channel.asmx?wsdl)

You see here it is still using the original value instead of the one
set in the initializeApplication() function.


So 2 questions:

1.  Why is it even calling this WebService automatically?  I only want
to call it when I call it.  For some reason it is being called
during the initialization process and I don't want it to.

2.  Why is it using this old value?  If it is a [Bindable] variable it
should be using that.

3.  If someone can't offer a way to fix this, can you suggest
alternatives.

I have tried making the WebService calls via ActionScript myself to
bypass the issue, but the loadWSDL() never seems to complete and there
are no errors thrown.


public function initWebService():void 
{
CursorManager.setBusyCursor();
 

WS = new mx.rpc.soap.WebService();
 

//location of the Web Service Description
WS.wsdl = myServerHostPort+/channel.asmx?wsdl;
WS.endpointURI = myServerHostPort+/channel.asmx;
 

//GetChannelList is the WebService method we want to use
//and we want the results returned in the e4x XML format
 

WS.useProxy=false;
WS.requestTimeout=2;
 

WS.destination = GetChannelList;
//specify the function that will handle the results
//returned by the operation
WS.GetChannelList.addEventListener(result, resultChannelListHandler);
 

//specify the method that will handle any faults
WS.GetChannelList.addEventListener(fault, faultHandler);
 

//specify the method that will handle the
//the event of loading the WSDL
//once the WSDL is loaded we will call
//our method in the function loadHandler
WS.addEventListener(load, loadChannelListHandler);
 

//Load the WSDL for this WebService
WS.loadWSDL();
 

}//end function useWebService  
 

private function loadChannelListHandler(e:LoadEvent):void 
{
CursorManager.removeBusyCursor();
wsdlLoaded = true;
ta.text = wsdl loaded + \n\n;
}



Thanks for any feedback.

Dave




[flexcoders] Re: When is a crossdomain.xml file required?

2008-11-26 Thread fishburn_david
--- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote:

 I am still in the sameDomain, bold words.  Post the url to the Flex
 app and to the HTTPService you are calling, and let's see.

I set this variable when the application starts:

provisioningServerHostPort =
HTTPUtil.getProtocol()+//+HTTPUtil.getHostName()+(HTTPUtil.getPort()==''?'':(:+HTTPUtil.getPort()))+/mmo;

This uses the ExternalInterface like this:

/**
 * Returns the current host name. 
 * example: http://www.flexpasta.com/?x=1y=2 would return
www.flexpasta.com
 */ 
public static function getHostName():String
{
return 
ExternalInterface.call(window.location.hostname.toString);
}

/**
 * Returns the current protocol, such as http:, https:, etc
 * 
 */
public static function getProtocol():String
{
return 
ExternalInterface.call(window.location.protocol.toString);
} 


So the HTTPService calls use the above variable:

mx:HTTPService 
id=ajaxData
url={provisioningServerHostPort}/ws_data
resultFormat=e4x
useProxy=false
result=resultHandler(event);
/


The URL I launch the application is of this form:
http://fishburn-d830/mmo/MMO.html

So the provisioningServerHostPort is:
http://fishburn-d830/mmo/ws_data


So it should be hitting the same web server (Apache).
Once inside Apache, I have a reverse proxy defined like this:

Location /mmo/ws_data
ProxyPasshttp://fishburn-d830:8585/mmo/ws_data
ProxyPassReverse http://fishburn-d830:8585/mmo/ws_data
/Location


So, the request is actually processed by a different web server, but
the originating URL is in the same domain.

Is there a problem with this?

Thanks for your response.
Dave




[flexcoders] XML attributes

2008-11-24 Thread fishburn_david

Flex 3

I am implementing drag and drop between 2 datagrids.
Both datagrids are populated using a dataprovider with an XML document.

The source XML document looks like this:
ChannelItems
CItem Type=Channel Name=Channel1/
CItem Type=Channel Name=Channel2/
/ChannelItems

In the doDragDrop event, I am doing the following:

code
var dropTarget:DataGrid = DataGrid(event.currentTarget); 

var items:Array = event.dragSource.dataForFormat(items) as Array;

if( items.length  0 ) {
var node:XML = items[0];
var myName:String = [EMAIL PROTECTED];
}
/code

In the debugger I can see that items[0] has this value:
CItem Type=Channel Name=Channel1/

I am trying to assign the attribute Name to a string variable.
var myName:String = [EMAIL PROTECTED];

I have tried about every permutation I can think of an everything give
me a:
code
TypeError: Error #1010: A term is undefined and has no properties.
at MMO/doDragDrop()[C:\flex\src\MMO.mxml:770]
at MMO/__sd_dg_service_definition_dragDrop()[C:\flex\src\MMO.mxml:1006]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at
mx.core::UIComponent/dispatchEvent()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9156]
at
mx.managers.dragClasses::DragProxy/mouseUpHandler()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:500]
/code


Both datagrids display the XML correctly.
The source datagrid's dataProvider is defined as:
code
dataProvider={channelListXML.CItem}
/code

Can anyone give me a leg up here?

TIA,
Dave






[flexcoders] When is a crossdomain.xml file required?

2008-11-24 Thread fishburn_david

When I run my application using the flash player, everything is good.

All my HTTPService requests go through the Apache server (running
locally) and I have a reverse proxy which pushes them through to a
different server (also local) which servers up the results.

If I use my web browser (FF or IE) instead of the flashplayer, then I
get the dreaded:
[RPC Fault faultString=Security error accessing url
faultCode=Channel.Security.Error faultDetail=Destination: DefaultHTTP]
at
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:218]
at
mx.rpc::Responder/fault()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:53]
at
mx.rpc::AsyncRequest/fault()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103]
at
DirectHTTPMessageResponder/securityErrorHandler()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:368]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/redirectEvent()


The HTML file to download the swf file was changed so that the
allowScriptAccess is always instead of sameDomain.  But that was
only done to try to work around this issue.

I am still in the sameDomain, so I don't think having a crossdmain
file (especially since I have it as always currently) should work.

Any ideas?

TIA,
Dave




[flexcoders] Re: XML attributes

2008-11-24 Thread fishburn_david
I was finally able to do this with the following code I hope it helps
someone else later):

for each (var channel:XML in items)
{
var myString:String = [EMAIL PROTECTED];
}

Not sure why I had to use a for each loop to do this.
Semantically I thought this would have been equivalent:
var myString:String = [EMAIL PROTECTED];

Dave