开发者

Not able to run .jsp url from Flexbuider 3?

开发者 https://www.devze.com 2023-04-02 22:42 出处:网络
Following is a .mxml code that should run behind URL http://localhost:8084/HelloWorld/index.jsp: <?xml version=\"1.0\" encoding=\"utf-8\"?>

Following is a .mxml code that should run behind URL http://localhost:8084/HelloWorld/index.jsp:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
            xmlns:maps="com.google.maps.*"
            viewSourceURL="srcview/index.html">

    <mx:HTTPService id="srv" url="http://localhost:8084/HelloWorld/index.jsp" />    
    <mx:Button label="Get Data" click="srv.send()"/>
    <mx:Button label="Print" click="creationCompleteHandler(event)"/>           

        <mx:Script>
        <![CDATA[                   
        import flash.net.URLLoader;
        import flash.net.URLRequest;
        import flash.utils.ByteArray;

        import mx.collections.ArrayCollection;
        import mx.controls.Alert;
        import mx.controls.TextArea;
        import mx.rpc.events.FaultEvent;
        import mx.rpc.events.ResultEvent;
        import mx.rpc.xml.SimpleXMLDecoder;
        import mx.utils.ObjectUtil;
        import mx.utils.XMLUtil;



        protected function creationCompleteHandler(event:Event):void
           {                
               //http://localhost:8084/GetShapeFiles/
               Alert.show("Here comes data: ");
           }
        ]]>
    </mx:Script>

</mx:Application>

When I open the URL on browser, it is opening but not able to run through .mxml. I get an error:

[RPC Fault faultString="Error #1096: XML parser failure: Unterminated element." faultCode="Client.CouldNotDecode" faultDetail="null"]
    at mx.rpc.http::HTTPService/http://www.adobe.com/2006/flex/mx/internal::processResult()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\http\HTTPService.as:851]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:188]
    at mx.rpc::Responder/result()[C:\autobui开发者_JAVA百科ld\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:43]
    at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
    at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:403]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()


I think the error is pretty self-explanatory. Your returned XML is not parsable probably because it's not formatted properly. Could be that your jsp isn't sending good xml or that your server doesn't understand jsp and just returns it as plain-text to Flex.

I'm also failing to see how you're using this xml. Since I only see a 'get data' and a 'print' button that never relates to the result being returned.

0

精彩评论

暂无评论...
验证码 换一张
取 消