ronyosi
asked on
Flex HTTP Webservices: security error accessing URL
Hi!
I am having an issue accessing a webservice through flex. The webservice is working, I know that, but Flex is unable to access it.
Any help appreciated!
Ron
I am having an issue accessing a webservice through flex. The webservice is working, I know that, but Flex is unable to access it.
Any help appreciated!
Ron
fault event[FaultEvent fault=[RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL
Can be many reasons, cross domain acess or invalid destination URL.
Are you connecting to localhost or remote host server?
Are you connecting to localhost or remote host server?
ASKER
I would like to connect to a remote host server.
I have been reduced to testing server and client on localhost and event that does not work :(
I have been reduced to testing server and client on localhost and event that does not work :(
ASKER
Also I tryied to put a crossdomain in the contextroot
( putting it in /ServerContextRoot/crossdo main.xml)
That does not work either...
( putting it in /ServerContextRoot/crossdo
That does not work either...
<?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="*"/>
</cross-domain-policy>
May be you can attach example of your HTTPServeice implementation and services.xml file
Can you loading crossdomain.xml file from Browser URL
host:port/scrosdomain.xml
Example:
http://localhost/crossdomain.xml
host:port/scrosdomain.xml
Example:
http://localhost/crossdomain.xml
ASKER
Below is services-config.xml, the webservices work when tested with soapUI
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<default-channels>
<channel ref="my-amf" />
</default-channels>
</services>
<channels>
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint" />
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
</channels>
<logging>
<target class="flex.messaging.log.ConsoleTarget" level="info">
<properties>
<prefix>[BlazeDS]</prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>true</includeLevel>
<includeCategory>false</includeCategory>
</properties>
<filters>
<pattern>Endpoint.*</pattern>
<pattern>Service.*</pattern>
<pattern>Configuration</pattern>
</filters>
</target>
</logging>
</services-config>
Lets test your services using AS
1) Check your WSDL URL and replace in loadWSDL
2) Set your WSDL function name/method name
3) Optional if you have to pass arguments set in args variable
Run and give me feedback
1) Check your WSDL URL and replace in loadWSDL
2) Set your WSDL function name/method name
3) Optional if you have to pass arguments set in args variable
Run and give me feedback
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.soap.mxml.Operation;
import mx.rpc.soap.mxml.WebService;
public function test():void {
var methodName:String = null; //"GetInfo";
var args:* = null; //"userId";
var webService:WebService = new WebService();
webService.loadWSDL("http://domain.com/MyService?wsdl");
webService.useProxy = false;
webService.requestTimeout = 120;
webService.showBusyCursor = true;
var operation:Operation = webService[methodName];
operation.addEventListener(ResultEvent.RESULT, function(event:ResultEvent):void{
trace(event.result);
});
operation.addEventListener(FaultEvent.FAULT, function(event:FaultEvent):void{
trace(event.fault.faultCode + ", " + event.fault.faultString + ", " + event.fault.faultDetail);
});
if(args is Array){
operation.send(args);
}else{
operation.arguments = args;
operation.send();
}
}
ASKER
This works on the original dev computer but on the computer I'm moving the code to it fails and that is the issue.
I was not able to get feedback for the fail though like I do not know how to use trace in flashDevelop...
I was not able to get feedback for the fail though like I do not know how to use trace in flashDevelop...
ASKER
faultCode="Channel.Securit y.Error"
Have you seen this? http://talsma.tv/post.cfm/flash-9-0-124-and-webservice-over-https-channel-security-error
The gist of it is that you might avoid the error with a line in the crossdomain.xml like:
<allow-http-request-header s-from domain="*" headers="SOAPAction"/>
The gist of it is that you might avoid the error with a line in the crossdomain.xml like:
<allow-http-request-header
ASKER
Ok I will check those out :)
Question that occured to me, where do I put the crossdomain.xml?
Originally I thought that it should be in http://localhost:7001/ContextRoot/crossdomain.xml
but maybe its supposed to be in http://localhost:7001/crossdomain.xml ??
am I supposed to put it in the webapp context root or the "/" context root?
Ron
Question that occured to me, where do I put the crossdomain.xml?
Originally I thought that it should be in http://localhost:7001/ContextRoot/crossdomain.xml
but maybe its supposed to be in http://localhost:7001/crossdomain.xml ??
am I supposed to put it in the webapp context root or the "/" context root?
Ron
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You may also can find answer from this forum
flash-9-0-124-and-webservi ce-over-ht tps-channe l-security -error
flash-9-0-124-and-webservi
ASKER
so you are saying that the crossdomain.xml should be added so that
http://localhost:7001/crossdomain.xml accesses it?
http://localhost:7001/crossdomain.xml accesses it?
Run Flex in debug mode for validating if you can access to crossdomain.xml you should see traces in Console window
ASKER
yes, but where should the file go in the server side? Should it go in the
1) http://localhost:7001/crossdomain.xml
or
2) http://localhost:7001/ContextRootOfDeployment/crossdomain.xml
Please say 1 or 2.
All I need is a number :)
Sorry but I have searched around for so long and this is an issue that many are facing it seems. Hopefully this can solve it.
1) http://localhost:7001/crossdomain.xml
or
2) http://localhost:7001/ContextRootOfDeployment/crossdomain.xml
Please say 1 or 2.
All I need is a number :)
Sorry but I have searched around for so long and this is an issue that many are facing it seems. Hopefully this can solve it.
if you are using WebServices you can login to remote host as well, just change URI in your WSDL
ASKER
ok so the crossdomain that I used and the one that you suggested both do not work.
This is the case when the crossdomain is in the actual server root we well as the deployment's context root... it is almost as if the flex client does not "see" the crossdomain.xml!!
Where is it looking for it? or maybe it finds it but the crossdomain.xml is incorrect?
This is the case when the crossdomain is in the actual server root we well as the deployment's context root... it is almost as if the flex client does not "see" the crossdomain.xml!!
Where is it looking for it? or maybe it finds it but the crossdomain.xml is incorrect?
ASKER
like even this crossdomain.xml does not do anything
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" />
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
Please can you copy & paste first 10-15 lines from Console window when you run Flex in the Debug mode.
Try this crossdomain.xml as well
<?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="*" secure="false" />
<allow-http-request-header s-from domain="*" headers="Authorization,X-H TTP-Method -Override, SOAPAction " secure="false"/>
</cross-domain-policy>
Try this crossdomain.xml as well
<?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="*" secure="false" />
<allow-http-request-header
</cross-domain-policy>
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Hi ronyosi,
Please ,can you review my answers and accept the best what working for you.
I will get expert points for my time.
Please ,can you review my answers and accept the best what working for you.
I will get expert points for my time.
ASKER
fault event[FaultEvent fault=[RPC Fault faultString="Security error accessing url" faultCode="Channel.Securit