Exploring Flex

DCD Service Wizard – HTTP service

Posted by hneelu on June 5, 2009

[Updated for Flash Builder Beta 2]

This post is a walk through for using Service Wizard for HTTP service

Step 1: Open the service Wizard

  • In the Service/Data view, click on the Connect to Service/Data link. OR
  • Click on the Data menu and select Connect to Service/Data .  OR
  • Click on the Data menu and select Connect to HTTP(or the service of your choice)

Note: Shortcut for Data menu is Alt+T

Step 1: Select HTTP Service

The project uses no server technology [ ie., which creating the project, in the Server Technology option None/Others was selected]

http-step1

Step2: Click Next.

As you can see below, this wizard is quite diffrent from the CF / PHP service wizards.

http-step2

Step 3: Enter the required the operation name with Method and Content type.

See this for more information : http://livedocs.adobe.com/flex/3/langref/mx/rpc/http/mxml/HTTPService.html

For GET Method
Example: http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=India&output=xml
In the URL column, I enter the entire url. The parameters are automatically populated in the grid.

http-GET

For POST Method with Content- type ‘application/x-www-form-urlencoded’
For a POST Method, select the Content-type from the ‘Content-type’ column.

Example: http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=India&output=xml
In the URL column I enter a part of url (without parameters) : http://search.yahooapis.com/ImageSearchService/V1/imageSearch
The parameters are automatically populated in the grid.

  • Name: appid, DataType: string
  • Name: query, DataType: string
  • Name: output, DataType: string.

http-POST-form-encoded

For POST Method with Content- type ‘application/xml’
For a POST Method, select the Content-type from the ‘Content-type’ column.

Example: http://betty.userland.com/RPC2
The parameter strXml is automatically populated in the grid. This parameter is used in flex application when user invokes the url specified by passing an XML ( To be used in Configure Return Type)

http-POST-xml

Step 4: Click Finish.

There are two more use cases that have been added post Beta 1 for HTTP services in DCD
1. Local XML
The local xml file in present in the bin-debug folder of the flex project.

http-LocalXML


2.Base URL cases
This is useful when we have multiple operations with the same base url. If the URL changes we can change the base URL rather than modifying each operation URL.

http-BaseURL

One Response to “DCD Service Wizard – HTTP service”

  1. […] Http Service [How to use Service Wizard for HTTP service] […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: