5 Replies Latest reply on Apr 28, 2008 8:33 PM by ntsiii

    Can't send HTTP POST requests

    Flexerer
      Hi,

      Flex3 Pro vs. J2EE
      All HTTP requests with method=POST are received by server as GET requests.
      At first I thought the problem was with the app server - WebLogic - but the same happens with Tomcat.

      Any idea what could be causing this?

      Thanks!!!
        • 1. Re: Can't send HTTP POST requests
          ntsiii Level 3
          Yes, there is an idiosyncrasy with the Flash Player where if the POST body is empty (as yours is), it sends a GET.

          Try this:
          click="httpService.send({testParam:"testValue"});" ..

          Tracy
          • 2. Re: Can't send HTTP POST requests
            Flexerer Level 1
            Hey Trace - thanks, you saved the day for us.

            We are attaching XML content to the request property and sending as POST:

            httpService.request = someXML

            This worked with Flex 2 but not with 3.

            Thanks!
            • 3. Re: Can't send HTTP POST requests
              ntsiii Level 3
              I avoid this by using the normal contentType and sending name value pairs, and parsing the xml string on the server.
              Tracy
              • 4. Re: Can't send HTTP POST requests
                Flexerer Level 1
                Tracy,

                By "sending name value pairs" did you mean object properties and sending the object?

                This works only when you know the property name in advance. We have a generic function that gets all the values from the controls and builds XML on the fly. This way you don't need to know the property name in advance and it works on any screen/form.

                Setting content type to "application/xml" did the trick for us - but you put us on the right track.

                Thanks!
                • 5. Re: Can't send HTTP POST requests
                  ntsiii Level 3
                  I build my xml dynamically, but then I just:
                  ..send({xmlstring:myXML.toXMLString()})

                  And on the server, loadXML(Request("xmlstring"))

                  I had heard a few years ago of folks having difficullty with contentType="application/xml", and was doing just fine with the xml strings, so I never bothered to try to send the xml itself.

                  It is good to know that application/xml wotks.

                  Tracy