3 Replies Latest reply on Oct 6, 2012 9:51 AM by hschlossberg

    URL Encoding for WPE

    hschlossberg

      [FMS 12 on Windows 2008 with IIS]

       

      Our client has a third-party app that needs to send URL strings to FMS to trigger a script that then adds data.

       

      This is an example of what FMS needs to be sent, and it works when I send it manually via a web browser:

      http://xxx.xx.xxx.xx/fmi/xml/fmresultset.xml?-db=player&-lay=Enco&-script=Receive_From_Enco&-view&-script.param=data%20for%20the%20script%20to%20use

       

      According to FileMaker's WPC logs, the above is what it is receiving, both from my manual attempts through the browser, as well as from the third-party app. However, it generates an error 4 (unknown command) only when it comes from the third-party app and the script never runs in that case (all runs fine on my manual attempts).

       

      I then looked at the server's IIS log and IT shows the above for those times when I send the string manually from a web browser, but it shows an encoded string that I'm guessing WPC just doesn't know how to interpret when sent from the client's third-party app:

      http://xxx.xx.xxx.xx/fmi/xml/fmresultset.xml?-db%3Dplayer%26-lay%3DEnco%26-script%3DReceive_From_Enco%26-view%26-script.param%3DGroup%3DNEWCORE

       

      Since the URL is technically correct in its encoding (I think?), I can't easily ask the third-party app's developers to create a special version just for our client.

       

      Is this expected behavior? An IIS issue? An FMS/WPE issue? Any solutions?

       

      Thanks,

      Howard

        • 1. Re: URL Encoding for WPE
          taylorsharpe

          I have no idea the answer, but I would start with eliminating things.  For example, to find out if your 3rd party app is a problem, try using a different app.  The easy way to try is to use FileMker's PHP API to make the same URL call to FileMaker Server.  If that works, then clearly there is a problem at the 3rd party's end of things because you could do it both manually as well as via another app (PHP).  However, if PHP fails, then it is probably a FileMaker handling problem.  By the way, is this a single system FileMaker setup or multiple systems?  Windows 2008 R2?  FMS 12 v2?

          • 2. Re: URL Encoding for WPE
            steve_ssh

            Hello Howard,

             

            Have you taken a very close look at the API of the third-party app to see if there is a setting in the URL-invoking functionality that allows you to turn off URL-encoding for the URL data you enter?

             

            Very best & good luck,

             

            -steve

            • 3. Re: URL Encoding for WPE
              hschlossberg

              Thanks, Taylor and Steve, for your responses.  This is Win 2008 Standard R2 SP1 running FMS 12.0v2.

               

              The third-party app doesn't have many options, and it is unfortunately irreplaceable at this time.  But even still, the problem seems to be with how the WPE does its encoding or decoding.

               

              Our first workaround attempt at resolving this after my post yesterday was to have the third party app send its parameters to a custom PHP page we set up, and then have the PHP page do a proper cURL on it and forward it to the same FMS XML url as above.  That all went great until the script.param had an "%26" in it (an ampersand), cURL sent it on and WPE choked on it.

               

              Our next (and for now final) workaround was to simply avoid the XML engine and just call the FMS script directly from the intermediate PHP page, and passing it the parameter in doing so.  This seems to be the most reliable.