Previous
Previous
 
Next
Next

Example: Creating a Web Service Reference Manually

In this example, you create a Web reference by supplying information about the Web service and using the manual facility. Manual Web references are created by visually inspecting the WSDL document as well as using a tool to determine the SOAP envelope for the Web service request.

Topics in this section include:

Create a Web Service Reference Manually

To create a Web reference manually, you copy sections from the WSDL for a service called MovieInformation.

Please note the example settings provided in the following steps are based on the MovieInformation service at the time this document was released.

To create a manual Web reference:

  1. On the Application home page, click Shared Components.

  2. Under Logic, click Web Service References.

  3. Click Create.

  4. Select Manual and click Next.

    The Create/Edit Web Service page appears.

  5. In the Name field, enter Movie Info.

  6. Locate the endpoint of the MovieInformation service:

    1. Open the WSDL by going to:

      http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx?wsdl
      
    2. In the WSDL, find the location attribute of the soap:address element, which is a child of the port element. You can search for the following term within the code: soap:address location.

      At the time of this release, it was this attribute:

      http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx
      
  7. In the URL field on the Create/Edit Web Service page, enter the endpoint of the MovieInformation service you located. For example: http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx

  8. Locate the SOAP action for the GetTheatersAndMovies operation:

    1. If necessary, open the WSDL again. See Step 7a.

    2. In the WSDL, find the soapAction attribute of the soap:operation element, which is a child of the operation element that has a name attribute of GetTheatersAndMovies. You can search for the following term within the code: soap:operation soapAction.

      At the time of this release, it was this attribute:

      http://www.ignyte.com/whatsshowing/GetTheatersAndMovies
      
  9. In the Action field on the Create/Edit Web Service page, enter the SOAP action you located. For example: http://www.ignyte.com/whatsshowing/GetTheatersAndMovies

  10. In the SOAP Envelope field on the Create/Edit Web Reference page, enter the xml document representing the SOAP Request message. For example:

    <?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:tns="http://www.ignyte.com/whatsshowing"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <tns:GetTheatersAndMovies>
             <tns:zipCode>#ZIP#</tns:zipCode>
             <tns:radius>#RADIUS#</tns:radius>
          </tns:GetTheatersAndMovies>
       </soap:Body>
    </soap:Envelope>
    

    You can use a SOAP message generating tool, such as MindReef, to construct a valid SOAP Request for a given Web service.

  11. In the Store Response in Collection field, enter MOVIE_RESULTS. This is where the response from the Web service will be stored.

    The Create/Edit Web Service page should resemble Figure: Create/Edit Web Service Page.

    Create/Edit Web Service Page

    Description of this figure follows
    Description of "Create/Edit Web Service Page"

  12. Click Create.

    The Web Service References page appears, showing Movie Info in the list.

Test the Web Service Reference

To test the Web service reference:

  1. On the Web Service References page, click the Test icon next to the Movie Info Web reference.

    The Web Services Testing page appears.


    Note:

    View must be set to Report, otherwise the Test icon is not displayed.

  2. In the SOAP Envelope field, replace #ZIP# with 43221 and #RADIUS# with 5.

  3. Click Test.

  4. Review the Result field and note the following about the response:

    • The base node in the return envelope is called:

      GetTheatersAndMoviesResponse
      
    • The namespace for the message is:

      http://www.ignyte.com/whatsshowing
      
    • The XPath to the interesting parts of the response under the result element is:

      /GetTheatersAndMoviesResponse/GetTheatersAndMoviesResult/Theater/Movies/Movie
      
    • The interesting elements in the results are called:

      Name
      Rating
      RunningTime
      ShowTimes
      

Create a Form and Report on the Web Service Results

Next, you create a page that contains a form and report to use with the Manual Web Service Reference.

To create a form and report on a Manual Web Service Reference:

  1. On the Application home page, click Create Page.

  2. Select Form and click Next.

  3. Select Form and Report on Web Service and click Next.

  4. For Web Service Reference, select Movie Info and click Next.

  5. For Page and Region Attributes, make these changes:

    1. Form Region Title - Enter Theater Information.

    2. Accept all other defaults and click Next.

  6. For Input Items, make these changes:

    1. For ZIP and RADIUS, accept the default, Yes, in the Create column.

    2. For ZIP, change the Item label default to ZIP Code.

    3. Click Next.

  7. For Web Service Results, make these changes:

    1. SOAP Style - Select Document.

    2. Message Format - Select Literal.

    3. Result Node Path - Enter the following:

      /GetTheatersAndMoviesResponse/GetTheatersAndMoviesResult/Theater/Movies/Movie

    4. Message Namespace - Enter the following:

      http://www.ignyte.com/whatsshowing

    5. Click Next.

  8. For Parameter Names, enter Name, Rating, RunningTime, and Showtimes and click Next.

  9. For Tab Options, accept the default and click Next.

  10. Click Create Form and Report.

  11. Click Run Page.

  12. If prompted to log in, enter the user name and password for your workspace and click Login.

    A form and report resembling Figure: Theater Information Form and Report without Data appears. Notice that the Theater Information Form at the top of the page contains a data entry field and a submit button, but the Results Report does not contain any data.

    Theater Information Form and Report without Data

    Description of this figure follows
    Description of "Theater Information Form and Report without Data"

  13. To test the form, enter 43221 in the ZIP Code field and 5 in the Radius field. Then click Submit.

    The report at the bottom of the page should resemble Figure: Theater Information Report Showing Resulting Data. The report lists the names and addresses of movie theaters matching the entered ZIP code and radius.

    Theater Information Report Showing Resulting Data

    Description of this figure follows
    Description of "Theater Information Report Showing Resulting Data"