PsychoDazey
asked on
change sandbox type
I have an app I created in Felx builder 2. I can run it on the server it resides on, but if I try to access it from any other pc in that domain it doesn't run...it just sits on the first screen. I believe this is due to the sanbox it is running in. What is the syntax for setting the sandbox type and what file do I put it in?
Hi! What exactly is happening? When you say you can't access it from other computers in that domain you mean locally? If you can provide more details and describe the scenario in a detalied way it will be easier to help you. Also if you get any error messages please post. thanks
ASKER
Hi Juliano-
If I remote into the server that the swf file sits on it runs fine. When I try to launch the file from any other PC using http://servername/folder/file.html it loads the swf file and allows me to enter a username and password but does not respond to any button clicks. It does not generate any error messages, it just sits there.
If I remote into the server that the swf file sits on it runs fine. When I try to launch the file from any other PC using http://servername/folder/file.html it loads the swf file and allows me to enter a username and password but does not respond to any button clicks. It does not generate any error messages, it just sits there.
this is very unlikely to happen because of security sandbox issues. What does this swf application do? What kind of resources it uses and from where?
ASKER
it uses a webservice to communicate with a database on a different server. The webservice files also reside on the server with the swf file.
webservices reside in same domain as the swf. Ok , now inside the flex application, what is the url you are using to access the webservice?
ASKER
aahhh...I see where you're going with this:
"http://localhost/RepeatingComponents/Service.asmx?wsdl"
"http://localhost/RepeatingComponents/Service.asmx?wsdl"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
so I put the crossdomain .xml on the server that is trying to access the swf or on the server that the swf is on?
ASKER
ok so I put the crossdomain.xml file in the c:\inetpub\wwwroot folder. Now when I try to access the file from a pc other that the pc the swf file sits on, i get this error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at app_Code::WebserviceManage r/onWSDLFa ult()
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at mx.rpc::AbstractService/di spatchEven t()
at mx.rpc::AbstractOperation/ http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc.soap::Operation/sen d()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/flash/proxy::callProperty()
at app_Code::RCLogin/Submit()
at app_GUI::Login/__txtPasswo rd_enter()
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at mx.core::UIComponent/dispa tchEvent()
at mx.controls::TextInput/key DownHandle r()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at app_Code::WebserviceManage
at flash.events::EventDispatc
at flash.events::EventDispatc
at mx.rpc::AbstractService/di
at mx.rpc::AbstractOperation/
at mx.rpc.soap::Operation/sen
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/flash/proxy::callProperty()
at app_Code::RCLogin/Submit()
at app_GUI::Login/__txtPasswo
at flash.events::EventDispatc
at flash.events::EventDispatc
at mx.core::UIComponent/dispa
at mx.controls::TextInput/key
now you have a problem inside your flex app. There must be something not being initialized inside the onWSDLFault method. This has nothing to do with the crossdomain.xml
on the onKeyDownHandler
You need to change the WSDL url to the correct URL with proper Server IP.
"http://localhost/RepeatingComponents/Service.asmx?wsdl"
something like
"http://lyourDomain.com/RepeatingComponents/Service.asmx?wsdl"
"http://localhost/RepeatingComponents/Service.asmx?wsdl"
something like
"http://lyourDomain.com/RepeatingComponents/Service.asmx?wsdl"
julianopolito:
I am sorry but I my self have doubt here how come changing the
<cross-domain-policy>
will updated the WSDL URL? with the appropriate domain?
I am sorry but I my self have doubt here how come changing the
<cross-domain-policy>
will updated the WSDL URL? with the appropriate domain?
ASKER
Ok, so as not to confuse the 2 issues, I opened a new question with the wsdl error.
Shiva-
are you saying that I have to use:
"http://Servername.Domain.com/RepeatingComponents/Service.asmx?wsdl"
Shiva-
are you saying that I have to use:
"http://Servername.Domain.com/RepeatingComponents/Service.asmx?wsdl"
Yes I feel you Flex application is unable to find the webservice only if it is able to do that then you app works and there may be any other issues, Also check my other comment in the next post if you can tell me what message you are getting in the fault we can help better :)
ASKER
posted the message i received in the other post.
I am receiving several other errors now about index "0" out of bounds...ugh.
I am receiving several other errors now about index "0" out of bounds...ugh.
hmm please update the WSDL url and try again :)
Now I'm a little confused. ;)
Shivaspk: I did not understand what you did not understand.... about the crossdomain
Psycho: Are those errors happening when accessing locally ? If not, it is very strange.... Also you should put the crossdomain on the server that holds the webservice, which I understood is the same as the swf.... but it should be on the server that has the webservice.
Shivaspk: I did not understand what you did not understand.... about the crossdomain
Psycho: Are those errors happening when accessing locally ? If not, it is very strange.... Also you should put the crossdomain on the server that holds the webservice, which I understood is the same as the swf.... but it should be on the server that has the webservice.
ASKER
hi jp - i did put it that server.
and yes, it is happening when accessing locally. I am getting close to lighting my pc on fire and finding a different career.
and yes, it is happening when accessing locally. I am getting close to lighting my pc on fire and finding a different career.
Shivaspk: I think I understood what you asked . For example, if you use the url like this
http://www.yourdomain.com/RepeatingComponents/Service.asmx?wsdl
you need to create a crossdomain.xml on that server root to indicate that other domains can use that service. So if your flex application is hosted in a domain like:
http://www.myflexapp.com/
You should create a crossdomain.xml like this:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="www.myflexapp.com" />
</cross-domain-policy>
And put it in the www.yourdomain.com root so it will be available like this:
http://www.yourdomain.com/crossdomain.xml
Is it clearer now?
http://www.yourdomain.com/RepeatingComponents/Service.asmx?wsdl
you need to create a crossdomain.xml on that server root to indicate that other domains can use that service. So if your flex application is hosted in a domain like:
http://www.myflexapp.com/
You should create a crossdomain.xml like this:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="www.myflexapp.com" />
</cross-domain-policy>
And put it in the www.yourdomain.com root so it will be available like this:
http://www.yourdomain.com/crossdomain.xml
Is it clearer now?
ahahaha.... don't do this psycho it must be something very simple we are missing.
Well, let's go back to the begining. If you switch the url back to localhost, it will function normally from localhost.
So please change that url again to http://servername/RepeatingComponents/Service.asmx?wsdl"
We need to test if the other computers can access that url. Did you test ? Can you access that URL from other computers?
Well, let's go back to the begining. If you switch the url back to localhost, it will function normally from localhost.
So please change that url again to http://servername/RepeatingComponents/Service.asmx?wsdl"
We need to test if the other computers can access that url. Did you test ? Can you access that URL from other computers?
ASKER
i think i have an error with the way i am calling the webservice...rather than creating the object each time, i keep using the same object over and over. I am wondering if sometimes it doesn't complete what its doing before it tries to execute the next call....make sense?
I'm pretty sure I have multiple issues going on here.
I'm pretty sure I have multiple issues going on here.
hmmm, you are calling the same method multiple times? or multiple methods? you can check the concurrency property of the webservice component.
I think to help further and tell you why the connection is losing we atleast need to take a look at the web service invocation part of your code :)
julianopolito: Thank you for your response :) , regarding that crossdomain.xml, I understand that this allows Flex to access resources from a different domain but I think it will never tell the web service to look in the specified domain in the crossdomain.xml ,
what I meant is if localhost fails I am sure it will never try to do any thing further, am I correct in this?
hope PsychoDazey: doesn't mind much we discussing this here but seriously your suggestions and answers are excellent and they help us understand things better :) Thanks again.
julianopolito: Thank you for your response :) , regarding that crossdomain.xml, I understand that this allows Flex to access resources from a different domain but I think it will never tell the web service to look in the specified domain in the crossdomain.xml ,
what I meant is if localhost fails I am sure it will never try to do any thing further, am I correct in this?
hope PsychoDazey: doesn't mind much we discussing this here but seriously your suggestions and answers are excellent and they help us understand things better :) Thanks again.
shivaspk: About the crossdomain.xml it is a file read by the flash player. When a user opens a application in flash player and this application tries to access any kind of data outside the application, it verifies what is the current domain, which the application is in, and then verify where are you trying to access the data from. If the player checks you are trying to access data from a different domain or sub domain, it will look for a policy file on the root of that domain. So yes, crossdomain won't make the webservice change its configuration, nor it has anything to do with it, it will just let the player know if it can allow that domain for data communications, nothing else. So localhost urls will never work correctly because they will always try to access the current user machine. I had a recent problem with an application , let me explain so you can understand that.
My application is published in www.xyz.com and it accesses some data from a php script. That script comes as an absolute path to the application, like this: http://www.xyz.com/script.php .
When users came to that page using http://www.xyz.com/ in the browser address bar, everything went ok, but users could also access the same page just using http://xyz.com/. Using that second url is considered by the player as a different domain (because it misses www it is a sub domain) and won't let the application get data from http://www.xyz.com/script.php because it is different domain. So I had to create a crossdomain.xml file in the root of the xyz domain to allow this communication. So my http://www.xyz.com/crossdomain.xml looks like this:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="xyz.com" />
</cross-domain-policy>
So if the user tres to open the application from the simpler xyz.com url it will be allowed to get the data from php.
My application is published in www.xyz.com and it accesses some data from a php script. That script comes as an absolute path to the application, like this: http://www.xyz.com/script.php .
When users came to that page using http://www.xyz.com/ in the browser address bar, everything went ok, but users could also access the same page just using http://xyz.com/. Using that second url is considered by the player as a different domain (because it misses www it is a sub domain) and won't let the application get data from http://www.xyz.com/script.php because it is different domain. So I had to create a crossdomain.xml file in the root of the xyz domain to allow this communication. So my http://www.xyz.com/crossdomain.xml looks like this:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="xyz.com" />
</cross-domain-policy>
So if the user tres to open the application from the simpler xyz.com url it will be allowed to get the data from php.
ASKER
i call the webservice once when the application launches and then just eep using it to make calls to the database...I'll post code shortly. I'm sorry, just trying to spend a few minues with my son before he goes to bed.
shiva- i have absolutely no problem with the discussion, I'm learning too!
shiva- i have absolutely no problem with the discussion, I'm learning too!
ASKER
OK, here we go. First the webservice is called like this:
public function initWebserviceManager():vo id
{
var wsdl:String = "http://localhost/RepeatingComponents/Service.asmx?wsdl"
m_rcWebservice = new WebService()
//m_rcWebservice.showBusyC ursor=true ;
m_rcWebservice.wsdl = wsdl;
m_rcWebservice.addEventLis tener(Faul tEvent.FAU LT,onWSDLF ault); // on error show it <ccla> 3/20/2008
m_rcWebservice.loadWSDL(ws dl);
m_rcWebservice.useProxy = true;
}
//private function onWSDLFault(fault:FaultEve nt):void
//{
//var alert:Alert = Alert.show(String(fault.me ssage));
//}
private function onWSDLFault(fault:FaultEve nt):void
{
// code source: http://www.binarygiant.com/blog/?p=6
/*if the fault detail is that we were unable to load the wsdl, then we know that there is a problem communiating with the server*/
if(fault.fault.faultDetail .toLowerCa se() == "unable to load wsdl"
|| fault.fault.faultString.to LowerCase( ) == "http request error"
|| fault.fault.faultCode.toLo werCase() == "server.error.request")
{
var alert:Alert = Alert.show("The application is unable to communicate with the web server, please try again. If you continue to experience this problem, " +
"please contact your system administrator");
}
}
Then when I need to make any calls to it I do it like this:
public function Load():void
{
/*var webService:WebService;
var wsdl:String = "http://localhost/RepeatingComponents/Service.asmx?wsdl"
webService = new WebService()
webService.showBusyCursor= true;
webService.wsdl = wsdl;
webService.loadWSDL(wsdl);
webService.useProxy = true;
*/
Program.m_webServiceManage r.getWebse rvice().Ge tPartNumbe rs.addEven tListener( ResultEven t.RESULT,L oadResult) ;
Program.m_webServiceManage r.getWebse rvice().Ge tPartNumbe rs("<ids>< myid>" + this.ComponentType + "</myid></ids>");
}
public function LoadResult(e:ResultEvent): void
{
this.PartNumbers = new ArrayCollection();
var dataSet:DataSet = new DataSet(String(e.result));
if(dataSet.HasErrors())
{
Alert.show(dataSet.GetErro rAt(0));
}
else
{
var dataTable:DataTable = dataSet.GetTableAt(0);
this.PartNumbers.addItem(" Select a Part Number");
}
for(var index:int=0;index<dataTabl e.RowCount ();index++ )
{
var row:DataRow = dataTable.GetRowAt(index);
this.PartNumbers.addItem (dataTable.GetRowAt(index) .GetValue( 0));
}
//GetMeasurementRangesForC omponent
Program.m_webServiceManage r.getWebse rvice().Ge tRangesFor Components .addEventL istener(Re sultEvent. RESULT,Get Ranges);
Program.m_webServiceManage r.getWebse rvice().Ge tRangesFor Components ('<ROOT><i ds><myid>' + this.ComponentType + '</myid><measurement>6</me asurement> </ids></RO OT>');
}
Like I said, I think it is tripping on itself....
public function initWebserviceManager():vo
{
var wsdl:String = "http://localhost/RepeatingComponents/Service.asmx?wsdl"
m_rcWebservice = new WebService()
//m_rcWebservice.showBusyC
m_rcWebservice.wsdl = wsdl;
m_rcWebservice.addEventLis
m_rcWebservice.loadWSDL(ws
m_rcWebservice.useProxy = true;
}
//private function onWSDLFault(fault:FaultEve
//{
//var alert:Alert = Alert.show(String(fault.me
//}
private function onWSDLFault(fault:FaultEve
{
// code source: http://www.binarygiant.com/blog/?p=6
/*if the fault detail is that we were unable to load the wsdl, then we know that there is a problem communiating with the server*/
if(fault.fault.faultDetail
|| fault.fault.faultString.to
|| fault.fault.faultCode.toLo
{
var alert:Alert = Alert.show("The application is unable to communicate with the web server, please try again. If you continue to experience this problem, " +
"please contact your system administrator");
}
}
Then when I need to make any calls to it I do it like this:
public function Load():void
{
/*var webService:WebService;
var wsdl:String = "http://localhost/RepeatingComponents/Service.asmx?wsdl"
webService = new WebService()
webService.showBusyCursor=
webService.wsdl = wsdl;
webService.loadWSDL(wsdl);
webService.useProxy = true;
*/
Program.m_webServiceManage
Program.m_webServiceManage
}
public function LoadResult(e:ResultEvent):
{
this.PartNumbers = new ArrayCollection();
var dataSet:DataSet = new DataSet(String(e.result));
if(dataSet.HasErrors())
{
Alert.show(dataSet.GetErro
}
else
{
var dataTable:DataTable = dataSet.GetTableAt(0);
this.PartNumbers.addItem("
}
for(var index:int=0;index<dataTabl
{
var row:DataRow = dataTable.GetRowAt(index);
this.PartNumbers.addItem (dataTable.GetRowAt(index)
}
//GetMeasurementRangesForC
Program.m_webServiceManage
Program.m_webServiceManage
}
Like I said, I think it is tripping on itself....
please change that url from the webservice to "http://[ server IP ]/RepeatingComponents/Serv ice.asmx?w sdl" and put this IP or server name in the crossdomain.xml too . Everything looks just fine, but remove the webService.useProxy = true; because you are not using proxies for that communication. Then try to access the app both from local computer and remote computer, both using http protocol and post what happens please. thanks
ASKER
ok, I'll try it.
I just shot you an e-mail.
I just shot you an e-mail.
ASKER
just a thought- what if this server does not have a static IP?
ASKER
I get this error now:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at app_Code::WebserviceManage r/onWSDLFa ult()
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at mx.rpc::AbstractService/di spatchEven t()
at mx.rpc::AbstractOperation/ http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc.soap::Operation/sen d()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/flash/proxy::callProperty()
at app_Code::RCLogin/Submit()
at app_GUI::Login/__txtPasswo rd_enter()
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at mx.core::UIComponent/dispa tchEvent()
at mx.controls::TextInput/key DownHandle r()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at app_Code::WebserviceManage
at flash.events::EventDispatc
at flash.events::EventDispatc
at mx.rpc::AbstractService/di
at mx.rpc::AbstractOperation/
at mx.rpc.soap::Operation/sen
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/flash/proxy::callProperty()
at app_Code::RCLogin/Submit()
at app_GUI::Login/__txtPasswo
at flash.events::EventDispatc
at flash.events::EventDispatc
at mx.core::UIComponent/dispa
at mx.controls::TextInput/key
if it does not have a static ip, use the the computer name.
This error you get is when you try to login? Is the same webservice being used to login? Can you put a breakpoint before that keyDownHandler execute so you can see exactly when the error occurs?
got your email. thanks
This error you get is when you try to login? Is the same webservice being used to login? Can you put a breakpoint before that keyDownHandler execute so you can see exactly when the error occurs?
got your email. thanks
ASKER
yes, that is the error I get while trying to log in. I am not sure what that keydown even handler is...I'll try to find it. I changedthe IP to te server name and now I get this:
[RPC Fault faultString="Security error accessing url" faultCode="Channel.Securit y.Error" faultDetail="Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL (http://localhost/RepeatingComponents/Service.asmx?wsdl)"]
at WSDLParser/dispatchFault()
at WSDLParser/http://www.adobe.com/2006/flex/mx/internal::httpFaultHandler()
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()
at mx.rpc::Responder/fault()
at mx.rpc::AsyncRequest/fault ()
at DirectHTTPMessageResponder /securityE rrorHandle r()
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at flash.net::URLLoader/redir ectEvent()
[RPC Fault faultString="Security error accessing url" faultCode="Channel.Securit
at WSDLParser/dispatchFault()
at WSDLParser/http://www.adobe.com/2006/flex/mx/internal::httpFaultHandler()
at flash.events::EventDispatc
at flash.events::EventDispatc
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()
at mx.rpc::Responder/fault()
at mx.rpc::AsyncRequest/fault
at DirectHTTPMessageResponder
at flash.events::EventDispatc
at flash.events::EventDispatc
at flash.net::URLLoader/redir
ASKER
I just ealized that tupid webservice is in another spot. I am going to try changing them both to the machine name to see if it works.
Yes this is perfect that means your webservice is not being resolved
Doesn't matter if it has static ip or not, as such you are telling you are currently running the whole thing on localhost if you still think localhost is not getting resolved you can use
"http://127.0.0.1/RepeatingComponents/Service.asmx?wsdl"
This is guaranteed to be resolved,
or use the appropriate ip address.
Doesn't matter if it has static ip or not, as such you are telling you are currently running the whole thing on localhost if you still think localhost is not getting resolved you can use
"http://127.0.0.1/RepeatingComponents/Service.asmx?wsdl"
This is guaranteed to be resolved,
or use the appropriate ip address.
if this is a security error remember changing the crossdomain.xml as needed
No its not security issue but the web service is not available at
"http://localhost/RepeatingComponents/Service.asmx?wsdl"
please try opening this link in your web browser and make sure it is running.
http://localhost/RepeatingComponents/Service.asmx?wsdl
"http://localhost/RepeatingComponents/Service.asmx?wsdl"
please try opening this link in your web browser and make sure it is running.
http://localhost/RepeatingComponents/Service.asmx?wsdl
ASKER
awarded points to JP since hehad told me to change it to server name here. I was just missing the fact that it was called out somewhere else. Thank you both for your help.