2 Replies Latest reply on Feb 12, 2009 2:42 PM by Peter Farland

    httpservice contentType=application/xml issue

    bmilesp Level 1
      hello,

      i have an xml object:

      <mx:XML id="tester" xmlns="">
      <inventories><test>1</test></inventories>
      </mx:XML>

      and an httpservice:

      <mx:HTTPService id="saveChart" method="POST" contentType="application/xml" useProxy="false"
      result="saveComplete()" />

      and when i call this function:

      private function save(){
      saveChart.request = tester;
      saveChart.send();
      }

      i get this error: Error 1095: XML parse failure: Unterminated attribute.

      i check my post resquest and it seems to post ok. So this leads me to believe that the return data is causing the problem. but i'm not parsing any data in the saveComplete() function. Waht am i doing wrong? Thanks in advance!
        • 1. Re: httpservice contentType=application/xml issue
          bmilesp Level 1
          when i returned dummy XML from the server, it solved this problem. I guess by default flex expects return data?
          • 2. Re: httpservice contentType=application/xml issue
            Peter Farland Level 3
            As with other RPC services, for HTTPService typically you'd pass the event to your handler and access its result property, i.e. it should be:
            result="saveComplete(event)"

            ...and the signature of save complete would be:
            private function saveComplete(event:ResultEvent):void
            {
            }

            Or are you accessing the result event data in another way? Any chance we could see the code in your saveComplete() function anyway?

            Note you could debug the application in Flex Builder and put a break point in this result handler to make sure it is indeed reaching it and perhaps the error is happening in some processing code in saveComplete? Or you may use this to determine that the error is happening during HTTPService decoding before it dispatches the result event.

            Are you expecting XML back in the response? You haven't set a result format on HTTPService. You could try setting resultFormat="e4x" so that you explicitly get an E4X based XML instance from the result... or you could set resultFormat="text" if you want to preprocess the raw String before treating it as XML.