Problem with Submission

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with Submission

Lee Faus
I am trying to submit via a custom REST interface.  I have hacked the book example to include the following submission:

            <xforms:submission id="save-submission" ref="instance('books-instance')"
                    action="http://10.0.1.183:8080/alfresco/service/orbeon/upload"
                    method="post" replace="none">
                <xforms:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xforms:message>
            </xforms:submission>

Everytime I try to submit I get an error on localhost:8080 in the modal popup.  I do not see any errors on the server side or any errors on the client side.  

1) Am I doing this correct?
2) How do I enable logging so I can see what is going on!

Lee
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Submission

Lee Faus
Lee Faus wrote
I am trying to submit via a custom REST interface.  I have hacked the book example to include the following submission:

            <xforms:submission id="save-submission" ref="instance('books-instance')"
                    action="http://10.0.1.183:8080/alfresco/service/orbeon/upload"
                    method="post" replace="none">
                <xforms:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xforms:message>
            </xforms:submission>

Everytime I try to submit I get an error on localhost:8080 in the modal popup.  I do not see any errors on the server side or any errors on the client side.  

1) Am I doing this correct?
2) How do I enable logging so I can see what is going on!

Lee
I have found the Log4J settings and I am getting A LOT closer.  So for my REST api, I need to know how to set the content that is passed in:

21:52:37,766 INFO  [STDOUT] 2008-06-02 21:52:37,766 DEBUG XFormsServer  - XForms -     submission - opening URL connection {URL: "http://admin:xxxxxxxx@10.0.1.183:8080/alfresco/service/orbeon/upload"}
21:52:37,766 INFO  [STDOUT] 2008-06-02 21:52:37,766 DEBUG XFormsServer  - XForms -     submission - setting cookie {JSESSIONID: "9C2545D94B333E158421806C2ADD6889"}
21:52:37,767 INFO  [STDOUT] 2008-06-02 21:52:37,767 DEBUG XFormsServer  - XForms -     submission - setting request body {mediatype: "application/xml", body: "<?xml version="1.0" encoding="UTF-8"?><books>
    <book>
        <title>Jacques le fataliste et son ma”tre</title>
        <author>Denis Diderot</author>
        <language>fr</language>
        <link>http://en.wikipedia.org/wiki/Jacques_le_fataliste_et_son_ma%C3%AEtre</link>
        <rating>5</rating>
        <notes>Ce roman complexe et dŽconcertant Ñ sans doute l'Ïuvre de Diderot la plus commentŽe Ñ puise pour partie son inspiration dans l'ouvrage de Laurence Sterne, Vie et opinions de Tristram Shandy paru quelques annŽes auparavant (1759-1763).</notes>
    </book>
</books>"}
21:52:37,803 INFO  [STDOUT] 2008-06-02 21:52:37,803 DEBUG XFormsServer  - XForms -     submission - external submission time including handling returned body {time: "37"}
21:52:37,804 INFO  [STDOUT] 2008-06-02 21:52:37,804 ERROR XFormsServer  - XForms - submission - xforms-submit-error throwable: org.orbeon.oxf.xforms.XFormsModelSubmission$XFormsSubmissionException: line 27 of oxf:/config/xforms-widgets.xsl (processing submission response): xforms:submission for submission id: save-submission, error code received when submitting instance: 400
oxf:/config/xforms-widgets.xsl, line 27, column -1: xforms:submission for submission id: save-submission, error code received when submitting instance: 400

My code is old HTML Form based code that is looking for content from and Upload Input Form:

var filename = null;
var content = null;
var title = "";
var description = "";

// locate file attributes
for each (field in formdata.fields)
{
  if (field.name == "title")
  {
    title = field.value;
  }
  else if (field.name == "desc")
  {
    description = field.value;
  }
  else if (field.name == "file" && field.isFile)
  {
    filename = field.filename;
    content = field.content;
  }
}

How do I set the content in this script to the 'body' that is coming in from Orbeon.  Is this a JSON hash?  I tried to find an HTTP sniffer that would work between the two servers I am using to no success.  Any help would be greatly appreciated!

Lee