
<mx:Button x="130" y="95" label="Get Shipping Options"
click="xmlRPC.send();"
width="160" height="22"/>
<mx:DataGrid dataProvider="{shippingInfo}"
x="80" y="141" width="262" height="92"
id="shippingOptionsList"
editable="false" enabled="true">
<mx:columns>
<mx:DataGridColumn headerText="Service"
dataField="service" />
<mx:DataGridColumn headerText="Price" dataField="price" />
</mx:columns>
</mx:DataGrid>
</mx:Application>
Now that we have the Flex client side of the code, let’s take a
look at what we need on the server.
The Server Code in ColdFusion
You can write the server code in whatever server technology
you like (e.g., PHP, Java, Rails, etc.). I’ve chosen to use Cold-
Fusion here, but you can find the code for the other server
models on the O’Reilly web page for this book.
The ColdFusion version of the text return page appears in
Example 5-5.
Example 5-5. PlainHttpService.cfm
<cfsetting enablecfoutputonly="true" />
<cfinvoke component="Shipping"
method="getShippingOptions" argumentcollection="#url#"
returnvariable="myResult" />
<cfloop index="i" from="1" to="#ArrayLen(myResult)#">
<cfoutput>#myResult[i].service#: #dollarFormat
(myResult[i].price)#<br
/></cfoutput>
</cfloop>
The XML version of the interface appears in Example 5-6.
Using the HTTPService Tag | 75
Komentarze do niniejszej Instrukcji