POST to servlet that does not provide a HTML/XML response

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

POST to servlet that does not provide a HTML/XML response

Rolf
Using form runner I want to post XML instance data to an existing non-orbeon servlet.

The servlet lives externally is designed to process the posted data and turn it into a custom PDF and have the user save the data as PDF file.  The servlet by itself works fine and I can invoke it with a regular ( non orbeon ) HTML post. FYI - the servlet uses mime type application/pdf and Content-disposition: attachment; filename=fname.ext to get the browser to save content to file.

My problem is that a form runner submission to this servlet with method="post" fails. When not defining the replace option the response is 'An error has occurred while processing the request'. When specifying replace=none, the submission does not trigger the servlet .

The same xforms submission configured as get rather than a post will go through without problems. However, since the XML instance to be passed contains embedded base64 image data, I need to post.

I have tried all variations to the submission that I could think off. Just to make sure, I have tried the same scenario with the sandbox sample submission-post.xhtml  code ( amending the URL to point to the PDF servlet ), with different setting for the replace and options, all resulting in one of the above two error scenario's

My question - am I trying something that is not possible ? How should I code an xforms submission to post XML instance data to a servlet for which the response is to be ignored ?  

Many Thanks!


Reply | Threaded
Open this post in threaded view
|

Re: POST to servlet that does not provide a HTML/XML response

Erik Bruchez
Administrator
Rolf,

    replace="none"

should absolutely work. Can you show your code/configuration?

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: POST to servlet that does not provide a HTML/XML response

Erik Bruchez
Administrator
Based on what you sent offline, the answer is simple. If you check the Orbeon Forms log, your service returns a 405 code:

     "error code received when submitting instance: 405"

So it seems that your servlet doesn't support the POST method, and you need to change that.

BTW to debug this kind of issues, we recommend using, besides orbeon.log, an HTTP monitor, like Charles. It's just very useful:

    http://blog.orbeon.com/2013/04/let-charles-help-you-monitor-http.html
    http://wiki.orbeon.com/forms/doc/developer-guide/admin/monitoring-http-requests

I hope this helps,

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: POST to servlet that does not provide a HTML/XML response

Rolf
I checked and of course you are correct about the 405 code and the issue being with the applet, not with Orbeon XFORMS.

- Rolf