How to host a regular file (eg. *.xml) at the root of my wso2 server?

vr.certi.org.br's picture

Hello,

I have a wso2-wsas server, with hosted SOAP services running at http://[myip]:9763/services/...

Now I need to expose a regular xml file at http://[myip]:9763/myfile.xml

The file needs to be at the root because of compatibility reasons.

(details: I have a flash app which needs to consume my services, but adobe forces the condition where the file crossdomain.xml must be put at the root of the server domain, or it won´t invoke the services.)

I know that wso2 CAN serve regular files, since http://[myip]:9763/docs is all made up of html´s and such stuff, which open OK in my browser.

However, I searched through my config files and didn´t get much of a clue on how to start a new context, redirect requests for specific types or something like that.

Really sorry if that is beginners´ questions, but i´m sincerely stuck :-)

best regards!

Victor

jr97's picture

Can't you put the xml file

Can't you put the xml file on the same web server serving up the Flash content and then access it via httpService? Another option would be to create an excel or csv file of the xml data and have wsas serve it up and then invoke as a web service.
vr.certi.org.br's picture

Not yet able to serve static content at root level

Hello jr97,

thanks for reply

well, i can´t put the necessary xml file on the same webserver as flash content, because it is a flash requirement for external data access ("cross-domain" data access). whenever flash tries to load data outside the flash contents´ domain, it looks for the crossdomain.xml in the root of that desired server; this file must contain the security policy, which will allow for the data access in that particular domain.

for example:

flash content = http://site1/content.xml

data content = http://site2:9763/services/data.wsdl

flash will try to load http://site2:9763/crossdomain.xml, and if it fails, it won´t load data.wsdl.

there is a way to load it from other directories, but then it will allow access only to data beneath that directory :-( which doesn´t help me at all. Only if i could serve the static content as

http://site2:9763/services/crossdomain.xml --- that would be ok for me --- but how to do it???

it is a funny situation, but that is adobe´s approach to security.

now about the DataServices, i gave it a try; it looked like a nice idea.

I got far enough to get a XML file served, but not at the root level :-(

what I got was something like

http://site2:9763/DataService/getcrossdomainXML

which does not satisfy flash´s requirement (because of the "DataService/" part in the URL).

I noticed that {wso2-home}/docs/ directory hosts a series of regular static files, which is similar to what I need.

I can even host http://site2:9763/docs/crossdomain.xml just by dropping the file at that directory.

(it is almost what I need, except for the "docs/" part)

where is this behaviour defined???? is it inside some config file??? or is it deep inside wso2 source-code??

if i could see where this is defined, i could do something very similar, pointing requests for /crossdomain.xml to the real file in the server.

i also read something about overriding the doGet method and "hand-feeding" the desired XML, but I just don´t know how this would apply to WSO2 WSAS. :-(

well, thanks once again, hope someone can help. I hope it is such a simple issue, i am just not seeing the right spot :-)

jr97's picture

The whole cross-domain thing

The whole cross-domain thing is a major pita when dealing with Flash/Flex. Luckily, and I'm not sure why, my Flex projects using wso2 products run just fine without the cross-domain.xml and I'm serving up the content from a different box than the web services server. Maybe it's because all of my boxes are on the same domain hence no crossing. However, I get certificate warnings when I do the same with my AIR apps. I can't get those to go away but they don't prevent the apps from working.. it's just annoying.
jr97's picture

Now that I think about, I've

Now that I think about, I've seen Flash developers get away from the whole cross-domain thing by using proxies or proxy servers. I'm not sure how that works since that's not my arena but it might be worth looking into.
vr.certi.org.br's picture

thanks!

thanks jr97! solved with a proxy trick. posted my solution at https://www.wso2.org/forum/thread/8585#comment-13273 greetings! :-)
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)