SavingContent

HTTP status code and method

First and maybe most important rule: You have to send a HTTP Status code of 204 or 201 back, when the save succeeded. Otherwise you'll get an error. This is the way it's done in WebDAV and the standard load/save handler in BXE uses the WebDAV protocoll. Therefore it also sends a PUT instead of a POST, if you save stuff. Since BXE 2.0 You can overwrite the load/save handler.

(The following links seems to be no longer valid. Does anybody know here of a working solution for this or a similar example (except How to implement your own transport driver)?<br>
<strike>See the code in http://svnweb.bitflux.ch/chora/cvs.php/trunk/mozile/td/?rt=svneditor for examples.

A sample implementation in PHP for a load/save script on the server side can be found at

http://svnweb.bitflux.ch/chora/cvs.php/trunk/scripts/loadsave.php?rt=svneditor </strike>
)

Contributions for other languages are very welcome. But if you already have a WebDAV interface in your "CMS", then you're all set. BXE should then be able to load and save without any modifications.

It's also well advised to send your XML documents with the Content-Type "text/xml", but BXE is since 0.9.4 able to handle others, as well.

See also How_to_implement_your_own_transport_driver for more information

If you just want to use a PHP script for saving (still using HTTP PUT), may be you can use the method described as follows. It is tested and does work well on a SuSE Linux box with Apache/2.0.49 and PHP Version 4.3.4 (running as Module). No idea if working on other environments, especially other Apache builds or web servers...

Using PHP for saving XML content with standard transport driver

config.xml

Set in your config.xml under (X)Path /config/files/input an entry like this:

where test.xml must be a (relative or absolute) path into the server side filesystem (not the one exposed by HTTP server to browser clients).

Server side

Of course, you do need a working PHP script to handle the request. Use something like this (not for really big XML files - would exceed your memory!):

That's all, you are done.

Note:<br>
Of course: Your PHP script should handle the GET requests as well...

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.