Lesson 1: Setting Up a Web Server to Receive SOAP Requests and Send SOAP Responses

In this lesson, you set up an SAP Sybase IQ web server running SOAP and DISH web services that handles JAX-WS client application requests.

Prerequisites

This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Using JAX-WS to access a SOAP/DISH web service.

Task

This lesson sets up the web server and a simple web service that you will use in the next lesson. It can be instructional to use proxy software to observe the XML message traffic. The proxy inserts itself between your client application and the web server.

  1. Start the SAP Sybase IQ demonstration database using the following command:
    iqsrv16 -xs http(port=8082) iqdemo.db

    This command indicates that the HTTP web server should listen on port 8082 for requests. Use a different port number if 8082 is disallowed on your network.

  2. Connect to the database server with Interactive SQL using the following command:
    dbisql -c "UID=<user_id>;PWD=<password>;SERVER=demo"
  3. Create a stored procedure that lists Employees table columns.

    Execute the following SQL statements in Interactive SQL:

    CREATE OR REPLACE PROCEDURE ListEmployees()
    RESULT (
        EmployeeID            INTEGER,
        Surname               CHAR(20),
        GivenName             CHAR(20),
        StartDate             DATE,
        TerminationDate       DATE )
    BEGIN
        SELECT EmployeeID, Surname, GivenName, StartDate, TerminationDate 
        FROM Employees;
    END;

    These statements create a new procedure named ListEmployees that defines the structure of the result set output, and selects certain columns from the Employees table.

  4. Create a new SOAP service to accept incoming requests.

    Execute the following SQL statement in Interactive SQL:

    CREATE SERVICE "WS/EmployeeList"
        TYPE 'SOAP'
        FORMAT 'CONCRETE' EXPLICIT ON
        DATATYPE ON
        AUTHORIZATION OFF
        SECURE OFF
        USER DBA
        AS CALL ListEmployees();

    This statement creates a new SOAP web service named WS/EmployeeList that generates a SOAP type as output. It calls the ListEmployees procedure when a web client sends a request to the service. The service name is surrounded by quotation marks because of the slash character (/) that appears in the service name.

    SOAP web services accessed from JAX-WS should be declared with the FORMAT 'CONCRETE' clause. The EXPLICIT ON clause indicates that the corresponding DISH service should generate XML Schema that describes an explicit dataset object based on the result set of the ListEmployees procedure. The EXPLICIT clause only affects the generated WSDL document.

    DATATYPE ON indicates that explicit data type information is generated in the XML result set response and the input parameters. This option does not affect the WSDL document that is generated.

  5. Create a new DISH service to act as a proxy for the SOAP service and to generate the WSDL document.

    Execute the following SQL statement in Interactive SQL:

    CREATE SERVICE WSDish
        TYPE 'DISH'
        FORMAT 'CONCRETE'
        GROUP WS
        AUTHORIZATION OFF
        SECURE OFF
        USER DBA;

    DISH web services accessed from JAX-WS should be declared with the FORMAT 'CONCRETE' clause. The GROUP clause identifies the SOAP services that should be handled by the DISH service. The EmployeeList service created in the previous step is part of the GROUP WS because it is declared as WS/EmployeeList.

  6. Verify that the DISH web service is functional by accessing the associated WSDL document through a web browser.

    Open your web browser and go to http://localhost:8082/demo/WSDish.

    The DISH service automatically generates a WSDL document that appears in the browser window. Examine the EmployeeListDataset object, which looks similar to the following output:

    <s:complexType name="EmployeeListDataset">
    <s:sequence>
    <s:element name="rowset">
      <s:complexType>
      <s:sequence>
      <s:element name="row" minOccurs="0" maxOccurs="unbounded">
        <s:complexType>
        <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="EmployeeID" nillable="true" type="s:int" /> 
        <s:element minOccurs="0" maxOccurs="1" name="Surname" nillable="true" type="s:string" /> 
        <s:element minOccurs="0" maxOccurs="1" name="GivenName" nillable="true" type="s:string" /> 
        <s:element minOccurs="0" maxOccurs="1" name="StartDate" nillable="true" type="s:date" /> 
        <s:element minOccurs="0" maxOccurs="1" name="TerminationDate" nillable="true" type="s:date" /> 
        </s:sequence>
        </s:complexType>
      </s:element>
      </s:sequence>
      </s:complexType>
    </s:element>
    </s:sequence>
    </s:complexType>

    EmployeeListDataset is the explicit object generated by the FORMAT 'CONCRETE' and EXPLICIT ON clauses in the EmployeeList SOAP service. In a later lesson, the wsimport application uses this information to generate a SOAP 1.1 client interface for this service.

You have set up an SAP Sybase IQ web server running SOAP and DISH web services that can handle JAX-WS client application requests.

Next

In the next lesson, you create a Java application to communicate with the web server.