Highlighted

HTTP-POST Error

Semsegrebsler

02-10-2008

Hi,

I tried to communicate to a server using HTTP-POST based on
the examples I found in the documentation and some books (Flex 3).
In all cases I got the same problems. HTTP-GET works properly.
HTTP-POST in the following example-code causes a runtime error:



Example-Code:

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">



<mx:HTTPService id="srv" url="
http://ehms-nsi.bwl.de:83/sap/bc/bsp/sap/z_ml_001_bsp/default.htm"

method="POST"
result="mx.controls.Alert.show(srv.lastResult.result.out.text);">

<mx:request>

<name>{n.text}</name>

</mx:request>

</mx:HTTPService>



<mx:Form>

<mx:FormItem label="Name">

<mx:TextInput id="n"/>

</mx:FormItem>

<mx:FormItem>

<mx:Button label="Send" click="srv.send()"/>

</mx:FormItem>

</mx:Form>

</mx:Application>



Runtime Error:

[RPC Fault faultString="Error #1096: XML-Parserfehler: Nicht
abgeschlossenes Element." faultCode="Client.CouldNotDecode"
faultDetail="null"]

at mx.rpc.http::HTTPService/
http://www.adobe.com/2006/flex/mx/internal::processResult()[E:\dev\3.0.x\frameworks\projects\rpc\src...

at mx.rpc::AbstractInvoker/
http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src...

at
mx.rpc::Responder/result()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:41]

at
mx.rpc::AsyncRequest/acknowledge()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]

at
DirectHTTPMessageResponder/completeHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:381]

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at flash.net::URLLoader/onComplete()



Without the <mx:request> section, the error does not
appear, but the server gets not a HTTP-POST-request as expected,
but a HTTP-GET-request.



Has anyone any idea???