6 Replies Latest reply on Jan 13, 2016 11:21 AM by disabled_morkus

    INSERT from URL POST is returning GET Response

      I have a simple HTTP Servlet that, when using the INSERT FROM URL and issuing a POST request like this:

       

      "httppost://<PATH_TO_SERVLET/AjaxSvr/ajax"

       

      It's returning the GET Response.

       

      The "http://<PATH_TO_SERVLET/AjaxSvr/ajax" also returns the GET Response, but it's expected in this case.

       

      ----

       

      Any ideas why the httppost is not returning the POST Response as expected?

       

      Thanks in advance,

       

      - m

        • 1. Re: INSERT from URL POST is returning GET Response
          user19752

          How do you return the response?

          It looks like you expect some javascript work on client side using name "ajax", but "Insert From URL" inserts first response from the server, doesn't run any client side script.

          • 2. Re: INSERT from URL POST is returning GET Response
            user19752

            There is correct answer in another thread, I confirmed that without parameter httppost: does GET request.

            It is reasonable, since POST with no parameter is meaningless. What do you POST to the URL, nothing?

            • 3. Re: INSERT from URL POST is returning GET Response

              Well, it's good to see my suspicions were correct.

               

              And, yes, I agree with you that a POST without parameters is meaningless perhaps, but since you are hitting the server with a Request, who knows what should happen if nothing gets sent. Maybe ... something.

               

              In a simple JSP page (little more than an HTML form with a form action of POST) to the Servlet, the POST still works with no parameters. That's actually the behavior I would expect.

               

              It should be up to the developer to determine what happens with no parameters, not FM. If there were a way to tell FM to do the POST anyway, an override of sorts or even, eek, and overloaded function, I would be fine with that.

               

              Maybe I want the server to send a custom Response back if there was no parameter sent, or maybe, run some other server code... Who knows?

               

              Do you see my points?

               

              Thanks,

               

              - m

              • 4. Re: INSERT from URL POST is returning GET Response

                "ajax" is actually the Servlet endpoint on the server. I think the name "ajax" is possibly confusing, but if you entered the URL below, with the URL filled in, it returns the GET Response.

                 

                http://<PATH_TO_SERVER>/..../ajax.


                Thanks,

                 

                -- m

                • 5. Re: INSERT from URL POST is returning GET Response
                  wimdecorte

                  morkus wrote:

                   

                   

                  Maybe I want the server to send a custom Response back if there was no parameter sent, or maybe, run some other server code... Who knows?

                   

                  Do you see my points?

                   

                   

                  Only to some extent.  When you POST something to an end point you know what to expect.  That's the crux of integration.  It's not a "oh I will wait for just about anything and hope for the best".

                   

                  When you interact with a web services through either the web viewer or the "insert from URL" you know exactly what you expect.  If you don't get what you expect then you handle the error and that is all there is to it.

                  It is the server that should send back a custom response if you send it nonsense, right?

                   

                  If the error is because you did not actually pass a parameter then you are a little at the mercy of what the web-service will return, but it still is up to you to anticipate it and handle it.  That would be the same in other environments as well so I don't know what you are expecting FM to do here...

                  • 6. Re: INSERT from URL POST is returning GET Response

                    This is really no big deal, since if you add a URL parameter, even with a blank value, FM still respects the "httppost".

                     

                    It is still surprising that using "httppost" by itself is not enough and still REQUIRES that you add a url parameter. That is not standard and could be confusing with the wrong server method (doPost()) runs instead.

                     

                    Point: FileMaker should respect "Http" and "httppost" without any other non-standard "rules" (like requiring, but not stating anywhere I could find, that a URL parameter is required, too). 

                     

                    Thanks for your replies.

                     

                    - m