Hi Ranchers,
I have created a Web Service in Bea Weblogic. It accepts input as "BookName" and "ISBN" and returns the "Author" and "Price" in response.
I invoked the web service from Flex and I am getting the response which I can see on Weblogic's console. I am able to capture the complete response coming from the web service at Flex side but I want to retrieve the perticular response elements and show them in a text-area in Flex. I have highlighted the part of code to do it but somehow I am not able to get the expected result
. Please find the below code snippet and reply.
Appriciate your help.
Code in Flex: (the .mxml file)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Text;
]]>
</mx:Script>
<mx:Button id="myButton" x="155" y="85" label="Get Details" width="98" click="serviceID.getBookQuote(text1.text, text2.text)"/>
<mx:TextInput x="110" y="37" width="80" id="text1"/>
<mx:TextInput x="213" y="37" width="82" id="text2"/>
<mx:TextArea x="84" y="140" height="183" id="textOutput" width="256"/>
<mx:WebService id="serviceID" wsdl="http://localhost:7001/BookQuoteService/com/example/BookQuoteService.jws?WSDL="
service="BookQuoteService" port="BookQuoteServicePort">
<mx: operation name="getBookQuote" resultFormat="e4x" result="handleResult(event)" fault="handleFault(event)">
<mx:request xmlns="http://soa.cts.com/bookquoteservice/wsdl">
<BookName>{text1.text}</BookName>
<ISBN>{text2.text}</ISBN>
</mx:request>
</mx: operation>
</mx:WebService>
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent
import mx.rpc.events.FaultEvent
import mx.controls.Alert
private function handleResult(event:ResultEvent):void{
textOutput.text(event.result.GetBookQuoteResponse.Author);
}
private function handleFault(event:FaultEvent):void{
Alert.show("Fault:"+event.fault.faultString);
}
]]>
</mx:Script>
</mx:Application>