26.3.2 Declaring exchange capabilities using WSDL

The following updates are needed in order to enable the HRDetails168 to work as a target cooperative portlet.

1. From the Project Explorer view right-click the HRDetails168\WebContent folder and select New | Folder.

2. Type wsdl for the Folder name field and click Finish.

3. Right-click the wsdl folder just created and choose Import... | File system from the context menu.

4. Browse the directory where the HRDetails168.wsdl file is located and select this file. The WSDL file is provided as additional material in the following directory:
c:\LabFiles\Cooperative Portlets\JSR168\HRDetails.wsdl

5. Select the HRDetails168.wsdl to be imported.

6. Make sure the Create selected folders only option is checked.

Figure 26-7 Importing HRDetails.wsdl

7. Click Finish.

8. Example 26-13 illustrates the HRDetails168.wsdl file.

Example 26-13 HRDetails168.wsdl file

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="DeptResults_Service"
  targetNamespace="http://www.ibm.com/wps/c2a/examples/hrdetails"
  xmlns="http://schemas.xmlsoap.org/wsdl/"
  xmlns:portlet="http://www.ibm.com/wps/c2a"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="http://www.ibm.com/wps/c2a/examples/hrdetails"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<types>
  <xsd:schema targetNamespace="http://www.ibm.com/wps/c2a/examples/hrdetails">
    <xsd:simpleType name="DEPT_NO">
      <xsd:restriction base="xsd:string">
      </xsd:restriction>
    </xsd:simpleType>
  </xsd:schema>
</types>

<message name="GetResultsMessageNameRequest">
  <part name="dept_Id" type="tns:DEPT_NO"/>
</message>

<portType name="DeptResults_Service">
  <operation name="dept_Detail">
     <input message="tns:GetResultsMessageNameRequest"/>
  </operation>
</portType>

<binding
    name="DeptResultsBinding"
      type="tns:DeptResults_Service">
  <portlet:binding/>
  <operation name="dept_Detail">
    <portlet:action name="departmentList" type="standard" caption="show.all.employees" description="Get.Results.for.specified.sql.string"
    actionNameParameter="ACTION_NAME"/>
    <input>
      <portlet:param name="DEPT_NO" partname="dept_Id" caption="department.ID"/>
    </input>
  </operation>
</binding>
</definitions>

Note: Here the departmentList action has an input parameter element named DEPT_NO.

Note: While the number of output parameters associated with an action is unlimited, input parameters can only be received one at a time in the processAction() method.


Redbooks
ibm.com/redbooks