Is it possible to grab XML across domains?
May 18, 2009 6:36 PM Subscribe
Trying to grab XML across domains, wondering if what I'm trying to do is even possible..
So, I'm working with a group that's sharing another group's Plone server -- and which doesn't have filesystem access on said server. We have data in XML files on another server, and what I'm trying to do is grab those XML files, transform them into something displayable using XSLT, and then display them. It's not possible (as far as I know) to do this on the server side, due to being on a shared server / not having filesystem access, but doing it on the client side is somewhat impossible-seeming itself, since if I try to bring in the data from the other server using the document() function I run into the predictable "access denied" messages from IE and Firefox (though, weirdly, not Safari). Is there any way to do what I'm trying to do here that will work in all modern browsers?
Apologies if I'm speaking gibberish; this problem is not in my usual field and I'm operating more or less at the edge of my understanding.
So, I'm working with a group that's sharing another group's Plone server -- and which doesn't have filesystem access on said server. We have data in XML files on another server, and what I'm trying to do is grab those XML files, transform them into something displayable using XSLT, and then display them. It's not possible (as far as I know) to do this on the server side, due to being on a shared server / not having filesystem access, but doing it on the client side is somewhat impossible-seeming itself, since if I try to bring in the data from the other server using the document() function I run into the predictable "access denied" messages from IE and Firefox (though, weirdly, not Safari). Is there any way to do what I'm trying to do here that will work in all modern browsers?
Apologies if I'm speaking gibberish; this problem is not in my usual field and I'm operating more or less at the edge of my understanding.
Response by poster: Yeah -- it's goofy. Basically, I have access to the Zope object database through the ZMI, but no access whatsoever to the underlying filesystem -- which means no wget. I am complaining loudly to the Powers that Be about how hamstrung the group is with this setup, but to no avail.
posted by You Can't Tip a Buick at 7:22 PM on May 18, 2009
posted by You Can't Tip a Buick at 7:22 PM on May 18, 2009
I'm not getting your problem, can't System A just request a page from System B and scrape the results?
posted by mattoxic at 7:35 PM on May 18, 2009
posted by mattoxic at 7:35 PM on May 18, 2009
Do you have any .htaccess abilities on the server? You can use a proxy to redirect all requests from /proxy/web.xml to http://othersite/web.xml if you do and they've got the right stuff turned on: http://httpd.apache.org/docs/1.3/mod/mod_proxy.html#forwardreverse
posted by soma lkzx at 8:13 PM on May 18, 2009
posted by soma lkzx at 8:13 PM on May 18, 2009
I'm surprised Safari allowed you to do that. Various browsers have various rules on cross-site requests... and they'll probably all change in the next generation of browsers... but the general rule is that you can only request data from your local page.
Given this limitation, yeah, ideally you'd just have a tiny bit of code that accepts a parameter (page) and uses curl or whatever to grab the appropriate page from the other server and spit it right to the browser for client-side processing. You don't need to save anything to a tempt file, you can just pass it right through. You can't upload anything?
You could pretty easily write something like this in a few lines of PHP code... or whatever your scripting language of choice.
posted by ph00dz at 8:24 PM on May 18, 2009
Given this limitation, yeah, ideally you'd just have a tiny bit of code that accepts a parameter (page) and uses curl or whatever to grab the appropriate page from the other server and spit it right to the browser for client-side processing. You don't need to save anything to a tempt file, you can just pass it right through. You can't upload anything?
You could pretty easily write something like this in a few lines of PHP code... or whatever your scripting language of choice.
posted by ph00dz at 8:24 PM on May 18, 2009
Response by poster: I can't upload /anything/. It's the most bizarre system.
ph00dz: I'm surprised Safari allowed me to do it, too. I've written the few lines of scripting language of my choice (python, in this case) code and am going to make a "if someone will let me put this file in the Extensions directory, everything is solved. Otherwise, everything is impossible" plea tomorrow.
soma: yeah, no .htaccess -- though if the "come on, it's like five lines, could someone upload this?" plea doesn't work, I'll ask about a redirect.
posted by You Can't Tip a Buick at 8:37 PM on May 18, 2009
ph00dz: I'm surprised Safari allowed me to do it, too. I've written the few lines of scripting language of my choice (python, in this case) code and am going to make a "if someone will let me put this file in the Extensions directory, everything is solved. Otherwise, everything is impossible" plea tomorrow.
soma: yeah, no .htaccess -- though if the "come on, it's like five lines, could someone upload this?" plea doesn't work, I'll ask about a redirect.
posted by You Can't Tip a Buick at 8:37 PM on May 18, 2009
wait, so you *do* have control over the server that contains the XML? If so, then what, the Plone server is the only one browser-accessible?
posted by rhizome at 9:59 PM on May 18, 2009
posted by rhizome at 9:59 PM on May 18, 2009
Response by poster: Server A: Hosts our group's XML files. Editable only through a web interface, though can be exported easily.
Server B: Plone server, which we're sharing. We only have access through the ZMI/to the ZODB. No filesystem access, no scripts except those that can run in "restricted python mode" (which means we can't call file.open() or anything like that, nor can we import any meaningful modules).
I got the impression, shortly after typing up this question, that the reason why it feels like I'm being asked to do the impossible due to arbitrary restraints is because I'm being asked to do the impossible, due to arbitrary restraints.
posted by You Can't Tip a Buick at 10:45 PM on May 18, 2009
Server B: Plone server, which we're sharing. We only have access through the ZMI/to the ZODB. No filesystem access, no scripts except those that can run in "restricted python mode" (which means we can't call file.open() or anything like that, nor can we import any meaningful modules).
I got the impression, shortly after typing up this question, that the reason why it feels like I'm being asked to do the impossible due to arbitrary restraints is because I'm being asked to do the impossible, due to arbitrary restraints.
posted by You Can't Tip a Buick at 10:45 PM on May 18, 2009
So it sounds like you're running the XSLT on the client side within the web browser?
Can you set up normal javascript? If I understand what your situation is I think I'd do this with ajax-type javascript rather than XSLT if XSLT is producing a permissions error.
Or alternatively, is there any way to rig it so that the XML on server A is what's input to the XSLT parser, instead of bringing it in as a secondary document with the XSLT
posted by XMLicious at 11:50 PM on May 18, 2009
Can you set up normal javascript? If I understand what your situation is I think I'd do this with ajax-type javascript rather than XSLT if XSLT is producing a permissions error.
Or alternatively, is there any way to rig it so that the XML on server A is what's input to the XSLT parser, instead of bringing it in as a secondary document with the XSLT
document()
function as it sounds like you're doing?posted by XMLicious at 11:50 PM on May 18, 2009
Response by poster: I would love to do what you're talking about in the third paragraph, but I don't know how to begin... I'm guessing from your name that you might be able to help me, though. So, yeah, that, rigging it so that the XML goes straight into the XSLT parser. How does one do that?
(apologies if I sound like an idiot / rude, it's just I'm quite outside my domain of competence here...)
posted by You Can't Tip a Buick at 5:12 AM on May 19, 2009
(apologies if I sound like an idiot / rude, it's just I'm quite outside my domain of competence here...)
posted by You Can't Tip a Buick at 5:12 AM on May 19, 2009
No worries. It sounds like you are working in some environment where the only thing you have access to is the XSLT code itself and someone else has set up all of the code that runs the XSLT and connects its output to the web site you're looking at, or that functionality is a built-in part of the system you're working on. (Perhaps this is how Plone / Zope works by default, I've never installed or otherwise worked with it.)
Where is it / how is it that you're modifying your XSLT code? Are you editing a file and saving it somewhere, or maybe calling some function within another programming language and passing an XSLT string to it? Perhaps if you can give a link to the portion of the Plone / Zope docs that talk about what you're trying to do I can get a better idea of what is going on.
posted by XMLicious at 4:26 PM on May 19, 2009
Where is it / how is it that you're modifying your XSLT code? Are you editing a file and saving it somewhere, or maybe calling some function within another programming language and passing an XSLT string to it? Perhaps if you can give a link to the portion of the Plone / Zope docs that talk about what you're trying to do I can get a better idea of what is going on.
posted by XMLicious at 4:26 PM on May 19, 2009
This thread is closed to new comments.
But re-reading your description, your problem is not making entire sense, if you don't have access to serverA how do you write the web page that is trying to access B?
posted by sammyo at 7:06 PM on May 18, 2009