Understanding the Architecture and Functionality of the Addrest Demo Application

In this section:

Internally, the Addrest demo application generates a REST style service request to a process flow, to find customer information based on a search query. Clicking the Search button in the Addrest demo application submits the search query, after which the REST style service request is generated.


Top of page

x
Specifying the URL

You can use the actual URL specified here to run the Addrest demo application process flow, without the use of the demo application portlet. The generic URL format that follows is generated.

Addrest Demo Application URL Format

http://iSMhost:iSMPort/ism/enable-run/addrestCustomerSearchAny?SearchString=Owner

Generic URL Format

http://iSMhost:iSMPort/ism/enable-run/pFlowName?parm1=value1&parm2=value2...parmN=valueN

where:

iSMhost:iSMPort
Are the host name and port number for the iWay Service Manager that services the request.
/ism
Specifies that the iWay Service Manager Administration Console listener is used to process the request.
/enable-run
Is the context endpoint that allows the run-time support for REST style services.
pFlowName
Is the name of the iWay Service Manager process flow that can service the request.
parm1=value1...parmN=valueN
Are the name=value pairs for parameters that are passed to the process flow.

Top of page

x
Receiving and Identifying the Request

Once the iWay Service Manager Administration Console listener receives the URL on the /enable-run context endpoint, the listener identifies it as a REST style service request. iWay Enable generates an XML document that contains HTTP headers from the request, along with all the name=value parameters specified in the URL.

The specified process flow must be able to process the generated XML document and produce a response. The calling application then processes the response. The result set is presented to the user in a formatted grid.



Example: Sample XML Request Document for Addrest Demo Application
<addrestCustomerSearchAny>
   <parm name="SearchString" value="Owner"/>
   <header name="Accept"
   value="text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;
          q=0.8,image/png,*/*;q=0.5"/>
   <header name="Accept-Charset" value="ISO-8859-1,utf-8;q=0.7,*;q=0.7"/>
   <header name="Accept-Encoding" value="gzip,deflate"/>
   <header name="Accept-Language" value="en-us,en;q=0.5"/>
   <header name="Authorization" value="Basic aXdheTppd2F5"/>
   <header name="Connection" value="keep-alive"/>
   <header name="Host" value="iSMhost:iSMport"/>
   <header name="Referer" value="http://ismHost:iSMPort/ism/enable-run?
                 configuration=base"/>
   <header name="User-Agent" value="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
                 rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20"/>
</addrestCustomerSearchAny>

Top of page

x
Processing the Document

The generated XML document, which represents a REST style service call, is passed to the process flow. In the Addrest demo application, the process flow is named addrestCustomerSearchAny. The process flow is shown in the following image.

Processing takes place as follows.



Example: Sample XML Response Document for Addrest Demo Application
<CustomerList>
     <customer>
          <CustomerID>AM002</CustomerID>
          <CompanyName>Metropol</CompanyName>
          <ContactName>Ana Mazina</ContactName>
          <Title>Owner</Title>
          <StreetAddress>Oberno Str. 58</StreetAddress>
          <City>Berlin</City>
          <Postal>12209</Postal>
          <Country>Germany</Country>
          <TelephoneNumber>030-0074000</TelephoneNumber>
          <FaxNumber>030-0076545</FaxNumber>
     </customer>
     <customer>
          <CustomerID>LG011</CustomerID>
          <CompanyName>101 Motors</CompanyName>
          <ContactName>Leo Gordon</ContactName>
          <Title>Owner</Title>
          <StreetAddress>2964 Shore Rd.</StreetAddress>
          <City>Brooklyn</City>
          <Postal>11235</Postal>
          <Country>USA</Country>
          <TelephoneNumber>718-382-9000</TelephoneNumber>
          <FaxNumber>718-382-9444</FaxNumber>
     </customer>
 </CustomerList>

Top of page

x
Using the Addrest Data File

The customer data file that is read by the addrestCustomerSearchAny process flow in the Addrest demo application is available for your use. It is in CVS (comma-separated value) format. You can easily modify it so that it contains additional or updated records.

The data file is named customers.csv. It is located in the iwayhome\etc\enable\demos\addrest\data directory.

The current data in the customers.csv data file is shown here.


iWay Software