Hello:
I am looking at your product as both a form / DB solution as well as just a DB solution. We have some customers that have existing html/javascript forms that would want to submit to the eXist DB via rest "put". I am able to query the eXist DB via xquery... i.e. http://domain:8080/exist/rest/db/system/users.xml?_query=//user[group="dba"] How do I add a record/document to the eXist DB via the same type of query? Can I use javascript/XMLHttpRequest? Do you have any examples? How do I handle authentication? Thanks jlafrate |
I am out of the office until 26th July *********************************************************************************************** This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.
Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.
Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards. *********************************************************************************************** The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG
|
In reply to this post by jlafrate
I'm not an orbeon expert, but...
On Fri, Jul 23, 2010 at 06:54:02AM -0700, jlafrate wrote: > > Hello: > > > I am looking at your product as both a form / DB solution as well as just a > DB solution. > > We have some customers that have existing html/javascript forms that would > want to submit to the eXist DB via rest "put". > I am able to query the eXist DB via xquery... > > i.e. > http://domain:8080/exist/rest/db/system/users.xml?_query=//user[group="dba"] > > > > How do I add a record/document to the eXist DB via the same type of query? want to store the document. The eXist rest api is documented at [1]. > Can I use javascript/XMLHttpRequest? Yes, should be fine. > Do you have any examples? Pick your favourite js library. E.g., [2]. > How do I handle authentication? If you're user is already authenticated to access the html page where your javascript runs from, and you use the same authentication for both the html pages and the exist database, then the browser should handle this for you, i.e., sensibly send appropriate http headers in the xmlhttprequest. I know this works for http basic authentication, which exist supports. Hth Alistair [1] http://exist.sourceforge.net/devguide_rest.html [2] http://developer.yahoo.com/yui/connection/ > > > Thanks > jlafrate > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/trying-to-add-put-data-via-rest-tp2300202p2300202.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws -- Alistair Miles Head of Epidemiological Informatics Centre for Genomics and Global Health <http://cggh.org> The Wellcome Trust Centre for Human Genetics Roosevelt Drive Oxford OX3 7BN United Kingdom Web: http://purl.org/net/aliman Email: [hidden email] Tel: +44 (0)1865 287669 -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
I am out of the office until 26th July *********************************************************************************************** This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.
Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.
Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards. *********************************************************************************************** The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG
|
In reply to this post by jlafrate
I am trying to do something as simple as send xml to the DB.
This does not work. I am not sure why and I do not have anything to debug other than html response codes. (200)
< html>
< head>
< title>Exist DB Test< /title>
< /head>
< body>
< form>
< a href"" onclick="doAdd();"> Add< /a>
< SCRIPT>
function doAdd()
{
var url = "http://172.28.3.135:8080/exist/rest/db/testdb/usersa.xml";
var xmlstring = "< auth version='1.0'>< !-- Please do not remove the guest and admin groups --> < groups last-id='2'> < group name='dba' id='1'/> < group name='guest' id='2'/>< /groups>< !-- Please do not remove the admin user. -->< users last-id='3'>< user name='admin3' uid='3' password='{MD5}w1gVFoaPs7cXRpMcrGY5Dg==' digest-password='83e080955186ab3337992033cbb8d867'>< group>dba< /group>< /user>< /users>< /auth>";
var xmlhttp = null;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
if ( typeof xmlhttp.overrideMimeType != 'undefined') {
xmlhttp.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} else {
alert('Perhaps your browser does not support xmlhttprequests?');
}
//This code creates the XMLHttpRequest object and stores it in the xmlhttp variable. Once you have an XMLHttpRequest object -- be it the Mozilla or IE flavor -- making the request is easy:
xmlhttp.open("PUT", url, true);
xmlhttp.send(xmlstring);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
// do something with the results
alert("success");
var myObj = eval ( xmlhttp.responseText );
} else {
// wait for the call to complete
}
};
}
< /SCRIPT>
< /form>
< /body>
< /html>
|
I am out of the office until 26th July *********************************************************************************************** This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.
Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.
Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards. *********************************************************************************************** The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG
|
In reply to this post by jlafrate
Any update on this?
What format does the xml have to be in to "post" to the DB? My example does not affect or add anything to the DB and I am not sure how to debug this or figure out what is wrong. Thanks Jeff |
Administrator
|
Jeff,
I understand you'd like to access eXist from an XMLHttpRequest in JavaScript, which is somewhat unusual if you are using Orbeon Forms. With Orbeon Forms, you would typically access eXist from XForms, using an <xforms:submission>. If you are not using XForms, then I would recommend you post this question in the eXist mailing list. Alex On Tue, Aug 3, 2010 at 6:30 AM, jlafrate <[hidden email]> wrote: > > Any update on this? > > What format does the xml have to be in to "post" to the DB? > > My example does not affect or add anything to the DB and I am not sure how > to debug this or figure out what is wrong. > > > Thanks > Jeff > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/trying-to-add-put-data-via-rest-tp2300202p2311863.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ My Twitter: http://twitter.com/avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |