Wednesday, 4 January 2012

Creating a RESTful Web Service Reference

To utilize a RESTful Web service from your application, you must create a RESTful Web service reference.
To create a RESTful Web service reference:
  1. Navigate to the Web Service References page. See "Accessing the Web Service References Page".
  2. Click Create.
  3. Select REST and click Next.
  4. For REST Details, specify the following:
    1. Name - Enter a name to identify the reference.
    2. URL - Enter the URL endpoint of the Web service.
    3. Proxy - Enter a proxy to override the application proxy for this service (optional).
    4. HTTP Method - Choose the http method used for the request to the Web service. Select GET, HEAD, POST, PUT or DELETE.
    5. Basic Authentication - Select Yes to require HTTP Basic Authentication. Otherwise, select No.
    6. HTTP Headers - Enter the names of the HTTP headers to send with the request.
    7. Click Next.
  5. For REST Input parameters, specify the following:
    1. Name - Enter the name of the input parameter expected by the method.
    2. Type - Select the input type.
    3. Click Add Parameter.
    4. Repeat steps a though c for each expected input.
    5. Click Next.
  6. For REST Output parameters, specify the following:
    1. Output Format - Select XML or Text for the response format expected from the Web service.
    2. XPath to Output Parameters (XML only) - Enter an XPath expression to the relevant part of the response.
    3. Response Namespace (XML only) - Enter the namespace corresponding to the Response XPath.
    4. Parameter Delimiter (Text only)- Enter the character or sequence that separates parameters returned from the Web service. Use \n to indicate a new line and \t to indicate a tab character.
    5. New Record Delimiter (Text only) - Enter the character or sequence that determines a new record in a text response from the Web service. Use \nto indicate a new line and \t to indicate a tab character.
    6. Name - Enter the name of the output parameter returned by the method.
    7. Type - Select the output type.
    8. Click Add Parameter.
    9. Repeat steps f though h for each returned output parameter.
    Note:
    Click Test to send a request to a RESTful Web service and see the response. This test process will help you in specifying the appropriate Output parameters.
  7. Click Create.
The Create Web Service Reference Success page appears. The Web service reference is added to the Web Service References Repository.

No comments:

Post a Comment