Keith,

The test case from my previous message works for me, using method="POST" with 4.1-3 on linux and firefox 3.5.3. I'd suggest verifying that it also works for you. Then you can begin to bisect the differences between your code and this test case.

-- Mike

On 2009-10-26 11:10, Keith L. Breinholt wrote:
I apologize for the errant PUT.  I have in fact tried with the method="post" 
and that is in fact the only method that gives the 405 error.

The method="put" was an attempt on my part to find a way around this problem.

Again, it is only on method='post' that I get the 405 error.

Keith L. Breinholt
ICS Content&  Media
[email protected]

-----Original Message-----
Date: Mon, 26 Oct 2009 10:10:23 -0700
From: Michael Blakeley<[email protected]>
Subject: Re: [MarkLogic Dev General] 405 error on POSTs
To: General Mark Logic Developer Discussion<[email protected]>

Keith,

You've written POST, but your form has method="PUT". I believe that's
where the 405 is coming from. When I tested with Firefox, it appeared to
silently rewrite that as a "GET". If you are using IE, the results might
be different: perhaps it's sending the PUT, and your form-handling code
is throwing an error?

If fixing the action doesn't help, then I'd recommend looking harder at
your code and configuration. I was able to put together a simple test
case that worked without a 405 (even when using method="PUT", which
Firefox rewrote as a GET).

(: /form.xqy :)
xdmp:set-response-content-type("text/html"),
<html xmlns="http://www.w3.org/1999/xhtml";>
    <head>
      <title>test</title>
    </head>
    <body>
      <form action="/file" method="put" enctype="multipart/form-data"
target="_self">
        <p>
Add file to folder:
        <input type="file" class="name" name="name"/>
        <input type="submit" value="Add"/>
        </p>
      </form>
    </body>
</html>

(: test rewriter :)
let $path := xdmp:get-request-path()
let $d := xdmp:log(text {
      xdmp:get-request-method(),
      xdmp:get-request-path() })
return
    if ($path eq '/file') then '/form.xqy'
    else $path

-- Mike

On 2009-10-26 09:38, Keith L. Breinholt wrote:
I’m trying to POST a file to an web service interface that I’ve written.  The 
webservice uses a URL rewriter that translates the web service URLs to the 
actual code that will do the work and hides the actual .xqy extensions from the 
end users.

So we have some application code that does a post like this:

        <form action="/file" method="put" enctype="multipart/form-data" 
target="_self">
          <p>Add file to folder:<input type="file" class="name" name="name"/><input type="submit" 
value="Add"/></p>
        </form>

In the rewriter the URL PUT or POST of ‘/file?uri=foo.xml’ gets translated to 
something like ‘/file/receive.xqy?uri=foo.xml’

However, the URL rewriter never receives the request and the browser gets a 405 
(Method Not Allowed) error from MarkLogic.

If I change the action of the form to go directly at the XQuery file 
‘/file/receive.xqy?uri=foo.xml’ I don’t get the error and everything is fine.

Two questions: Why is MarkLogic intercepting all POST calls in the first place? 
 And second, if there is a good reason then why does MarkLogic intercept POST 
calls before the rewriter instead of after when it actually knows where it is 
headed?

Keith L. Breinholt
ICS Content&   Media
[email protected]<mailto:[email protected]>
"Do what you can, with what you have, where you are." Theodore Roosevelt



NOTICE: This email message is for the sole use of the intended recipient(s) and 
may contain confidential and privileged information. Any unauthorized review, 
use, disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies of 
the original message.




_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to