Objective:
To secure an EGL SOAP service by supplying credentials in the SOAP body. Users can specify the SOAP authentication type in the deployment descriptor (Provider’s service deployment tab) and specify the SOAP credentials in the deployment descriptor (Consumer’s service binding tab).
Pre-Requisite:
Liberty server with wssecurity and jaxws features must be installed in the machine.
Steps to install Liberty Server’s features:
1. Go to the installation directory of the Liberty server in the bin folder through the command prompt.

2. Add the below commands to install security and jaxws.

Step-1: Service Project Creation
Follow the below steps to create a Service project.
1. Navigate to File --> New --> EGL project.

2. The EGL Project window will appear.
3. Enter the Project name.
4. Select the Web Project option and click Next.

5. Click New… and select WebSphere Application Server Liberty.
6. Click Next.

7. Click the Browse… button to add the installed location of the Liberty server,
9. Web Project has been successfully created.
Step-2: SOAP Service runtime change
Follow the below steps to create SOAP service runtime change.
1. Go to the Project Explorer and navigate to WebPro --> EGL Source.
2. Double-click the WebPro.egldd
3. Go to the Overview tab
4. Select runtime as JAXWS and Save.

Step-3: Interface Creation
Follow the below steps to create an Interface.
1. Go to the Project Explorer and navigate to WebPro.
2. Right-click the WebPro.egldd and go to New --> Interface.
3. Enter the Package name and EGL source file name.
4. Click Finish.

5. Interface has been successfully created and soatest.egl file will open in EGL Editor.
6. Add the below function and Save.
function attest(message string in) returns(string).

Step-4: Service Creation
Follow the below steps to create a service.
1. Go to the Project Explorer view and select WebPro.
2. Right-click the WebPro.egldd and go to New--> Service.
3. Enter the Package name and EGL source file name.
4. Click Add… and select Interface and click OK.

5. Click Finish.

6. Service created and opened in EGL Editor.
Step-5: Service Code – Add the below code in the service egl file.
package services;
import interfaces.soatest;
service myaut implements soatest
function attest(message string in) returns (string)
return(message);
end
end 
Step-6: Add the server in the server Tab.
Follow the below steps to add the server in the server tab.
1. Go to the Server tab as highlighted below.
2. Right-click in the space New --> Server.

3. New Server window will appear.
4. Select the Liberty server and click Next.
5. Click Finish.

6. The server has been successfully added to the server tab.
Step-7: Setup WSDL policy
Follow the below steps for WSDL policy setup.
1. Go to the Project Explorer and navigate to WebPro --> EGL Source.
2. Double-click the WebPro.egldd.
3. Select the option UsernameTokenOverHTTP under WSDL policy and Save.

Step-8: Adding Security and jaxws feature in Liberty Server
Follow the below steps for adding security and jaxws feature in the liberty server
1. Go to the Project Explorer and navigate to WebSphere Application Server Liberty (2) --> servers --> defaultServer.
2. Open server.xml in the RBD workspace.

3. Add the below highlighted lines and save.
<feature>wsSecurity-1.1</feature>
<feature>jaxws-2.2</feature>

4. Restart the server by right-clicking the server in the server tab.

Step-9: Client Creation
Follow the below steps to create a client in the RBD workspace.
1. Navigate to File --> New --> EGL project.

2. EGL Project window will appear.
3. Enter the Project name and Select the Rich UI Project option.
4. Click Next.
5. EGL Rich UI Project window will appear.
6. Select the required Widget libraries checkbox.
7. Click Next and then Finish.
8. The RUI Project has been successfully created under the project explorer view.
Step-10: SOAP Service runtime Change
Follow the below steps to create a SOAP service runtime change.
1. Go to the Project Explorer and navigate to Richcli --> EGLSource.
2. Double-click Richcli.egldd, and go to the Overview tab
3. Select runtime as JAXWS and Save.

Step-11: Create a RUI handler.
Follow the below steps to create a SOAP service runtime change.
1. Go to Project Explorer and navigate to the RUI project.
2. Right-click the RUI project and go to New --> Rich UI handler.

3. Enter the Package name and EGL source file name.
4. Click Finish.

5. The RUI handler has been successfully created in the RUI Project.
Step-12: Service Binding in Deployment descriptor
Follow the below steps to create a service binding in the deployment descriptor.
1. Go to the Project Explorer and navigate to WebRUI --> EGL Source.
2. Under the Project Explorer,
3. Double-click the Richcli.egldd.
4. Click Add… to bind the server.
5. Enter the User ID and Password which is added in the server.xml.

Step-13: Client code
Follow the below steps to add client code.
1. Expand the Richcli --> handlers --> client1.egl handler.
2. Copy the code and Save.
package handlers;
// RUI Handler
import com.ibm.egl.rui.widgets.GridLayout;
import com.ibm.egl.rui.widgets.GridLayoutData;
import egl.ui.rui.Event;
import dojo.widgets.DojoButton;
import services.myauth;
//
//
handler client1 type RUIhandler {initialUI = [ ui ],onConstructionFunction = start, title="client1"}
ui GridLayout{ columns = 3, rows = 4, cellPadding = 4, children = [ Button ] };
Button DojoButton{ layoutData = new GridLayoutData{ row = 3, column = 2 }, text = "Button", onClick ::= Button_onClick };
function start()
end
function Button_onClick(event Event in)
//myauth myauth {@bindService};
myauth myauth {@bindService};
call myauth.atest("hello Everyone")returning to res onException servicelib.serviceExceptionHandler;
end
function res(retResult string in)
syslib.writeStdout(retResult);
end
end

3. Go to the Project Explorer and navigate to Richcli --> EGL Source.
4. Open the Richcli.egldd.
5. Select the Target project as WebPro and Save.

6. Right-click the Richcli project and select Generate.

7. Right-click the Richcli project and select Deploy EGL Project.
Step-14: Run the HTML file.
Follow the below steps to run the HTML file.
1. Go to the Project Explorer and navigate to webtart --> webcontent.
2. Right-click the client1-en_US.html.
3. Go to Run As --> Run on Server.

4. HTML page will open in the Internal browser.

5. Click the Button.
6. hello Everyone will display as highlighted.

Nandhini A
QA Engineer – RBD